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...") {
buildSubscriptionsImportAccounts()
}.sheet(isPresented: $isOPMLImportDocPickerPresented) {
SettingsSubscriptionsImportDocumentPickerView(account: self.opmlAccount!)
}.modifier(VibrantSelectAction(action: {
if AccountManager.shared.activeAccounts.count == 1 { if AccountManager.shared.activeAccounts.count == 1 {
self.opmlAccount = AccountManager.shared.activeAccounts.first self.opmlAccount = AccountManager.shared.activeAccounts.first
self.isOPMLImportDocPickerPresented = true self.isOPMLImportDocPickerPresented = true
} else { } else {
self.isOPMLImportPresented = true self.isOPMLImportPresented = true
} }
})) }
}.actionSheet(isPresented: $isOPMLImportPresented) {
buildSubscriptionsImportAccounts()
}.sheet(isPresented: $isOPMLImportDocPickerPresented) {
SettingsSubscriptionsImportDocumentPickerView(account: self.opmlAccount!)
}.foregroundColor(.primary)
Text("Export Subscriptions...") VStack {
.actionSheet(isPresented: $isOPMLExportPresented) { Button("Export Subscriptions...") {
buildSubscriptionsExportAccounts()
}.sheet(isPresented: $isOPMLExportDocPickerPresented) {
SettingsSubscriptionsExportDocumentPickerView(account: self.opmlAccount!)
}.modifier(VibrantSelectAction(action: {
if AccountManager.shared.accounts.count == 1 { if AccountManager.shared.accounts.count == 1 {
self.opmlAccount = AccountManager.shared.accounts.first self.opmlAccount = AccountManager.shared.accounts.first
self.isOPMLImportDocPickerPresented = true self.isOPMLImportDocPickerPresented = true
} else { } else {
self.isOPMLExportPresented = true self.isOPMLExportPresented = true
} }
})) }
}.actionSheet(isPresented: $isOPMLExportPresented) {
buildSubscriptionsExportAccounts()
}.sheet(isPresented: $isOPMLExportDocPickerPresented) {
SettingsSubscriptionsExportDocumentPickerView(account: self.opmlAccount!)
}.foregroundColor(.primary)
} }
} }