Skip to content

Commit

Permalink
fix exit logic
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Aug 18, 2021
1 parent 8d8c06d commit 50c71ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Nudge/UI/DeferView.swift
Expand Up @@ -55,7 +55,7 @@ struct DeferView: View {
Utils().logUserQuitDeferrals()
nudgeDefaults.set(nudgeCustomEventDate, forKey: "deferRunUntil")
userHasClickedDeferralQuitButton(deferralTime: nudgeCustomEventDate)
viewObserved.shouldExit.toggle()
viewObserved.shouldExit = true
self.presentationMode.wrappedValue.dismiss()
} label: {
Text("Defer")
Expand Down
2 changes: 1 addition & 1 deletion Nudge/UI/Main.swift
Expand Up @@ -86,7 +86,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
if Utils().requireMajorUpgrade() && fetchMajorUpgradeSuccessful == false && majorUpgradeAppPathExists == false {
let msg = "Unable to fetch major upgrade and application missing, exiting Nudge"
uiLog.notice("\(msg, privacy: .public)")
nudgePrimaryState.shouldExit.toggle()
nudgePrimaryState.shouldExit = true
AppKit.NSApp.terminate(nil)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Nudge/Utilities/Utils.swift
Expand Up @@ -96,7 +96,7 @@ struct Utils {
func exitNudge() {
let msg = "Nudge is terminating due to condition met"
uiLog.notice("\(msg, privacy: .public)")
nudgePrimaryState.shouldExit.toggle()
nudgePrimaryState.shouldExit = true
AppKit.NSApp.terminate(nil)
}

Expand Down Expand Up @@ -427,7 +427,7 @@ struct Utils {
func userInitiatedExit() {
let msg = "User clicked primaryQuitButton"
uiLog.notice("\(msg, privacy: .public)")
nudgePrimaryState.shouldExit.toggle()
nudgePrimaryState.shouldExit = true
AppKit.NSApp.terminate(nil)
}

Expand Down

0 comments on commit 50c71ca

Please sign in to comment.