Added back hide message content in Android notification setting

This commit is contained in:
Sylvain Berfini 2026-03-05 11:34:59 +01:00
parent a22f4ad88c
commit b16b42ce55
7 changed files with 59 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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
)

View file

@ -102,6 +102,8 @@ class SettingsViewModel
val markAsReadWhenDismissingNotification = MutableLiveData<Boolean>()
val hideMessageContentInNotification = MutableLiveData<Boolean>()
// Contacts settings
val showContactsSettings = MutableLiveData<Boolean>()
@ -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

View file

@ -104,6 +104,35 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/auto_export_media_to_native_gallery_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleHideMessageContentInNotification()}"
android:id="@+id/hide_message_content_in_notification_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/settings_conversations_hide_message_content_in_notif_title"
android:maxLines="2"
android:ellipsize="end"
android:labelFor="@id/hide_message_content_in_notification_switch"
app:layout_constraintTop_toTopOf="@id/hide_message_content_in_notification_switch"
app:layout_constraintBottom_toBottomOf="@id/hide_message_content_in_notification_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/hide_message_content_in_notification_switch"/>
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/hide_message_content_in_notification_switch"
android:onClick="@{() -> viewModel.toggleHideMessageContentInNotification()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:checked="@{viewModel.hideMessageContentInNotification}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/mark_as_read_dismiss_notif_switch" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -78,6 +78,7 @@
<string name="notification_account_registration_error_message">Ouvrez &appName; pour rafraîchir la connexion</string>
<string name="notification_in_call_foreground_service_error_title">Votre correspondant ne vous entend pas !</string>
<string name="notification_in_call_foreground_service_error_message">Cliquez sur cette notification pour corriger le problème</string>
<string name="notification_chat_message_hidden_content">&lt;contenu masqué&gt;</string>
<!-- First screens user see when app is installed and started -->
<string name="welcome_page_title">Bienvenue</string>
@ -227,6 +228,7 @@
<string name="settings_conversations_auto_download_title">Télécharger automatiquement les fichiers</string>
<string name="settings_conversations_auto_export_media_to_native_gallery_title">Rendre visible dans la galerie les médias téléchargés</string>
<string name="settings_conversations_mark_as_read_when_dismissing_notif_title">Marquer la conversation comme lue lorsqu\'une notification de message est supprimée</string>
<string name="settings_conversations_hide_message_content_in_notif_title">Masquer le contenu du message dans la notification Android</string>
<string name="settings_contacts_title">Contacts</string>
<string name="settings_contacts_sort_by_first_name_title">Trier les contacts par</string>
<string name="settings_contacts_edit_native_contacts_in_linphone_title">Editer les contacts natifs dans &appName;</string>

View file

@ -120,6 +120,7 @@
<string name="notification_account_registration_error_message">Open &appName; to refresh the registration</string>
<string name="notification_in_call_foreground_service_error_title">Your correspondent does not hear you!</string>
<string name="notification_in_call_foreground_service_error_message">Click on this notification to fix it</string>
<string name="notification_chat_message_hidden_content">&lt;redacted&gt;</string>
<!-- First screens user see when app is installed and started -->
<string name="welcome_page_title">Welcome</string>
@ -269,6 +270,7 @@
<string name="settings_conversations_auto_download_title">Auto-download files</string>
<string name="settings_conversations_auto_export_media_to_native_gallery_title">Make downloaded media public</string>
<string name="settings_conversations_mark_as_read_when_dismissing_notif_title">Mark conversation as read when dismissing message notification</string>
<string name="settings_conversations_hide_message_content_in_notif_title">Do not show message content in Android notification</string>
<string name="settings_contacts_title">Contacts</string>
<string name="settings_contacts_sort_by_first_name_title">Sort contacts by</string>
<string name="settings_contacts_edit_native_contacts_in_linphone_title">Use &appName; contact editor for native contacts</string>