mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Open app prefs window if not logged in on publish
This commit is contained in:
parent
f52fae335b
commit
851a0b6465
@ -42,7 +42,7 @@ struct ActivePostToolbarView: View {
|
|||||||
publishPost(activePost)
|
publishPost(activePost)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// present login screen
|
openSettingsWindow()
|
||||||
}
|
}
|
||||||
}, label: {
|
}, label: {
|
||||||
Text("\(model.account.server == "https://write.as" ? "Anonymous" : "Drafts")")
|
Text("\(model.account.server == "https://write.as" ? "Anonymous" : "Drafts")")
|
||||||
@ -55,7 +55,7 @@ struct ActivePostToolbarView: View {
|
|||||||
publishPost(activePost)
|
publishPost(activePost)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// present login screen
|
openSettingsWindow()
|
||||||
}
|
}
|
||||||
}, label: {
|
}, label: {
|
||||||
Text("\(collection.title)")
|
Text("\(collection.title)")
|
||||||
@ -95,4 +95,9 @@ struct ActivePostToolbarView: View {
|
|||||||
model.publish(post: post)
|
model.publish(post: post)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func openSettingsWindow() {
|
||||||
|
guard let menuItem = NSApplication.shared.mainMenu?.item(at: 0)?.submenu?.item(at: 2) else { return }
|
||||||
|
NSApplication.shared.sendAction(menuItem.action!, to: menuItem.target, from: nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user