diff --git a/Mac/Preferences/Accounts/AddAccountsView.swift b/Mac/Preferences/Accounts/AddAccountsView.swift index 1eefa3d4b..1032c7968 100644 --- a/Mac/Preferences/Accounts/AddAccountsView.swift +++ b/Mac/Preferences/Accounts/AddAccountsView.swift @@ -8,6 +8,7 @@ import SwiftUI import Account +import RSCore enum AddAccountSections: Int, CaseIterable { case local = 0 @@ -53,11 +54,11 @@ enum AddAccountSections: Int, CaseIterable { case .icloud: return [.cloudKit] case .web: - #if DEBUG - return [.bazQux, .feedbin, .feedly, .feedWrangler, .inoreader, .newsBlur, .theOldReader] - #else - return [.bazQux, .feedbin, .feedly, .inoreader, .newsBlur, .theOldReader] - #endif + if AppDefaults.shared.isDeveloperBuild { + return [.bazQux, .feedbin, .feedly, .inoreader, .newsBlur, .theOldReader].filter({ $0.isDeveloperRestricted == false }) + } else { + return [.bazQux, .feedbin, .feedly, .inoreader, .newsBlur, .theOldReader] + } case .selfhosted: return [.freshRSS] case .allOrdered: @@ -67,12 +68,17 @@ enum AddAccountSections: Int, CaseIterable { AddAccountSections.selfhosted.sectionContent } } + + + + } struct AddAccountsView: View { weak var parent: NSHostingController? // required because presentationMode.dismiss() doesn't work var addAccountDelegate: AccountsPreferencesAddAccountDelegate? + private let chunkLimit = 4 // use this to control number of accounts in each web account column @State private var selectedAccount: AccountType = .onMyMac init(delegate: AccountsPreferencesAddAccountDelegate?) { @@ -157,7 +163,7 @@ struct AddAccountsView: View { account.image() .resizable() .aspectRatio(contentMode: .fit) - .frame(width: 25, height: 25, alignment: .center) + .frame(width: 20, height: 20, alignment: .center) .padding(.leading, 4) Text(account.localizedAccountName()) } @@ -189,7 +195,7 @@ struct AddAccountsView: View { account.image() .resizable() .aspectRatio(contentMode: .fit) - .frame(width: 25, height: 25, alignment: .center) + .frame(width: 20, height: 20, alignment: .center) .padding(.leading, 4) Text(account.localizedAccountName()) @@ -207,6 +213,7 @@ struct AddAccountsView: View { } } + @ViewBuilder var webAccounts: some View { VStack(alignment: .leading) { Text("Web") @@ -214,22 +221,28 @@ struct AddAccountsView: View { .padding(.horizontal) .padding(.top, 8) - Picker(selection: $selectedAccount, label: Text(""), content: { - ForEach(AddAccountSections.web.sectionContent.filter({ isRestricted($0) != true }), id: \.self, content: { account in - - HStack(alignment: .center) { - account.image() - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 25, height: 25, alignment: .center) - .padding(.leading, 4) - - Text(account.localizedAccountName()) + HStack { + ForEach(0.. Bool { - if AppDefaults.shared.isDeveloperBuild && accountType.isDeveloperRestricted { - return true - } - return false + private func chunkedWebAccounts() -> [[AccountType]] { + AddAccountSections.web.sectionContent.chunked(into: chunkLimit) } + }