Fix adding one minute to a complete alarm

This commit is contained in:
Brandon Presley 2022-11-05 17:22:51 +13:00
parent 24e7ee58d9
commit 97442bc292
1 changed files with 14 additions and 1 deletions

View File

@ -72,6 +72,14 @@ class AlarmModule constructor(context: ReactApplicationContext?) :
countdownTimer = getTimer(newMs, vibrate, sound, noSound)
countdownTimer?.start()
running = true
val manager = getManager()
manager.cancel(NOTIFICATION_ID_DONE)
reactApplicationContext.stopService(
Intent(
reactApplicationContext,
AlarmService::class.java
)
)
}
@RequiresApi(api = Build.VERSION_CODES.O)
@ -146,7 +154,12 @@ class AlarmModule constructor(context: ReactApplicationContext?) :
}
@RequiresApi(Build.VERSION_CODES.M)
private fun getTimer(endMs: Int, vibrate: Boolean, sound: String?, noSound: Boolean): CountDownTimer {
private fun getTimer(
endMs: Int,
vibrate: Boolean,
sound: String?,
noSound: Boolean
): CountDownTimer {
val builder = getBuilder()
return object : CountDownTimer(endMs.toLong(), 1000) {
@RequiresApi(Build.VERSION_CODES.O)