Roll back vibrant cell selection hacks

This commit is contained in:
Maurice Parker 2019-09-16 08:05:33 -05:00
parent 5d8d0d19df
commit 00310b7bd7

View File

@ -44,19 +44,13 @@ struct SettingsView : View {
func buildAccountsSection() -> some View { func buildAccountsSection() -> some View {
Section(header: Text("ACCOUNTS").padding(.top, 22.0)) { Section(header: Text("ACCOUNTS").padding(.top, 22.0)) {
ForEach(viewModel.accounts) { account in ForEach(viewModel.accounts) { account in
NavigationLink(destination: SettingsDetailAccountView(viewModel: SettingsDetailAccountView.ViewModel(account)), tag: self.viewModel.accounts.firstIndex(of: account) ?? -1, selection: self.$accountAction) { NavigationLink(destination: SettingsDetailAccountView(viewModel: SettingsDetailAccountView.ViewModel(account))) {
Text(verbatim: account.nameForDisplay) Text(verbatim: account.nameForDisplay)
} }
.modifier(VibrantSelectAction(action: {
self.accountAction = self.viewModel.accounts.firstIndex(of: account)
}))
} }
NavigationLink(destination: SettingsAddAccountView(), tag: 1000, selection: $accountAction) { NavigationLink(destination: SettingsAddAccountView()) {
Text("Add Account") Text("Add Account")
} }
.modifier(VibrantSelectAction(action: {
self.accountAction = 1000
}))
} }
} }
@ -83,33 +77,35 @@ struct SettingsView : View {
} }
} }
Text("Import Subscriptions...") VStack {
.actionSheet(isPresented: $isOPMLImportPresented) { Button("Import Subscriptions...") {
if AccountManager.shared.activeAccounts.count == 1 {
self.opmlAccount = AccountManager.shared.activeAccounts.first
self.isOPMLImportDocPickerPresented = true
} else {
self.isOPMLImportPresented = true
}
}
}.actionSheet(isPresented: $isOPMLImportPresented) {
buildSubscriptionsImportAccounts() buildSubscriptionsImportAccounts()
}.sheet(isPresented: $isOPMLImportDocPickerPresented) { }.sheet(isPresented: $isOPMLImportDocPickerPresented) {
SettingsSubscriptionsImportDocumentPickerView(account: self.opmlAccount!) SettingsSubscriptionsImportDocumentPickerView(account: self.opmlAccount!)
}.modifier(VibrantSelectAction(action: { }.foregroundColor(.primary)
if AccountManager.shared.activeAccounts.count == 1 {
self.opmlAccount = AccountManager.shared.activeAccounts.first VStack {
self.isOPMLImportDocPickerPresented = true Button("Export Subscriptions...") {
} else { if AccountManager.shared.accounts.count == 1 {
self.isOPMLImportPresented = true self.opmlAccount = AccountManager.shared.accounts.first
} self.isOPMLImportDocPickerPresented = true
})) } else {
self.isOPMLExportPresented = true
Text("Export Subscriptions...") }
.actionSheet(isPresented: $isOPMLExportPresented) { }
buildSubscriptionsExportAccounts() }.actionSheet(isPresented: $isOPMLExportPresented) {
}.sheet(isPresented: $isOPMLExportDocPickerPresented) { buildSubscriptionsExportAccounts()
SettingsSubscriptionsExportDocumentPickerView(account: self.opmlAccount!) }.sheet(isPresented: $isOPMLExportDocPickerPresented) {
}.modifier(VibrantSelectAction(action: { SettingsSubscriptionsExportDocumentPickerView(account: self.opmlAccount!)
if AccountManager.shared.accounts.count == 1 { }.foregroundColor(.primary)
self.opmlAccount = AccountManager.shared.accounts.first
self.isOPMLImportDocPickerPresented = true
} else {
self.isOPMLExportPresented = true
}
}))
} }
} }