Merge pull request #5812 from k9mail/fix_vibrate_on_notification

Only set vibration pattern if vibration is enabled
This commit is contained in:
cketti 2021-12-07 20:23:40 +01:00 committed by GitHub
commit f042e2babd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -46,7 +46,8 @@ internal class BaseNotificationDataCreator {
private fun createNotificationAppearance(account: Account): NotificationAppearance {
return with(account.notificationSetting) {
NotificationAppearance(ringtone = ringtone, vibrationPattern = vibration, ledColor = ledColor)
val vibrationPattern = if (isVibrateEnabled) vibration else null
NotificationAppearance(ringtone, vibrationPattern, ledColor)
}
}
}

View file

@ -148,6 +148,7 @@ class BaseNotificationDataCreatorTest {
@Test
fun `vibration pattern`() {
account.notificationSetting.isVibrateEnabled = true
account.notificationSetting.vibratePattern = 3
account.notificationSetting.vibrateTimes = 2
val notificationData = createNotificationData()
@ -192,7 +193,6 @@ class BaseNotificationDataCreatorTest {
return Account("00000000-0000-4000-0000-000000000000").apply {
description = "account name"
identities = listOf(Identity())
notificationSetting.vibrateTimes = 1
}
}
}

View file

@ -338,7 +338,6 @@ class NewMailNotificationManagerTest {
return Account(ACCOUNT_UUID).apply {
description = ACCOUNT_NAME
chipColor = ACCOUNT_COLOR
notificationSetting.vibrateTimes = 1
}
}