From 24dbe7c310a5bad0397cc857397954ff9db9a0fa Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Fri, 30 Oct 2020 09:30:11 +0800 Subject: [PATCH] Fixes #2534 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Minor tweaks to the iCloud icon • Consistent footers on add account sheet • Old functionality removed when the accounts tableview has no selection --- .../AccountsPreferencesViewController.swift | 24 ++++++-- .../Accounts/AddAccountsView.swift | 55 ++++++++++-------- .../accountCloudKit.imageset/icloud-any.pdf | Bin 5871 -> 6041 bytes .../accountCloudKit.imageset/icloud-dark.pdf | Bin 5870 -> 6041 bytes 4 files changed, 48 insertions(+), 31 deletions(-) diff --git a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift index 50ef70f42..c33b1ea85 100644 --- a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift +++ b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift @@ -11,7 +11,12 @@ import Account import SwiftUI import RSCore +// MARK: - AccountsPreferencesAddAccountDelegate +protocol AccountsPreferencesAddAccountDelegate { + func presentSheetForAccount(_ accountType: AccountType) +} +// MARK: - AccountsPreferencesViewController final class AccountsPreferencesViewController: NSViewController { @IBOutlet weak var tableView: NSTableView! @@ -39,6 +44,11 @@ final class AccountsPreferencesViewController: NSViewController { var rTable = tableView.frame rTable.size.width = tableView.superview!.frame.size.width tableView.frame = rTable + + // Set initial row selection + if sortedAccounts.count > 0 { + tableView.selectRow(0) + } } @IBAction func addAccount(_ sender: Any) { @@ -119,7 +129,7 @@ extension AccountsPreferencesViewController: NSTableViewDelegate { let selectedRow = tableView.selectedRow if tableView.selectedRow == -1 { deleteButton.isEnabled = false - showController(AccountsAddViewController()) + hideController() return } else { deleteButton.isEnabled = true @@ -137,11 +147,6 @@ extension AccountsPreferencesViewController: NSTableViewDelegate { } -// MARK: - AccountsPreferencesAddAccountDelegate -protocol AccountsPreferencesAddAccountDelegate { - func presentSheetForAccount(_ accountType: AccountType) -} - extension AccountsPreferencesViewController: AccountsPreferencesAddAccountDelegate { func presentSheetForAccount(_ accountType: AccountType) { switch accountType { @@ -241,6 +246,13 @@ private extension AccountsPreferencesViewController { } + func hideController() { + if let controller = children.first { + children.removeAll() + controller.view.removeFromSuperview() + } + } + } extension AccountsPreferencesViewController: OAuthAccountAuthorizationOperationDelegate { diff --git a/Mac/Preferences/Accounts/AddAccountsView.swift b/Mac/Preferences/Accounts/AddAccountsView.swift index 4a6acdc24..cdfc56cf1 100644 --- a/Mac/Preferences/Accounts/AddAccountsView.swift +++ b/Mac/Preferences/Accounts/AddAccountsView.swift @@ -31,7 +31,7 @@ private enum AddAccountSections: Int, CaseIterable { var sectionFooter: String { switch self { case .local: - return NSLocalizedString("This account does not sync subscriptions across devices.", comment: "Local Account") + return NSLocalizedString("Local accounts do not sync 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: @@ -130,6 +130,7 @@ struct AddAccountsView: View { Text("Local") .font(.headline) .padding(.horizontal) + Picker(selection: $selectedAccount, label: Text(""), content: { ForEach(AddAccountSections.local.sectionContent, id: \.self, content: { account in HStack(alignment: .top) { @@ -137,21 +138,22 @@ struct AddAccountsView: View { .resizable() .aspectRatio(contentMode: .fit) .frame(width: 25, height: 25, alignment: .center) - .offset(CGSize(width: 0, height: -2.5)) + .offset(CGSize(width: 0, height: -3.5)) .padding(.leading, 4) - VStack(alignment: .leading, spacing: 4) { - Text(account.localizedAccountName()) - Text(AddAccountSections.local.sectionFooter).foregroundColor(.gray) - .font(.caption) - } + Text(account.localizedAccountName()) } .tag(account) }) }) .pickerStyle(RadioGroupPickerStyle()) .offset(x: 7.5, y: 0) + + Text(AddAccountSections.local.sectionFooter).foregroundColor(.gray) + .font(.caption) + .padding(.horizontal) + } } @@ -161,6 +163,8 @@ struct AddAccountsView: View { Text("iCloud") .font(.headline) .padding(.horizontal) + .padding(.top, 8) + Picker(selection: $selectedAccount, label: Text(""), content: { ForEach(AddAccountSections.icloud.sectionContent, id: \.self, content: { account in HStack(alignment: .top) { @@ -168,20 +172,20 @@ struct AddAccountsView: View { .resizable() .aspectRatio(contentMode: .fit) .frame(width: 25, height: 25, alignment: .center) - .offset(CGSize(width: 0, height: -5)) + .offset(CGSize(width: 0, height: -3.5)) .padding(.leading, 4) - VStack(alignment: .leading, spacing: 4) { - Text(account.localizedAccountName()) - Text(AddAccountSections.icloud.sectionFooter).foregroundColor(.gray) - .font(.caption) - } + Text(account.localizedAccountName()) } .tag(account) }) }) .offset(x: 7.5, y: 0) .disabled(isCloudInUse()) + + Text(AddAccountSections.icloud.sectionFooter).foregroundColor(.gray) + .font(.caption) + .padding(.horizontal) } } @@ -190,6 +194,8 @@ struct AddAccountsView: View { Text("Web") .font(.headline) .padding(.horizontal) + .padding(.top, 8) + Picker(selection: $selectedAccount, label: Text(""), content: { ForEach(AddAccountSections.web.sectionContent.filter({ isRestricted($0) != true }), id: \.self, content: { account in @@ -200,15 +206,17 @@ struct AddAccountsView: View { .frame(width: 25, height: 25, alignment: .center) .padding(.leading, 4) - VStack(alignment: .leading) { - Text(account.localizedAccountName()) - } + Text(account.localizedAccountName()) } .tag(account) }) }) .offset(x: 7.5, y: 0) + + Text(AddAccountSections.web.sectionFooter).foregroundColor(.gray) + .font(.caption) + .padding(.horizontal) } } @@ -218,6 +226,7 @@ struct AddAccountsView: View { .font(.headline) .padding(.horizontal) .padding(.top, 8) + Picker(selection: $selectedAccount, label: Text(""), content: { ForEach(AddAccountSections.selfhosted.sectionContent, id: \.self, content: { account in HStack(alignment: .top) { @@ -227,20 +236,16 @@ struct AddAccountsView: View { .frame(width: 25, height: 25, alignment: .center) .offset(CGSize(width: 0, height: -4)) .padding(.leading, 4) - - - VStack(alignment: .leading, spacing: 4) { - Text(account.localizedAccountName()) - Text("Web and self-hosted accounts sync across all signed-in devices.") - .font(.caption) - .foregroundColor(.gray) - } + + Text(account.localizedAccountName()) }.tag(account) }) }) .offset(x: 7.5, y: 0) - + Text(AddAccountSections.selfhosted.sectionFooter).foregroundColor(.gray) + .font(.caption) + .padding(.horizontal) } } diff --git a/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-any.pdf b/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-any.pdf index 552cab54c068dea7dad3ee824e75174b42cb72d4..79ba7e3eb1efdc43ee2b55b7a4d675fef0592414 100644 GIT binary patch delta 1271 zcmaE_J5zsxUA?)niGrOSS8+*EYGN)|1!L+I>oQey9+%H?tjX*qA5~}mwwQl{JK&K+ z^8B0ikGRWT_Z~Yn>nclthRBb_wb}NwBK+sC^bPxNy0|u9sP?T-y`$0ZD`#>h**=Tg z{nusB>eMG+zj2!_TP@>q#Umv}#*F*qQa`3s$7ZdbyCZ&McXUAgO_d9J3#%T@FS`4&%Jq=+&Rz0I7V+vPcTR8p1GH!yXC5* zpVZdn-%EY9=-AKv+7R1ghA->=ZrAQByMAZd)jP$_ZWCN47tiARG}Xh->7+#TG)29j zbB#Ol_1{z_UOe6=`h2gg`5qm^*0~c;oKes!=$p%!5iYN(P~A55PE@I?{)DHy)%cCC ztE%_S;n`up|2eCS$Nrzj;ww4(6nGeT9+}2f8C-D{Ue^82qO7I2)rfh1VkiHDdR~u` zg3hh`d6n3^r)?vYB(in_Cz0Db>(7~#Rn&xa@6sAvd$ohF>6IYGy{o1yO zz0B#h^QG(GZ#}=Sxwk^#XtzXQq><5_%g^7g-~Zv_)YnQTDF%fSCO3h1wrgk7}av#%kPD2GF1tT*BBjd^S%whEw zDEYznv?1Ri10J`BbA$JACnQ;y9y-HmRoKwA%7b;~lYc@foj2_4|Ju#4^hn8Z;-1f5 zeouvSUQFKEh^YNtZP6vJE5zTgGOgshbtuwxecZCiGhNvAb&hQPXL0M_^&`de-#!+V z&P-1I$MoQ~LNwH2n}b>2@-rEkPIeMGt8HvxU|?clXcA>$pbkWu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