mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 19:26:17 +00:00
Fix notification profile manually enabled and scheduled bug.
This commit is contained in:
committed by
Greyson Parrelli
parent
3781e1dd60
commit
0dd2397fb4
@@ -24,22 +24,22 @@ object NotificationProfiles {
|
||||
val storeValues: NotificationProfileValues = SignalStore.notificationProfileValues()
|
||||
val localNow: LocalDateTime = now.toLocalDateTime(zoneId)
|
||||
|
||||
val manualProfile: NotificationProfile? = profiles.firstOrNull { it.id == storeValues.manuallyEnabledProfile }
|
||||
val manualProfile: NotificationProfile? = if (now < storeValues.manuallyEnabledUntil) {
|
||||
profiles.firstOrNull { it.id == storeValues.manuallyEnabledProfile }
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val scheduledProfile: NotificationProfile? = profiles.sortedDescending().filter { it.schedule.isCurrentlyActive(now, zoneId) }.firstOrNull { profile ->
|
||||
profile.schedule.startDateTime(localNow).toMillis(zoneId.toOffset()) > storeValues.manuallyDisabledAt
|
||||
}
|
||||
|
||||
if (manualProfile == null || scheduledProfile == null) {
|
||||
return (if (now < storeValues.manuallyEnabledUntil) manualProfile else null) ?: scheduledProfile
|
||||
return manualProfile ?: scheduledProfile
|
||||
}
|
||||
|
||||
return if (manualProfile == scheduledProfile) {
|
||||
if (storeValues.manuallyEnabledUntil == Long.MAX_VALUE || now < storeValues.manuallyEnabledUntil) {
|
||||
manualProfile
|
||||
} else {
|
||||
null
|
||||
}
|
||||
manualProfile
|
||||
} else {
|
||||
scheduledProfile
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user