Skip to content

Commit

Permalink
Fix issue causing "start timer" to do nothing if settings dialog has …
Browse files Browse the repository at this point in the history
…never been shown
  • Loading branch information
kristopherjohnson committed Nov 10, 2019
1 parent 9823d61 commit c68e08f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
18 changes: 9 additions & 9 deletions MenubarCountdown/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -420,19 +420,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
func dismissStartTimerDialogAndStartTimer(_ sender: AnyObject) {
if let startTimerDialogController = startTimerDialogController {
startTimerDialogController.dismissDialog(sender)
}

timerSettingSeconds = Int(startTimerDialogController.timerInterval)
secondsRemaining = timerSettingSeconds
timerSettingSeconds = (startHours * 3600) + (startMinutes * 60) + startSeconds
secondsRemaining = timerSettingSeconds

isTimerRunning = true
canPause = true
canResume = false
stopwatch.reset()
isTimerRunning = true
canPause = true
canResume = false
stopwatch.reset()

updateStatusItemTitle(timeRemaining: timerSettingSeconds)
updateStatusItemTitle(timeRemaining: timerSettingSeconds)

waitForNextSecond()
}
waitForNextSecond()
}

/**
Expand Down
11 changes: 0 additions & 11 deletions MenubarCountdown/StartTimerDialogController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ class StartTimerDialogController: NSWindowController {
topLevelObjects: nil)
}

/**
The total number of seconds represented by the hours:minutes:seconds settings.
*/
var timerInterval: TimeInterval {
let defaults = UserDefaults.standard
let hours = defaults.integer(forKey: AppUserDefaults.timerHoursKey);
let minutes = defaults.integer(forKey: AppUserDefaults.timerMinutesKey);
let seconds = defaults.integer(forKey: AppUserDefaults.timerSecondsKey);
return TimeInterval((hours * 3600) + (minutes * 60) + seconds);
}

/**
Display the dialog and bring it to the front.
*/
Expand Down

0 comments on commit c68e08f

Please sign in to comment.