diff --git a/CHANGELOG.md b/CHANGELOG.md index ed7014eae..597f83f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Group changes to describe their impact on the project, as follows: - one to let app auto-answer call with video sending already enabled - one to let edit native contacts Linphone copy in-app instead of opening native addressbook third party app - one to show past meetings (they are now hidden by default) + - one to hide received message content in android notification - Added a vu meter for recording & playback volumes (must be enabled in developer settings) - Added support for HDMI audio devices - Added video preview during in-call conversation diff --git a/app/src/main/java/org/linphone/core/CorePreferences.kt b/app/src/main/java/org/linphone/core/CorePreferences.kt index 4fa3a5e0f..7905b3a0c 100644 --- a/app/src/main/java/org/linphone/core/CorePreferences.kt +++ b/app/src/main/java/org/linphone/core/CorePreferences.kt @@ -221,6 +221,13 @@ class CorePreferences config.setBool("app", "make_downloaded_images_public_in_gallery", value) } + @get:AnyThread @set:WorkerThread + var hideChatMessageContentInNotification: Boolean + get() = config.getBool("ui", "display_notification_content", false) + set(value) { + config.setBool("ui", "display_notification_content", value) + } + // Conference related @get:AnyThread @set:WorkerThread diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt index 6bde59727..1eec6f219 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt @@ -1600,8 +1600,13 @@ class NotificationsManager } val senderPerson = if (message.isOutgoing) null else person // Use null for ourselves + val text = if (corePreferences.hideChatMessageContentInNotification) { + AppUtils.getString(R.string.notification_chat_message_hidden_content) + } else { + message.message + } val tmp = NotificationCompat.MessagingStyle.Message( - message.message, + text, message.time, senderPerson ) diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt index fc8bd0be0..12d139c7f 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt @@ -102,6 +102,8 @@ class SettingsViewModel val markAsReadWhenDismissingNotification = MutableLiveData() + val hideMessageContentInNotification = MutableLiveData() + // Contacts settings val showContactsSettings = MutableLiveData() @@ -347,6 +349,7 @@ class SettingsViewModel markAsReadWhenDismissingNotification.postValue( corePreferences.markConversationAsReadWhenDismissingMessageNotification ) + hideMessageContentInNotification.postValue(corePreferences.hideChatMessageContentInNotification) sortContactsBy.postValue(if (corePreferences.sortContactsByFirstName) 0 else 1) editNativeContactsInLinphone.postValue(corePreferences.editNativeContactsInLinphone) @@ -573,6 +576,15 @@ class SettingsViewModel } } + @UiThread + fun toggleHideMessageContentInNotification() { + val newValue = hideMessageContentInNotification.value == false + coreContext.postOnCoreThread { + corePreferences.hideChatMessageContentInNotification = newValue + hideMessageContentInNotification.postValue(newValue) + } + } + @UiThread fun toggleContactsExpand() { expandContacts.value = expandContacts.value == false diff --git a/app/src/main/res/layout/settings_chat.xml b/app/src/main/res/layout/settings_chat.xml index f02269ef6..3534e5e89 100644 --- a/app/src/main/res/layout/settings_chat.xml +++ b/app/src/main/res/layout/settings_chat.xml @@ -104,6 +104,35 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/auto_export_media_to_native_gallery_switch" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 9ca7d36f2..1beca0ede 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -78,6 +78,7 @@ Ouvrez &appName; pour rafraîchir la connexion Votre correspondant ne vous entend pas ! Cliquez sur cette notification pour corriger le problème + <contenu masqué> Bienvenue @@ -227,6 +228,7 @@ Télécharger automatiquement les fichiers Rendre visible dans la galerie les médias téléchargés Marquer la conversation comme lue lorsqu\'une notification de message est supprimée + Masquer le contenu du message dans la notification Android Contacts Trier les contacts par Editer les contacts natifs dans &appName; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 14da32a7c..54bef35ef 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -120,6 +120,7 @@ Open &appName; to refresh the registration Your correspondent does not hear you! Click on this notification to fix it + <redacted> Welcome @@ -269,6 +270,7 @@ Auto-download files Make downloaded media public Mark conversation as read when dismissing message notification + Do not show message content in Android notification Contacts Sort contacts by Use &appName; contact editor for native contacts