Skip to content

Commit

Permalink
🩹 Fix change app icon timing
Browse files Browse the repository at this point in the history
  • Loading branch information
yyokii committed May 8, 2022
1 parent d812bd8 commit b57606b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/PomodoroTimerFeature/PomodoroTimerCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,21 @@ public let pomodoroTimerReducer = PomodoroTimerReducer { state, action, environm
.fireAndForget()
case .startTimer:
state.isTimerActive = true

if state.pomodoroMode.startDate == nil {
state.pomodoroMode.startDate = Date()
}
return state.isTimerActive
? Effect.timer(

NotificationCenter.default.post(name: .pomodoroModeChanged,
object: nil,
userInfo: [Notification.Name.UserInfoKey.pomodoroMode : state.pomodoroMode.mode])
return Effect.timer(
id: TimerId(),
every: 1,
tolerance: .zero,
on: environment.mainQueue
)
.map { _ in .timerTick }
: Effect.cancel(id: TimerId())
case .stopTimer:
state.isTimerActive = false
return Effect.cancel(id: TimerId())
Expand Down

0 comments on commit b57606b

Please sign in to comment.