From b57606b9e6af7c16d7e0922bc7dd0d2c4f409c8b Mon Sep 17 00:00:00 2001 From: yyokii Date: Sun, 8 May 2022 16:25:07 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20change=20app=20icon=20timi?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/PomodoroTimerFeature/PomodoroTimerCore.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/PomodoroTimerFeature/PomodoroTimerCore.swift b/Sources/PomodoroTimerFeature/PomodoroTimerCore.swift index 7923ee2..1f488cc 100644 --- a/Sources/PomodoroTimerFeature/PomodoroTimerCore.swift +++ b/Sources/PomodoroTimerFeature/PomodoroTimerCore.swift @@ -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())