mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-10-05 15:23:29 +01:00
Choose manual profile over scheduled profile if active.
This commit is contained in:
1 parent
21363f085e
commit
8322bf3ecc
2 files changed
+3
-7
No files matched your search
+1
-5
@@ -49,11 +49,7 @@ object NotificationProfiles {
|
||||
return manualProfile ?: scheduledProfile
|
||||
}
|
||||
|
||||
return if (manualProfile == scheduledProfile) {
|
||||
manualProfile
|
||||
} else {
|
||||
scheduledProfile
|
||||
}
|
||||
return manualProfile
|
||||
}
|
||||
|
||||
private fun shouldClearManualOverride(manualProfile: NotificationProfile?, scheduledProfile: NotificationProfile?): Boolean {
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ class NotificationProfilesTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when first is scheduled and second is manually enabled forever before first's schedule start then return first`() {
|
||||
fun `when first is scheduled and second is manually enabled forever before first's schedule start then return second`() {
|
||||
every { notificationProfileValues.manuallyEnabledProfile } returns second.id
|
||||
every { notificationProfileValues.manuallyEnabledUntil } returns Long.MAX_VALUE
|
||||
every { notificationProfileValues.manuallyDisabledAt } returns sunday830am.toMillis(ZoneOffset.UTC)
|
||||
@@ -119,7 +119,7 @@ class NotificationProfilesTest {
|
||||
val schedule = NotificationProfileSchedule(id = 3L, true, start = 900, daysEnabled = setOf(DayOfWeek.SUNDAY))
|
||||
val profiles = listOf(first.copy(schedule = schedule), second)
|
||||
|
||||
assertThat(NotificationProfiles.getActiveProfile(profiles, sunday930am.toMillis(ZoneOffset.UTC), utc), "active profile is first").isEqualTo(profiles[0])
|
||||
assertThat(NotificationProfiles.getActiveProfile(profiles, sunday930am.toMillis(ZoneOffset.UTC), utc), "active profile is second").isEqualTo(profiles[1])
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user