Bypass account selection on import and export of OPML if only one account is available

This commit is contained in:
Maurice Parker 2019-09-15 13:35:36 -05:00
parent e2816cba7a
commit 38200edb67
1 changed files with 12 additions and 2 deletions

View File

@ -76,8 +76,13 @@ struct SettingsView : View {
VStack { VStack {
Button("Import Subscriptions...") { Button("Import Subscriptions...") {
if AccountManager.shared.activeAccounts.count == 1 {
self.opmlAccount = AccountManager.shared.activeAccounts.first
self.isOPMLImportDocPickerPresented = true
} else {
self.isOPMLImportPresented = true self.isOPMLImportPresented = true
} }
}
}.actionSheet(isPresented: $isOPMLImportPresented) { }.actionSheet(isPresented: $isOPMLImportPresented) {
buildSubscriptionsImportAccounts() buildSubscriptionsImportAccounts()
}.sheet(isPresented: $isOPMLImportDocPickerPresented) { }.sheet(isPresented: $isOPMLImportDocPickerPresented) {
@ -86,8 +91,13 @@ struct SettingsView : View {
VStack { VStack {
Button("Export Subscriptions...") { Button("Export Subscriptions...") {
if AccountManager.shared.accounts.count == 1 {
self.opmlAccount = AccountManager.shared.accounts.first
self.isOPMLImportDocPickerPresented = true
} else {
self.isOPMLExportPresented = true self.isOPMLExportPresented = true
} }
}
}.actionSheet(isPresented: $isOPMLExportPresented) { }.actionSheet(isPresented: $isOPMLExportPresented) {
buildSubscriptionsExportAccounts() buildSubscriptionsExportAccounts()
}.sheet(isPresented: $isOPMLExportDocPickerPresented) { }.sheet(isPresented: $isOPMLExportDocPickerPresented) {