Make timer staring synchronized

This commit is contained in:
Ensar Sarajčić 2023-10-05 14:40:34 +02:00
parent c825bf16a2
commit a810c0d3ef

View File

@ -26,7 +26,7 @@ object SleepTimer {
}
context(Context)
fun startTimer() {
fun startTimer() = synchronized(this@SleepTimer) {
val millisInFuture = config.sleepInTS - System.currentTimeMillis() + 1000L
sleepTimer?.cancel()
sleepTimer = object : CountDownTimer(millisInFuture, 1000) {