Add Accounts UI Refresh

• An extenison has been added to `AccountType` for iconColors (which have been added to the asset catalogs) and localised account names. SPM can handle resources so it might make sense to move to there.

• Add Account screen now has sections for local, icloud, web, and self-hosted, icons are now tinted and sized a bit smaller, and text is now `body` sized.
This commit is contained in:
Stuart Breckenridge 2020-10-27 11:42:28 +08:00
parent 0d5b3ea48b
commit 03611bc6ec
No known key found for this signature in database
GPG Key ID: 802A426F493CA19C
26 changed files with 1039 additions and 44 deletions

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.800",
"green" : "0.600",
"red" : "0.200"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.761",
"green" : "0.561",
"red" : "0.169"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.698",
"green" : "0.682",
"red" : "0.682"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.400",
"green" : "0.388",
"red" : "0.388"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.808",
"green" : "0.369",
"red" : "0.027"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.753",
"green" : "0.271",
"red" : "0.027"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.298",
"green" : "0.694",
"red" : "0.169"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.220",
"green" : "0.616",
"red" : "0.090"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.737",
"green" : "0.569",
"red" : "0.118"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.698",
"green" : "0.529",
"red" : "0.078"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.741",
"green" : "0.384",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.663",
"green" : "0.306",
"red" : "0.004"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.780",
"green" : "0.482",
"red" : "0.004"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.702",
"green" : "0.404",
"red" : "0.004"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.478",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.518",
"red" : "0.039"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.584",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.039",
"green" : "0.624",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.145",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.067",
"red" : "0.882"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -23,6 +23,8 @@
1729529524AA1CAA00D65E66 /* GeneralPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */; };
1729529724AA1CD000D65E66 /* MacPreferencePanes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529624AA1CD000D65E66 /* MacPreferencePanes.swift */; };
1729529B24AA1FD200D65E66 /* MacSearchField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529A24AA1FD200D65E66 /* MacSearchField.swift */; };
173A64172547BE0900267F6E /* AccountType+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 173A64162547BE0900267F6E /* AccountType+Helpers.swift */; };
173A642C2547BE9600267F6E /* AccountType+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 173A64162547BE0900267F6E /* AccountType+Helpers.swift */; };
175942AA24AD533200585066 /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; };
175942AB24AD533200585066 /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; };
1769E32224BC5925000E1E8E /* AccountsPreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1769E32124BC5925000E1E8E /* AccountsPreferencesModel.swift */; };
@ -1453,6 +1455,7 @@
1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPreferencesView.swift; sourceTree = "<group>"; };
1729529624AA1CD000D65E66 /* MacPreferencePanes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MacPreferencePanes.swift; sourceTree = "<group>"; };
1729529A24AA1FD200D65E66 /* MacSearchField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacSearchField.swift; sourceTree = "<group>"; };
173A64162547BE0900267F6E /* AccountType+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AccountType+Helpers.swift"; sourceTree = "<group>"; };
1769E32124BC5925000E1E8E /* AccountsPreferencesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsPreferencesModel.swift; sourceTree = "<group>"; };
1769E32424BC5A65000E1E8E /* AddAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountView.swift; sourceTree = "<group>"; };
1769E32624BC5B6C000E1E8E /* AddAccountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountModel.swift; sourceTree = "<group>"; };
@ -3303,6 +3306,7 @@
849A97561ED9EB0D007D329B /* Extensions */,
510C43F5243D0325009F70C3 /* ExtensionPoints */,
511D43CE231FA51100FB1562 /* Resources */,
173A64162547BE0900267F6E /* AccountType+Helpers.swift */,
);
path = Shared;
sourceTree = "<group>";
@ -5118,6 +5122,7 @@
5108F6B72375E612001ABC45 /* CacheCleaner.swift in Sources */,
518651DA235621840078E021 /* ImageTransition.swift in Sources */,
51C266EA238C334800F53014 /* ContextMenuPreviewViewController.swift in Sources */,
173A642C2547BE9600267F6E /* AccountType+Helpers.swift in Sources */,
51627A6923861DED007B3B4B /* MasterFeedViewController+Drop.swift in Sources */,
514219372352510100E07E2C /* ImageScrollView.swift in Sources */,
516AE9B32371C372007DEEAA /* MasterFeedTableViewSectionHeaderLayout.swift in Sources */,
@ -5278,6 +5283,7 @@
848D578E21543519005FFAD5 /* PasteboardWebFeed.swift in Sources */,
5144EA2F2279FAB600D19003 /* AccountsDetailViewController.swift in Sources */,
849A97801ED9EC42007D329B /* DetailViewController.swift in Sources */,
173A64172547BE0900267F6E /* AccountType+Helpers.swift in Sources */,
518C3193237B00D9004D740F /* DetailIconSchemeHandler.swift in Sources */,
84C9FC6722629B9000D921D6 /* AppDelegate.swift in Sources */,
510C417F24E5D1AE008226FD /* ExtensionContainersFile.swift in Sources */,

View File

@ -0,0 +1,121 @@
//
// AccountType+Helpers.swift
// NetNewsWire
//
// Created by Stuart Breckenridge on 27/10/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import Foundation
import Account
#if os(macOS)
import AppKit
#else
import UIKit
#endif
extension AccountType {
// TODO: Move this to the Account Package.
// Colors
#if os(macOS)
func iconColor() -> NSColor {
switch self {
case .onMyMac:
return NSColor(named: "localColor")!
case .bazQux:
return NSColor(named: "bazquxColor")!
case .cloudKit:
return NSColor(named: "cloudkitColor")!
case .feedWrangler:
return NSColor(named: "feedwranglerColor")!
case .feedbin:
return NSColor(named: "feedbinColor")!
case .feedly:
return NSColor(named: "feedlyColor")!
case .freshRSS:
return NSColor(named: "freshRSSColor")!
case .inoreader:
return NSColor(named: "inoreaderColor")!
case .newsBlur:
return NSColor(named: "newsblurColor")!
case .theOldReader:
return NSColor(named: "theoldreaderColor")!
default:
return NSColor.blue
}
}
#else
func iconColor() -> UIColor {
switch self {
case .onMyMac:
return UIColor(named: "localColor")!
case .bazQux:
return UIColor(named: "bazquxColor")!
case .cloudKit:
return UIColor(named: "cloudkitColor")!
case .feedWrangler:
return UIColor(named: "feedwranglerColor")!
case .feedbin:
return UIColor(named: "feedbinColor")!
case .feedly:
return UIColor(named: "feedlyColor")!
case .freshRSS:
return UIColor(named: "freshRSSColor")!
case .inoreader:
return UIColor(named: "inoreaderColor")!
case .newsBlur:
return UIColor(named: "newsblurColor")!
case .theOldReader:
return UIColor(named: "theoldreaderColor")!
default:
return UIColor.blue
}
}
#endif
func localizedAccountName() -> String {
switch self {
case .onMyMac:
let defaultName: String
#if os(macOS)
defaultName = NSLocalizedString("On My Mac", comment: "Account name")
#else
if UIDevice.current.userInterfaceIdiom == .pad {
defaultName = NSLocalizedString("On My iPad", comment: "Account name")
} else {
defaultName = NSLocalizedString("On My iPhone", comment: "Account name")
}
#endif
return defaultName
case .bazQux:
return NSLocalizedString("BazQux", comment: "Account name")
case .cloudKit:
return NSLocalizedString("iCloud", comment: "Account name")
case .feedWrangler:
return NSLocalizedString("FeedWrangler", comment: "Account name")
case .feedbin:
return NSLocalizedString("Feedbin", comment: "Account name")
case .feedly:
return NSLocalizedString("Feedly", comment: "Account name")
case .freshRSS:
return NSLocalizedString("FreshRSS", comment: "Account name")
case .inoreader:
return NSLocalizedString("Inoreader", comment: "Account name")
case .newsBlur:
return NSLocalizedString("NewsBlur", comment: "Account name")
case .theOldReader:
return NSLocalizedString("The Old Reader", comment: "Account name")
default:
return ""
}
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "204",
"green" : "153",
"red" : "51"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "194",
"green" : "143",
"red" : "43"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "178",
"green" : "174",
"red" : "174"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "102",
"green" : "99",
"red" : "99"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "206",
"green" : "94",
"red" : "7"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "192",
"green" : "69",
"red" : "7"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "76",
"green" : "177",
"red" : "43"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "56",
"green" : "157",
"red" : "23"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "188",
"green" : "145",
"red" : "30"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "178",
"green" : "135",
"red" : "20"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "189",
"green" : "98",
"red" : "0"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "169",
"green" : "78",
"red" : "1"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "199",
"green" : "123",
"red" : "1"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "179",
"green" : "103",
"red" : "1"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "255",
"green" : "122",
"red" : "0"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "255",
"green" : "132",
"red" : "10"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0",
"green" : "149",
"red" : "255"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "10",
"green" : "159",
"red" : "255"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0",
"green" : "37",
"red" : "255"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0",
"green" : "17",
"red" : "225"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -16,6 +16,52 @@ protocol AddAccountDismissDelegate: UIViewController {
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
private enum AddAccountSections: Int, CaseIterable {
case local = 0
case icloud
case web
case selfhosted
var sectionHeader: String {
switch self {
case .local:
return NSLocalizedString("Local", comment: "Local Account")
case .icloud:
return NSLocalizedString("iCloud", comment: "iCloud Account")
case .web:
return NSLocalizedString("Web", comment: "Web Account")
case .selfhosted:
return NSLocalizedString("Self-hosted", comment: "Self hosted Account")
}
}
var sectionFooter: String {
switch self {
case .local:
return NSLocalizedString("Local accounts do not sync your subscriptions across devices.", comment: "Local Account")
case .icloud:
return NSLocalizedString("Use your iCloud account to sync your subscriptions across your iOS and macOS devices.", comment: "iCloud Account")
case .web:
return NSLocalizedString("Web accounts sync your subscriptions across all your devices.", comment: "Web Account")
case .selfhosted:
return NSLocalizedString("Self-hosted accounts sync your subscriptions across all your devices.", comment: "Self hosted Account")
}
}
var sectionContent: [AccountType] {
switch self {
case .local:
return [.onMyMac]
case .icloud:
return [.cloudKit]
case .web:
return [.bazQux, .feedbin, .feedly, .feedWrangler, .inoreader, .newsBlur, .theOldReader]
case .selfhosted:
return [.freshRSS]
}
}
}
#if DEBUG
private var addableAccountTypes: [AccountType] = [.onMyMac, .cloudKit, .feedbin, .feedly, .inoreader, .newsBlur, .feedWrangler, .bazQux, .theOldReader, .freshRSS]
#else
@ -28,58 +74,108 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
}
override func numberOfSections(in tableView: UITableView) -> Int {
1
return AddAccountSections.allCases.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return addableAccountTypes.count
if section == AddAccountSections.local.rawValue {
return AddAccountSections.local.sectionContent.count
}
if section == AddAccountSections.icloud.rawValue {
return AddAccountSections.icloud.sectionContent.count
}
if section == AddAccountSections.web.rawValue {
return AddAccountSections.web.sectionContent.count
}
if section == AddAccountSections.selfhosted.rawValue {
return AddAccountSections.selfhosted.sectionContent.count
}
return 0
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 52.0
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
switch section {
case AddAccountSections.local.rawValue:
return AddAccountSections.local.sectionHeader
case AddAccountSections.icloud.rawValue:
return AddAccountSections.icloud.sectionHeader
case AddAccountSections.web.rawValue:
return AddAccountSections.web.sectionHeader
case AddAccountSections.selfhosted.rawValue:
return AddAccountSections.selfhosted.sectionHeader
default:
return nil
}
}
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
switch section {
case AddAccountSections.local.rawValue:
return AddAccountSections.local.sectionFooter
case AddAccountSections.icloud.rawValue:
return AddAccountSections.icloud.sectionFooter
case AddAccountSections.web.rawValue:
return AddAccountSections.web.sectionFooter
case AddAccountSections.selfhosted.rawValue:
return AddAccountSections.selfhosted.sectionFooter
default:
return nil
}
}
// override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// return 52.0
// }
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "SettingsAccountTableViewCell", for: indexPath) as! SettingsComboTableViewCell
switch addableAccountTypes[indexPath.row] {
case .onMyMac:
cell.comboNameLabel?.text = Account.defaultLocalAccountName
cell.comboImage?.image = AppAssets.image(for: .onMyMac)
case .cloudKit:
cell.comboNameLabel?.text = NSLocalizedString("iCloud", comment: "iCloud")
cell.comboImage?.image = AppAssets.accountCloudKitImage
case .feedbin:
cell.comboNameLabel?.text = NSLocalizedString("Feedbin", comment: "Feedbin")
cell.comboImage?.image = AppAssets.accountFeedbinImage
case .feedWrangler:
cell.comboNameLabel?.text = NSLocalizedString("Feed Wrangler", comment: "Feed Wrangler")
cell.comboImage?.image = AppAssets.accountFeedWranglerImage
case .feedly:
cell.comboNameLabel?.text = NSLocalizedString("Feedly", comment: "Feedly")
cell.comboImage?.image = AppAssets.accountFeedlyImage
case .newsBlur:
cell.comboNameLabel?.text = NSLocalizedString("NewsBlur", comment: "NewsBlur")
cell.comboImage?.image = AppAssets.accountNewsBlurImage
case .bazQux:
cell.comboNameLabel?.text = NSLocalizedString("BazQux", comment: "BazQux")
cell.comboImage?.image = AppAssets.accountBazQuxImage
case .theOldReader:
cell.comboNameLabel?.text = NSLocalizedString("The Old Reader", comment: "The Old Reader")
cell.comboImage?.image = AppAssets.accountTheOldReaderImage
case .freshRSS:
cell.comboNameLabel?.text = NSLocalizedString("FreshRSS", comment: "FreshRSS")
cell.comboImage?.image = AppAssets.accountFreshRSSImage
case .inoreader:
cell.comboNameLabel?.text = NSLocalizedString("Inoreader", comment: "Inoreader")
cell.comboImage?.image = AppAssets.accountInoreaderImage
switch indexPath.section {
case AddAccountSections.local.rawValue:
cell.comboNameLabel?.text = AddAccountSections.local.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: .onMyMac)?.tinted(color: AddAccountSections.local.sectionContent[indexPath.row].iconColor())
case AddAccountSections.icloud.rawValue:
cell.comboNameLabel?.text = AddAccountSections.icloud.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.icloud.sectionContent[indexPath.row])?.tinted(color: AddAccountSections.icloud.sectionContent[indexPath.row].iconColor())
case AddAccountSections.web.rawValue:
cell.comboNameLabel?.text = AddAccountSections.web.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.web.sectionContent[indexPath.row])?.tinted(color: AddAccountSections.web.sectionContent[indexPath.row].iconColor())
case AddAccountSections.selfhosted.rawValue:
cell.comboNameLabel?.text = AddAccountSections.selfhosted.sectionContent[indexPath.row].localizedAccountName()
cell.comboImage?.image = AppAssets.image(for: AddAccountSections.selfhosted.sectionContent[indexPath.row])?.tinted(color: AddAccountSections.web.sectionContent[indexPath.row].iconColor())
default:
return cell
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch addableAccountTypes[indexPath.row] {
switch indexPath.section {
case AddAccountSections.local.rawValue:
let type = AddAccountSections.local.sectionContent[indexPath.row]
presentController(for: type)
case AddAccountSections.icloud.rawValue:
let type = AddAccountSections.icloud.sectionContent[indexPath.row]
presentController(for: type)
case AddAccountSections.web.rawValue:
let type = AddAccountSections.web.sectionContent[indexPath.row]
presentController(for: type)
case AddAccountSections.selfhosted.rawValue:
let type = AddAccountSections.selfhosted.sectionContent[indexPath.row]
presentController(for: type)
default:
return
}
}
private func presentController(for accountType: AccountType) {
switch accountType {
case .onMyMac:
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "LocalAccountNavigationViewController") as! UINavigationController
navController.modalPresentationStyle = .currentContext
@ -119,7 +215,7 @@ class AddAccountViewController: UITableViewController, AddAccountDismissDelegate
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "ReaderAPIAccountNavigationViewController") as! UINavigationController
navController.modalPresentationStyle = .currentContext
let addViewController = navController.topViewController as! ReaderAPIAccountViewController
addViewController.accountType = addableAccountTypes[indexPath.row]
addViewController.accountType = accountType
addViewController.delegate = self
present(navController, animated: true)
}

View File

@ -575,19 +575,19 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="iTt-HT-Ane">
<rect key="frame" x="20" y="11.5" width="217.5" height="32"/>
<rect key="frame" x="20" y="15" width="147.5" height="25"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="accountLocal" translatesAutoresizingMaskIntoConstraints="NO" id="tb2-dO-AhR">
<rect key="frame" x="0.0" y="0.0" width="32" height="32"/>
<rect key="frame" x="0.0" y="0.0" width="25" height="25"/>
<color key="tintColor" systemColor="labelColor"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="0GF-vU-aEc"/>
<constraint firstAttribute="width" constant="32" id="xDy-t7-26A"/>
<constraint firstAttribute="height" constant="25" id="0GF-vU-aEc"/>
<constraint firstAttribute="width" constant="25" id="xDy-t7-26A"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="On My iPhone" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="116-rt-msI">
<rect key="frame" x="48" y="0.0" width="169.5" height="32"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
<rect key="frame" x="41" y="0.0" width="106.5" height="25"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>