mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Add manufacturer to notification help.
This commit is contained in:
committed by
mtang-signal
parent
7807d92825
commit
21019d1726
@@ -97,4 +97,31 @@ class DeviceSpecificNotificationConfigTest {
|
||||
every { RemoteConfig.deviceSpecificNotificationConfig } returns """[ { "model": "test" } ]"""
|
||||
DeviceSpecificNotificationConfig.computeConfig() assertIs DeviceSpecificNotificationConfig.Config(model = "test", localePercent = "*", version = 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `manufacturer match`() {
|
||||
ReflectionHelpers.setStaticField(Build::class.java, "MODEL", "test-model")
|
||||
ReflectionHelpers.setStaticField(Build::class.java, "MANUFACTURER", "test-manufacturer")
|
||||
every { RemoteConfig.deviceSpecificNotificationConfig } returns
|
||||
"""
|
||||
[
|
||||
{ "manufacturer": "test-manufacturer", "showConditionCode": "always", "localePercent": "*:10000", "version": 1 }
|
||||
]
|
||||
""".trimMargin()
|
||||
DeviceSpecificNotificationConfig.computeConfig() assertIs DeviceSpecificNotificationConfig.Config(manufacturer = "test-manufacturer", showConditionCode = "always", localePercent = "*:10000", version = 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `device model is matched over device manufacturer`() {
|
||||
ReflectionHelpers.setStaticField(Build::class.java, "MODEL", "test-model")
|
||||
ReflectionHelpers.setStaticField(Build::class.java, "MANUFACTURER", "test-manufacturer")
|
||||
every { RemoteConfig.deviceSpecificNotificationConfig } returns
|
||||
"""
|
||||
[
|
||||
{ "manufacturer": "test-manufacturer", "showConditionCode": "always", "localePercent": "*:10000", "version": 1 },
|
||||
{ "model": "test-model", "showConditionCode": "has-battery-optimization-on", "localePercent": "*:20000", "version": 2 }
|
||||
]
|
||||
""".trimMargin()
|
||||
DeviceSpecificNotificationConfig.computeConfig() assertIs DeviceSpecificNotificationConfig.Config(model = "test-model", showConditionCode = "has-battery-optimization-on", localePercent = "*:20000", version = 2)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user