Propagate login/logout fixes to Mac app target

This commit is contained in:
Angelo Stavrow 2020-10-29 17:19:06 -04:00
parent 518d793d5d
commit 3c81b5cd68
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 33 additions and 0 deletions

View File

@ -55,7 +55,9 @@ struct AccountLoginView: View {
.padding()
} else {
Button(action: {
#if os(iOS)
hideKeyboard()
#endif
model.login(
to: URL(string: server)!,
as: username, password: password

View File

@ -7,6 +7,7 @@ struct AccountLogoutView: View {
@State private var editedPostsWarningString: String = ""
var body: some View {
#if os(iOS)
VStack {
Spacer()
VStack {
@ -30,6 +31,36 @@ struct AccountLogoutView: View {
]
)
})
#else
VStack {
Spacer()
VStack {
Text("Logged in as \(model.account.username)")
Text("on \(model.account.server)")
}
Spacer()
Button(action: logoutHandler, label: {
Text("Log Out")
})
}
.sheet(isPresented: $isPresentingLogoutConfirmation) {
VStack {
Text("Log Out?")
.font(.title)
Text("\(editedPostsWarningString)You won't lose any local posts. Are you sure?")
HStack {
Button(action: model.logout, label: {
Text("Log Out")
})
Button(action: {
self.isPresentingLogoutConfirmation = false
}, label: {
Text("Cancel")
}).keyboardShortcut(.cancelAction)
}
}
}
#endif
}
func logoutHandler() {