Add showChatMessageContentInNotification to corePreference to control chat message content visibility in iOS notifications

This commit is contained in:
Benoit Martins 2026-03-05 14:35:15 +01:00
parent 6c5bf43062
commit 66f2ac6fdc
7 changed files with 24 additions and 3 deletions

View file

@ -321,6 +321,15 @@ class CorePreferences {
}
}
var showChatMessageContentInNotification: Bool {
get {
config.getBool(section: "ui", key: "display_notification_content", defaultValue: true)
}
set {
config.setBool(section: "ui", key: "display_notification_content", value: newValue)
}
}
var showDialogWhenCallingDeviceUuidDirectly: Bool {
get {
config.getBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", defaultValue: true)

View file

@ -1,7 +1,7 @@
import Foundation
public enum AppGitInfo {
public static let branch = "feature/contacts_and_suggestions_list"
public static let commit = "c3f95fe23"
public static let branch = "master"
public static let commit = "6c5bf4306"
public static let tag = "6.1.0-alpha"
}

View file

@ -539,6 +539,7 @@
"settings_contacts_ldap_empty_server_error_toast" = "Server URL can't be empty";
"settings_contacts_title" = "Contacts";
"settings_conversations_auto_download_title" = "Auto-download files";
"settings_conversations_hide_message_content_in_notif_title" = "Do not show message content in iOS notification";
"settings_conversations_mark_as_read_when_dismissing_notif_title" = "Mark conversation as read when dismissing message notification";
"settings_conversations_title" = "Conversations";
"settings_meetings_default_layout_title" = "Default layout";

View file

@ -535,6 +535,7 @@
"settings_contacts_ldap_empty_server_error_toast" = "L'URL du serveur ne peut être vide";
"settings_contacts_title" = "Contacts";
"settings_conversations_auto_download_title" = "Télécharger automatiquement les fichiers";
"settings_conversations_hide_message_content_in_notif_title" = "Masquer le contenu du message dans la notification iOS";
"settings_conversations_mark_as_read_when_dismissing_notif_title" = "Marquer la conversation comme lue lorsqu'une notification de message est supprimée";
"settings_conversations_title" = "Conversations";
"settings_meetings_default_layout_title" = "Disposition par défaut";

View file

@ -234,6 +234,9 @@ struct SettingsFragment: View {
VStack(spacing: 30) {
Toggle("settings_conversations_auto_download_title", isOn: $settingsViewModel.autoDownload)
.default_text_style_700(styleSize: 15)
Toggle("settings_conversations_hide_message_content_in_notif_title", isOn: $settingsViewModel.hideNotificationContent)
.default_text_style_700(styleSize: 15)
}
.padding(.vertical, 30)
.padding(.horizontal, 20)

View file

@ -37,6 +37,7 @@ class SettingsViewModel: ObservableObject {
// Conversations settings
@Published var autoDownload: Bool = false
@Published var hideNotificationContent: Bool = false
// Contacts settings
@Published var ldapServers: [String] = []
@ -80,6 +81,7 @@ class SettingsViewModel: ObservableObject {
let autoRecordTmp = AppServices.corePreferences.automaticallyStartCallRecording
let autoDownloadTmp = core.maxSizeForAutoDownloadIncomingFiles == 0
let hideNotificationContentTmp = !AppServices.corePreferences.showChatMessageContentInNotification
let defaultLayoutTmp = core.defaultConferenceLayout.rawValue == 0 ? String(localized: "settings_meetings_layout_mosaic_label") : String(localized: "settings_meetings_layout_active_speaker_label")
@ -114,6 +116,7 @@ class SettingsViewModel: ObservableObject {
self.autoRecord = autoRecordTmp
self.autoDownload = autoDownloadTmp
self.hideNotificationContent = hideNotificationContentTmp
self.defaultLayout = defaultLayoutTmp
@ -363,6 +366,10 @@ class SettingsViewModel: ObservableObject {
core.maxSizeForAutoDownloadIncomingFiles = self.autoDownload ? 0 : -1
}
if AppServices.corePreferences.showChatMessageContentInNotification == self.hideNotificationContent {
AppServices.corePreferences.showChatMessageContentInNotification = !self.hideNotificationContent
}
if (core.defaultConferenceLayout.rawValue == 0) != (self.defaultLayout == String(localized: "settings_meetings_layout_mosaic_label")) {
core.defaultConferenceLayout = self.defaultLayout == String(localized: "settings_meetings_layout_mosaic_label") ? .Grid : .ActiveSpeaker
}

View file

@ -289,7 +289,7 @@ class NotificationService: UNNotificationServiceExtension {
var msgData = MsgData(from: fromAddr, body: "", subtitle: "", callId: callId, localAddr: localUri, peerAddr: peerUri)
if let showMsg = lc!.config?.getBool(section: "app", key: "show_msg_in_notif", defaultValue: true), showMsg == true {
if let showMsg = lc!.config?.getBool(section: "ui", key: "display_notification_content", defaultValue: true), showMsg == true {
msgData.subtitle = message.subject ?? from
if reactionContent == nil {
msgData.body = (message.subject != nil ? "\(from): " : "") + content