mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-03-04 19:47:44 +01:00
disable today/tomorrow alarms on dismiss
This commit is contained in:
parent
db5e38d5e3
commit
b3abb370e5
@ -244,9 +244,6 @@ fun Context.showAlarmNotification(alarm: Alarm) {
|
||||
|
||||
if (alarm.days > 0) {
|
||||
scheduleNextAlarm(alarm, false)
|
||||
} else {
|
||||
dbHelper.updateAlarmEnabledState(alarm.id, false)
|
||||
updateWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,23 @@ package com.simplemobiletools.clock.receivers
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.simplemobiletools.clock.extensions.dbHelper
|
||||
import com.simplemobiletools.clock.extensions.hideNotification
|
||||
import com.simplemobiletools.clock.extensions.updateWidgets
|
||||
import com.simplemobiletools.clock.helpers.ALARM_ID
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
|
||||
class HideAlarmReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val id = intent.getIntExtra(ALARM_ID, -1)
|
||||
context.hideNotification(id)
|
||||
|
||||
ensureBackgroundThread {
|
||||
val alarm = context.dbHelper.getAlarmWithId(id)
|
||||
if (alarm != null && alarm.days < 0) {
|
||||
context.dbHelper.updateAlarmEnabledState(alarm.id, false)
|
||||
context.updateWidgets()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user