aboutsummaryrefslogtreecommitdiff
path: root/src/Update/UpdateTimer.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-19 00:55:50 +0100
committerJoris Guyonvarch2015-03-19 01:00:22 +0100
commitaf9465f928f28344aa59a407adb21e5ac047a0f9 (patch)
tree903327b8b8053933b95e2766b115ee48ecce9ef8 /src/Update/UpdateTimer.elm
parent7ca7887ae82c09270869ed6737f94a99e210665c (diff)
Adding a Ringing state that animate the color, does not ring a sound for the moment
Diffstat (limited to 'src/Update/UpdateTimer.elm')
-rw-r--r--src/Update/UpdateTimer.elm18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
index e4671d9..c147d23 100644
--- a/src/Update/UpdateTimer.elm
+++ b/src/Update/UpdateTimer.elm
@@ -6,6 +6,7 @@ module Update.UpdateTimer
import Time (Time)
import Model.Timer (..)
+import Model.TimerState (..)
import Model.Id (..)
type TimerAction =
@@ -20,19 +21,22 @@ updateTimer action timer =
case action of
Restart ->
{ timer
- | isRunning <- True
- , currentTime <- initTime timer.initialTime
+ | currentTime <- initTime timer.initialTime
+ , state <- Running
}
Pause ->
+ { timer | state <- Idle }
+ ToggleRunning ->
{ timer
- | isRunning <- False
+ | state <-
+ if timer.currentTime > 0 && timer.state == Idle
+ then Running
+ else Idle
}
- ToggleRunning ->
- { timer | isRunning <- timer.currentTime > 0.0 && not timer.isRunning }
Stop ->
{ timer
- | isRunning <- False
- , currentTime <- initTime timer.initialTime
+ | currentTime <- initTime timer.initialTime
+ , state <- Idle
}
SetTime time ->
let augmentedTime = time + 999