Rewrite OPML import/export to avoid ActionSheet

This commit is contained in:
Maurice Parker
2019-10-20 07:47:22 -05:00
parent c18f5f7537
commit 329d5ccfeb
4 changed files with 90 additions and 58 deletions

View File

@@ -0,0 +1,34 @@
//
// SettingsSubscriptionsImportAccountPickerView.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 10/20/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import SwiftUI
import Account
struct SettingsSubscriptionsImportAccountPickerView: View {
@Environment(\.presentationMode) var presentation
@State private var selectedAccount: Account?
@State private var isOPMLImportDocPickerPresented: Bool = false
var body: some View {
Form {
ForEach(AccountManager.shared.sortedActiveAccounts) { account in
Button(action: {
self.selectedAccount = account
self.isOPMLImportDocPickerPresented = true
}) {
Text(verbatim: account.nameForDisplay)
}.buttonStyle(VibrantButtonStyle(alignment: .leading))
}
}.sheet(isPresented: $isOPMLImportDocPickerPresented, onDismiss: { self.presentation.wrappedValue.dismiss() }) {
SettingsSubscriptionsImportDocumentPickerView(account: self.selectedAccount!)
}
.navigationBarTitle(Text("Select Account"), displayMode: .inline)
}
}