Skip to content

Commit

Permalink
Continue progress on accounts UI in Preferences.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentsimmons committed Mar 24, 2019
1 parent c84f273 commit 1a44877
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 5 deletions.
6 changes: 6 additions & 0 deletions NetNewsWire.xcodeproj/project.pbxproj
Expand Up @@ -318,6 +318,8 @@
84F1F06A2243455C00DA0616 /* LocalAccount.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84F1F0682243455C00DA0616 /* LocalAccount.xib */; };
84F1F06C2243457C00DA0616 /* LocalAccountPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F1F06B2243457C00DA0616 /* LocalAccountPreferencesViewController.swift */; };
84F1F06D2243457C00DA0616 /* LocalAccountPreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F1F06B2243457C00DA0616 /* LocalAccountPreferencesViewController.swift */; };
84F1F0702246C1D800DA0616 /* AccountsTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F1F06F2246C1D800DA0616 /* AccountsTableCellView.swift */; };
84F1F0712246C1D800DA0616 /* AccountsTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F1F06F2246C1D800DA0616 /* AccountsTableCellView.swift */; };
84F204E01FAACBB30076E152 /* ArticleArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204DF1FAACBB30076E152 /* ArticleArray.swift */; };
84F2D5371FC22FCC00998D64 /* PseudoFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2D5351FC22FCB00998D64 /* PseudoFeed.swift */; };
84F2D5381FC22FCC00998D64 /* TodayFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2D5361FC22FCB00998D64 /* TodayFeedDelegate.swift */; };
Expand Down Expand Up @@ -923,6 +925,7 @@
84F1F0552242038B00DA0616 /* AccountsTableViewBackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsTableViewBackgroundView.swift; sourceTree = "<group>"; };
84F1F0682243455C00DA0616 /* LocalAccount.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LocalAccount.xib; sourceTree = "<group>"; };
84F1F06B2243457C00DA0616 /* LocalAccountPreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalAccountPreferencesViewController.swift; sourceTree = "<group>"; };
84F1F06F2246C1D800DA0616 /* AccountsTableCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsTableCellView.swift; sourceTree = "<group>"; };
84F204CD1FAACB660076E152 /* FeedListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListViewController.swift; sourceTree = "<group>"; };
84F204DF1FAACBB30076E152 /* ArticleArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleArray.swift; sourceTree = "<group>"; };
84F2D5351FC22FCB00998D64 /* PseudoFeed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PseudoFeed.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1139,6 +1142,7 @@
isa = PBXGroup;
children = (
842AE5B82241F37B004A742C /* AccountsPreferencesViewController.swift */,
84F1F06F2246C1D800DA0616 /* AccountsTableCellView.swift */,
842AE5B72241F37B004A742C /* AccountsControlsBackgroundView.swift */,
84F1F0552242038B00DA0616 /* AccountsTableViewBackgroundView.swift */,
84F1F0672243455C00DA0616 /* Local */,
Expand Down Expand Up @@ -2467,6 +2471,7 @@
840F7C3321BDA4B40057E851 /* SidebarOutlineView.swift in Sources */,
840F7C3421BDA4B40057E851 /* Author+Scriptability.swift in Sources */,
840F7C3521BDA4B40057E851 /* PseudoFeed.swift in Sources */,
84F1F0712246C1D800DA0616 /* AccountsTableCellView.swift in Sources */,
840F7C3621BDA4B40057E851 /* NSScriptCommand+NetNewsWire.swift in Sources */,
840F7C3821BDA4B40057E851 /* Article+Scriptability.swift in Sources */,
840F7C3921BDA4B40057E851 /* SmartFeed.swift in Sources */,
Expand Down Expand Up @@ -2668,6 +2673,7 @@
849A977B1ED9EC04007D329B /* UnreadIndicatorView.swift in Sources */,
84B99C9D1FAE83C600ECDEDB /* DeleteFromSidebarCommand.swift in Sources */,
849A97541ED9EAC0007D329B /* AddFeedWindowController.swift in Sources */,
84F1F0702246C1D800DA0616 /* AccountsTableCellView.swift in Sources */,
849A976D1ED9EBC8007D329B /* TimelineTableView.swift in Sources */,
84D52E951FE588BB00D14F5B /* DetailStatusBarView.swift in Sources */,
D5E4CC64202C1AC1009B4FFC /* MainWindowController+Scriptability.swift in Sources */,
Expand Down
10 changes: 7 additions & 3 deletions NetNewsWire/Base.lproj/Preferences.storyboard
Expand Up @@ -175,7 +175,7 @@
<!--Advanced Preferences View Controller-->
<scene sceneID="z1G-rc-sP5">
<objects>
<viewController storyboardIdentifier="Advanced" id="GNh-Wp-giO" customClass="AdvancedPreferencesViewController" sceneMemberID="viewController">
<viewController storyboardIdentifier="Advanced" id="GNh-Wp-giO" customClass="AdvancedPreferencesViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="Hij-7D-6Pw">
<rect key="frame" x="0.0" y="0.0" width="450" height="93"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -246,10 +246,10 @@
</objects>
<point key="canvasLocation" x="-29" y="347"/>
</scene>
<!--View Controller-->
<!--Accounts Preferences View Controller-->
<scene sceneID="Rsj-41-ZOj">
<objects>
<viewController storyboardIdentifier="Accounts" id="z5c-Js-Up9" sceneMemberID="viewController">
<viewController storyboardIdentifier="Accounts" id="z5c-Js-Up9" customClass="AccountsPreferencesViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="GrE-GP-fYK">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -290,6 +290,10 @@
</prototypeCellViews>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="z5c-Js-Up9" id="mzL-4s-IOm"/>
<outlet property="delegate" destination="z5c-Js-Up9" id="ac0-N6-gi5"/>
</connections>
</tableView>
</subviews>
</clipView>
Expand Down
Expand Up @@ -7,10 +7,61 @@
//

import AppKit
import Account

final class AccountsPreferencesViewController: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()
private var sortedAccounts = [Account]()

override func viewWillAppear() {
updateSortedAccounts()
}
}

// MARK: - NSTableViewDataSource

extension AccountsPreferencesViewController: NSTableViewDataSource {

func numberOfRows(in tableView: NSTableView) -> Int {
return sortedAccounts.count
}

func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return sortedAccounts[row]
}
}

// MARK: - NSTableViewDelegate

extension AccountsPreferencesViewController: NSTableViewDelegate {

private static let cellIdentifier = NSUserInterfaceItemIdentifier(rawValue: "AccountCell")

func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {

func configure(_ cell: AccountsTableCellView) {
}

if let cell = tableView.makeView(withIdentifier: AccountsPreferencesViewController.cellIdentifier, owner: nil) as? AccountsTableCellView {
configure(cell)
return cell
}

let cell = AccountsTableCellView()
cell.identifier = AccountsPreferencesViewController.cellIdentifier
configure(cell)
return cell
}

func tableViewSelectionDidChange(_ notification: Notification) {
}
}

// MARK: - Private

private extension AccountsPreferencesViewController {

func updateSortedAccounts() {
sortedAccounts = AccountManager.shared.sortedAccounts
}
}
14 changes: 14 additions & 0 deletions NetNewsWire/Preferences/Accounts/AccountsTableCellView.swift
@@ -0,0 +1,14 @@
//
// AccountsTableCellView.swift
// NetNewsWire
//
// Created by Brent Simmons on 3/23/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//

import AppKit

final class AccountsTableCellView: NSTableCellView {


}

0 comments on commit 1a44877

Please sign in to comment.