Skip to content

Commit

Permalink
Clear skip state on resume
Browse files Browse the repository at this point in the history
  • Loading branch information
samarsault committed Apr 10, 2020
1 parent 71cf11e commit 440c0c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions LookAway/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
notif.subtitle = message
NSUserNotificationCenter.default.deliver(notif)
}


func resetSkipStates() {
// Remove a skip state if it already exists
for menuItem in statusBarItem.menu!.items {
if menuItem.state == .on {
menuItem.state = .off
break
}
}
}
}

//
Expand Down Expand Up @@ -161,6 +170,7 @@ extension AppDelegate {
pausedFor-=1
if pausedFor == 0 {
isPaused = false
resetSkipStates()
}
} else {
timeUntilBreak -= 1
Expand Down Expand Up @@ -208,13 +218,7 @@ extension AppDelegate {
@objc
func skipTimer(_ sender: NSMenuItem) {
if (isPaused) {
// Remove a skip state if it already exists
for menuItem in statusBarItem.menu!.items {
if menuItem.state == .on {
menuItem.state = .off
break
}
}
resetSkipStates()
}
timer!.invalidate()

Expand Down
2 changes: 1 addition & 1 deletion LookAway/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.01</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
Expand Down

0 comments on commit 440c0c2

Please sign in to comment.