Show the next alarm 24 hours ahead, not 8
Some checks failed
Trigger F-Droid repository rebuild / trigger (release) Has been cancelled
Some checks failed
Trigger F-Droid repository rebuild / trigger (release) Has been cancelled
An alarm set for the next morning left the dynamic zone before it was visible: at 22:00 an alarm at 06:00 is eight hours away, so the part only appeared while the phone was unlikely to be looked at. The window is now 24 hours, and the setting summary says so (also in Danish; the other translations still say 8 and will follow upstream). Verified on the Titan 2 that Chrono (com.vicolo.chrono) registers its alarms the way this part reads them: dumpsys alarm lists them as "Alarm clock" entries with a showIntent pointing at Chrono, and AlarmManager.nextAlarmClock returns the earliest one, so ACTION_NEXT_ALARM_CLOCK_CHANGED keeps the part up to date. Tapping it opens Chrono as well - SHOW_ALARMS, SET_ALARM and SHOW_TIMERS all resolve to com.vicolo.chrono/.MainActivity.
This commit is contained in:
@@ -25,6 +25,11 @@ import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.channels.trySendBlocking
|
||||
import kotlinx.coroutines.flow.*
|
||||
|
||||
/**
|
||||
* How far ahead the next alarm is shown.
|
||||
*/
|
||||
private const val AlarmWindow = 24 * 60 * 60 * 1000L
|
||||
|
||||
class AlarmPartProvider : PartProvider {
|
||||
|
||||
private val nextAlarmTime = mutableStateOf<Long?>(null)
|
||||
@@ -43,7 +48,7 @@ class AlarmPartProvider : PartProvider {
|
||||
send(0)
|
||||
} else {
|
||||
time.collectLatest {
|
||||
if (alarm > it + 8 * 60 * 60 * 1000) {
|
||||
if (alarm > it + AlarmWindow) {
|
||||
send(0)
|
||||
} else {
|
||||
send(60)
|
||||
|
||||
Reference in New Issue
Block a user