2019-06-11 23:59:16 +02:00
|
|
|
//
|
|
|
|
// SettingsAddAccountView.swift
|
|
|
|
// NetNewsWire-iOS
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 6/11/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
2019-06-13 21:30:56 +02:00
|
|
|
import Account
|
2019-06-11 23:59:16 +02:00
|
|
|
|
|
|
|
struct SettingsAddAccountView : View {
|
2019-09-08 03:50:57 +02:00
|
|
|
|
|
|
|
@State private var selectedAccountType: AccountType = nil
|
|
|
|
|
2019-06-11 23:59:16 +02:00
|
|
|
var body: some View {
|
2019-06-18 23:54:51 +02:00
|
|
|
Form {
|
2019-09-08 03:50:57 +02:00
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
self.selectedAccountType = AccountType.onMyMac
|
|
|
|
}) {
|
2019-06-18 00:48:32 +02:00
|
|
|
SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: Account.defaultLocalAccountName)
|
|
|
|
}
|
2019-09-08 03:50:57 +02:00
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
self.selectedAccountType = AccountType.feedbin
|
|
|
|
}) {
|
2019-06-18 00:48:32 +02:00
|
|
|
SettingsAccountLabelView(accountImage: "accountFeedbin", accountLabel: "Feedbin")
|
|
|
|
}
|
2019-09-08 03:50:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|
2019-09-08 13:43:29 +02:00
|
|
|
.sheet(item: $selectedAccountType) { accountType in
|
|
|
|
if accountType == .onMyMac {
|
2019-09-08 03:50:57 +02:00
|
|
|
SettingsLocalAccountView(name: "")
|
|
|
|
}
|
2019-09-08 13:43:29 +02:00
|
|
|
if accountType == .feedbin {
|
2019-09-08 03:50:57 +02:00
|
|
|
SettingsFeedbinAccountView(viewModel: SettingsFeedbinAccountView.ViewModel())
|
|
|
|
}
|
2019-06-11 23:59:16 +02:00
|
|
|
}
|
2019-09-08 03:50:57 +02:00
|
|
|
|
2019-06-11 23:59:16 +02:00
|
|
|
.navigationBarTitle(Text("Add Account"), displayMode: .inline)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
struct AddAccountView_Previews : PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
SettingsAddAccountView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|