2020-08-04 20:26:09 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct IdentitiesView: View {
|
|
|
|
@StateObject var viewModel: IdentitiesViewModel
|
|
|
|
@EnvironmentObject var rootViewModel: RootViewModel
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Form {
|
|
|
|
Section {
|
|
|
|
NavigationLink(
|
|
|
|
destination: AddIdentityView(viewModel: rootViewModel.addIdentityViewModel()),
|
|
|
|
label: {
|
|
|
|
Label("add new account", systemImage: "plus")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
Section {
|
|
|
|
List(viewModel.identities) { identity in
|
|
|
|
Button(identity.handle) {
|
2020-08-07 01:41:59 +00:00
|
|
|
withAnimation {
|
|
|
|
rootViewModel.newIdentitySelected(id: identity.id)
|
|
|
|
}
|
2020-08-04 20:26:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct IdentitiesView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
IdentitiesView(viewModel: .development)
|
2020-08-05 11:48:50 +00:00
|
|
|
.environmentObject(RootViewModel.development)
|
2020-08-04 20:26:09 +00:00
|
|
|
}
|
|
|
|
}
|