mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Propagate login/logout fixes to Mac app target
This commit is contained in:
parent
518d793d5d
commit
3c81b5cd68
@ -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
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user