1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-11 17:38:38 +00:00

Merge branch 'master' into hotfix/fixing-pomodoro-widget

This commit is contained in:
maandagdev 2020-01-24 01:27:58 +01:00 committed by GitHub
commit a362f4b4b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ class PomodoroBarItem: CustomButtonTouchBarItem, Widget {
//Vars are used for pausing the timer. //Vars are used for pausing the timer.
private var started = false private var started = false
private var timerPaused: Bool = false; private var timerPaused: Bool = false
private let defaultTitle = "" private let defaultTitle = ""
private let workTime: TimeInterval private let workTime: TimeInterval
@ -67,23 +67,22 @@ class PomodoroBarItem: CustomButtonTouchBarItem, Widget {
} }
@objc func startStopWork() { @objc func startStopWork() {
if !started { if !started {
started = true; started = true
typeTime = .work typeTime = .work
startStopTimer() startStopTimer()
} else { } else {
if timerPaused { if timerPaused {
timerPaused = false; timerPaused = false
resumeTimer(); resumeTimer()
} else { } else {
timerPaused = true; timerPaused = true
pauseTimer(); pauseTimer()
} }
} }
} }
@objc func startStopRest() { @objc func startStopRest() {
started = false; started = false
typeTime = .rest typeTime = .rest
startStopTimer() startStopTimer()
} }
@ -94,12 +93,12 @@ class PomodoroBarItem: CustomButtonTouchBarItem, Widget {
func resumeTimer() { func resumeTimer() {
guard let timervalue = timer else { return } guard let timervalue = timer else { return }
timervalue.resume(); timervalue.resume()
} }
func pauseTimer() { func pauseTimer() {
guard let timervalue = timer else { return } guard let timervalue = timer else { return }
timervalue.suspend(); timervalue.suspend()
} }
private func start() { private func start() {