Open the settings screen on publish if not logged in [iOS only for now]

This commit is contained in:
Angelo Stavrow 2020-09-29 15:35:32 -04:00
parent e736ebbb8c
commit e735e7a3d1
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 12 additions and 8 deletions

View File

@ -125,14 +125,16 @@ struct PostEditorView: View {
}
ToolbarItemGroup(placement: .navigationBarTrailing) {
Button(action: {
publishPost()
if model.account.isLoggedIn {
publishPost()
} else {
self.model.isPresentingSettingsView = true
}
}, label: {
Image(systemName: "paperplane")
})
.disabled(
post.status == PostStatus.published.rawValue ||
!model.account.isLoggedIn ||
!model.hasNetworkConnection
post.status == PostStatus.published.rawValue || !model.hasNetworkConnection || post.body.count == 0
)
Button(action: {
sharePost()

View File

@ -112,14 +112,16 @@ struct PostEditorView: View {
}
ToolbarItem(placement: .primaryAction) {
Button(action: {
publishPost()
if model.account.isLoggedIn {
publishPost()
} else {
// TODO: Open the Preferences window.
}
}, label: {
Image(systemName: "paperplane")
})
.disabled(
post.status == PostStatus.published.rawValue ||
!model.account.isLoggedIn ||
!model.hasNetworkConnection
post.status == PostStatus.published.rawValue || !model.hasNetworkConnection || post.body.count == 0
)
}
}