From 03611bc6ec5642f29bb4606a65e7b9b1d4f449cc Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Tue, 27 Oct 2020 11:42:28 +0800 Subject: [PATCH] Add Accounts UI Refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • 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. --- .../Account icon colors/Contents.json | 6 + .../bazquxColor.colorset/Contents.json | 38 ++++ .../cloudkitColor.colorset/Contents.json | 38 ++++ .../feedbinColor.colorset/Contents.json | 38 ++++ .../feedlyColor.colorset/Contents.json | 38 ++++ .../feedwranglerColor.colorset/Contents.json | 38 ++++ .../freshRSSColor.colorset/Contents.json | 38 ++++ .../inoreaderColor.colorset/Contents.json | 38 ++++ .../localColor.colorset/Contents.json | 38 ++++ .../newsblurColor.colorset/Contents.json | 38 ++++ .../theoldreaderColor.colorset/Contents.json | 38 ++++ NetNewsWire.xcodeproj/project.pbxproj | 6 + Shared/AccountType+Helpers.swift | 121 ++++++++++++ .../Account icon colors/Contents.json | 6 + .../bazquxColor.colorset/Contents.json | 38 ++++ .../cloudkitColor.colorset/Contents.json | 38 ++++ .../feedbinColor.colorset/Contents.json | 38 ++++ .../feedlyColor.colorset/Contents.json | 38 ++++ .../feedwranglerColor.colorset/Contents.json | 38 ++++ .../freshRSSColor.colorset/Contents.json | 38 ++++ .../inoreaderColor.colorset/Contents.json | 38 ++++ .../localColor.colorset/Contents.json | 38 ++++ .../newsblurColor.colorset/Contents.json | 38 ++++ .../theoldreaderColor.colorset/Contents.json | 38 ++++ iOS/Settings/AddAccountViewController.swift | 172 ++++++++++++++---- iOS/Settings/Settings.storyboard | 12 +- 26 files changed, 1039 insertions(+), 44 deletions(-) create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json create mode 100644 Shared/AccountType+Helpers.swift create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json create mode 100644 iOS/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json new file mode 100644 index 000000000..7d310cf7a --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json new file mode 100644 index 000000000..fcb0938d9 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json new file mode 100644 index 000000000..b62e9df29 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json new file mode 100644 index 000000000..57113378a --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json new file mode 100644 index 000000000..bdaabb8f8 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json new file mode 100644 index 000000000..3451b43ef --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json new file mode 100644 index 000000000..4ceea8871 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json new file mode 100644 index 000000000..96b347187 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json new file mode 100644 index 000000000..9d05aeb0b --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json @@ -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 + } +} diff --git a/Mac/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json b/Mac/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json new file mode 100644 index 000000000..2ac4d7409 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json @@ -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 + } +} diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 8934a3e7c..5934518be 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -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 = ""; }; 1729529624AA1CD000D65E66 /* MacPreferencePanes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MacPreferencePanes.swift; sourceTree = ""; }; 1729529A24AA1FD200D65E66 /* MacSearchField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacSearchField.swift; sourceTree = ""; }; + 173A64162547BE0900267F6E /* AccountType+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AccountType+Helpers.swift"; sourceTree = ""; }; 1769E32124BC5925000E1E8E /* AccountsPreferencesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsPreferencesModel.swift; sourceTree = ""; }; 1769E32424BC5A65000E1E8E /* AddAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountView.swift; sourceTree = ""; }; 1769E32624BC5B6C000E1E8E /* AddAccountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountModel.swift; sourceTree = ""; }; @@ -3303,6 +3306,7 @@ 849A97561ED9EB0D007D329B /* Extensions */, 510C43F5243D0325009F70C3 /* ExtensionPoints */, 511D43CE231FA51100FB1562 /* Resources */, + 173A64162547BE0900267F6E /* AccountType+Helpers.swift */, ); path = Shared; sourceTree = ""; @@ -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 */, diff --git a/Shared/AccountType+Helpers.swift b/Shared/AccountType+Helpers.swift new file mode 100644 index 000000000..4aa9dba15 --- /dev/null +++ b/Shared/AccountType+Helpers.swift @@ -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 "" + } + + + + + + } + +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json new file mode 100644 index 000000000..9b5443387 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/bazquxColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json new file mode 100644 index 000000000..7a02ab4bf --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/cloudkitColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json new file mode 100644 index 000000000..70285bbbb --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/feedbinColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json new file mode 100644 index 000000000..9a49b2f33 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/feedlyColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json new file mode 100644 index 000000000..5cbd8aa7c --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/feedwranglerColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json new file mode 100644 index 000000000..f28741638 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/freshRSSColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json new file mode 100644 index 000000000..15944ddfc --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/inoreaderColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json new file mode 100644 index 000000000..da49629e9 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/localColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json new file mode 100644 index 000000000..33988d2d2 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/newsblurColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json new file mode 100644 index 000000000..04158365b --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Account icon colors/theoldreaderColor.colorset/Contents.json @@ -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 + } +} diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index 50e01e8b6..f6c370bbc 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -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) } diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index ccebe7898..942c82ae5 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -575,19 +575,19 @@ - + - + - - + +