From 33a3813e876a67178389e90e25fc6ed86cfd8fea Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 27 Aug 2021 16:05:16 +0200 Subject: [PATCH 1/2] Fix a crash at start-up if translated string is empty --- changelog.d/3910.bugfix | 1 + .../app/features/notifications/NotificationUtils.kt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelog.d/3910.bugfix diff --git a/changelog.d/3910.bugfix b/changelog.d/3910.bugfix new file mode 100644 index 0000000000..3bca598e45 --- /dev/null +++ b/changelog.d/3910.bugfix @@ -0,0 +1 @@ +Fix a crash at start-up if translated string is empty \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index 5a9b12bf53..665cddd031 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -168,7 +168,7 @@ class NotificationUtils @Inject constructor(private val context: Context, * intrude. */ 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) .apply { 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. */ 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) .apply { 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, - stringProvider.getString(R.string.notification_listening_for_events), + stringProvider.getString(R.string.notification_listening_for_events).ifEmpty { "Listening for events" }, NotificationManager.IMPORTANCE_MIN) .apply { 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, - stringProvider.getString(R.string.call), + stringProvider.getString(R.string.call).ifEmpty { "Call" }, NotificationManager.IMPORTANCE_HIGH) .apply { description = stringProvider.getString(R.string.call) From 840b9e50af116d1af0fa77b6e6b797b3c32e8015 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 27 Aug 2021 16:07:03 +0200 Subject: [PATCH 2/2] Fix bad name in file, generated changelog will contain mistakes --- changelog.d/{pr-3883.misc => 3883.misc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{pr-3883.misc => 3883.misc} (100%) diff --git a/changelog.d/pr-3883.misc b/changelog.d/3883.misc similarity index 100% rename from changelog.d/pr-3883.misc rename to changelog.d/3883.misc