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 552cab54c..79ba7e3eb 100644 Binary files a/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-any.pdf and b/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-any.pdf differ diff --git a/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-dark.pdf b/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-dark.pdf index 2a7da4068..e876337ac 100644 Binary files a/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-dark.pdf and b/Mac/Resources/Assets.xcassets/accountCloudKit.imageset/icloud-dark.pdf differ