NetNewsWire/iOS/Settings/SettingsSubscriptionsImportAccountPickerView.swift
2019-10-20 07:47:22 -05:00

35 lines
1.0 KiB
Swift

//
// 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)
}
}