fix a glitch with no next alarm set

This commit is contained in:
Tibor Kaputa 2023-07-08 14:42:07 +02:00 committed by GitHub
parent e5500526e1
commit cf8f34b942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,7 +207,8 @@ fun Context.deleteNotificationChannel(channelId: String) {
try { try {
val manager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val manager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
manager.deleteNotificationChannel(channelId) manager.deleteNotificationChannel(channelId)
} catch (_: Throwable) {} } catch (_: Throwable) {
}
} }
} }
@ -270,7 +271,7 @@ fun Context.formatTo12HourFormat(showSeconds: Boolean, hours: Int, minutes: Int,
fun Context.getClosestEnabledAlarmString(callback: (result: String) -> Unit) { fun Context.getClosestEnabledAlarmString(callback: (result: String) -> Unit) {
getEnabledAlarms { enabledAlarms -> getEnabledAlarms { enabledAlarms ->
if (enabledAlarms == null) { if (enabledAlarms.isNullOrEmpty()) {
callback("") callback("")
return@getEnabledAlarms return@getEnabledAlarms
} }
@ -279,7 +280,7 @@ fun Context.getClosestEnabledAlarmString(callback: (result: String) -> Unit) {
.mapNotNull { getTimeUntilNextAlarm(it.timeInMinutes, it.days) } .mapNotNull { getTimeUntilNextAlarm(it.timeInMinutes, it.days) }
if (nextAlarmList.isEmpty()) { if (nextAlarmList.isEmpty()) {
callback("") callback("")
} }
var closestAlarmTime = Int.MAX_VALUE var closestAlarmTime = Int.MAX_VALUE