Clear last draft when holding Shift key on Mac app launch

This commit is contained in:
Angelo Stavrow 2021-01-26 09:27:43 -05:00
parent 900ef269ba
commit 9bc4532193
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -9,11 +9,12 @@ struct CheckForDebugModifier {
static func main() {
#if os(macOS)
if NSEvent.modifierFlags.contains(.shift) {
print("Debug launch detected")
// Run debug-mode launch code here
// Clear the launch-to-last-draft values to load a new draft.
UserDefaults.standard.setValue(false, forKey: "showAllPostsFlag")
UserDefaults.standard.setValue(nil, forKey: "selectedCollectionURL")
UserDefaults.standard.setValue(nil, forKey: "lastDraftURL")
} else {
print("Normal launch detected")
// Don't do anything
// No-op
}
#endif
WriteFreely_MultiPlatformApp.main()