Use anonymous account after adding first instance

This commit is contained in:
Arkadiusz Fal 2022-11-11 19:23:58 +01:00
parent 80d8d66986
commit 5d033cbdfc

View File

@ -16,6 +16,8 @@ struct InstanceForm: View {
@Environment(\.colorScheme) private var colorScheme
@Environment(\.presentationMode) private var presentationMode
@EnvironmentObject<AccountsModel> private var accounts
var body: some View {
VStack(alignment: .leading) {
Group {
@ -138,7 +140,12 @@ struct InstanceForm: View {
return
}
savedInstanceID = InstancesModel.add(app: app, name: name, url: url).id
let savedInstance = InstancesModel.add(app: app, name: name, url: url)
savedInstanceID = savedInstance.id
if accounts.isEmpty {
accounts.setCurrent(savedInstance.anonymousAccount)
}
presentationMode.wrappedValue.dismiss()
}