Merge pull request #3913 from vector-im/feature/bma/3910_fix_crash

Feature/bma/3910 fix crash
This commit is contained in:
Benoit Marty 2021-08-27 17:09:13 +02:00 committed by GitHub
commit 6dccc3e752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

1
changelog.d/3910.bugfix Normal file
View File

@ -0,0 +1 @@
Fix a crash at start-up if translated string is empty

View File

@ -168,7 +168,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
* intrude. * intrude.
*/ */
notificationManager.createNotificationChannel(NotificationChannel(NOISY_NOTIFICATION_CHANNEL_ID, notificationManager.createNotificationChannel(NotificationChannel(NOISY_NOTIFICATION_CHANNEL_ID,
stringProvider.getString(R.string.notification_noisy_notifications), stringProvider.getString(R.string.notification_noisy_notifications).ifEmpty { "Noisy notifications" },
NotificationManager.IMPORTANCE_DEFAULT) NotificationManager.IMPORTANCE_DEFAULT)
.apply { .apply {
description = stringProvider.getString(R.string.notification_noisy_notifications) description = stringProvider.getString(R.string.notification_noisy_notifications)
@ -181,7 +181,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
* Low notification importance: shows everywhere, but is not intrusive. * Low notification importance: shows everywhere, but is not intrusive.
*/ */
notificationManager.createNotificationChannel(NotificationChannel(SILENT_NOTIFICATION_CHANNEL_ID, notificationManager.createNotificationChannel(NotificationChannel(SILENT_NOTIFICATION_CHANNEL_ID,
stringProvider.getString(R.string.notification_silent_notifications), stringProvider.getString(R.string.notification_silent_notifications).ifEmpty { "Silent notifications" },
NotificationManager.IMPORTANCE_LOW) NotificationManager.IMPORTANCE_LOW)
.apply { .apply {
description = stringProvider.getString(R.string.notification_silent_notifications) description = stringProvider.getString(R.string.notification_silent_notifications)
@ -191,7 +191,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
}) })
notificationManager.createNotificationChannel(NotificationChannel(LISTENING_FOR_EVENTS_NOTIFICATION_CHANNEL_ID, notificationManager.createNotificationChannel(NotificationChannel(LISTENING_FOR_EVENTS_NOTIFICATION_CHANNEL_ID,
stringProvider.getString(R.string.notification_listening_for_events), stringProvider.getString(R.string.notification_listening_for_events).ifEmpty { "Listening for events" },
NotificationManager.IMPORTANCE_MIN) NotificationManager.IMPORTANCE_MIN)
.apply { .apply {
description = stringProvider.getString(R.string.notification_listening_for_events) description = stringProvider.getString(R.string.notification_listening_for_events)
@ -200,7 +200,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
}) })
notificationManager.createNotificationChannel(NotificationChannel(CALL_NOTIFICATION_CHANNEL_ID, notificationManager.createNotificationChannel(NotificationChannel(CALL_NOTIFICATION_CHANNEL_ID,
stringProvider.getString(R.string.call), stringProvider.getString(R.string.call).ifEmpty { "Call" },
NotificationManager.IMPORTANCE_HIGH) NotificationManager.IMPORTANCE_HIGH)
.apply { .apply {
description = stringProvider.getString(R.string.call) description = stringProvider.getString(R.string.call)