mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-04-23 14:47:34 +02:00
fix a glitch with no next alarm set
This commit is contained in:
parent
e5500526e1
commit
cf8f34b942
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user