From 80f747985f488cbbeab239823f42c37ef414d082 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 24 Jun 2026 06:24:20 -0500 Subject: [PATCH] Remove custom tones menu on macOS (#5776) * Remove custom tones menu on macos * Moved property to allotted location --- .../NotificationSettingsScreenModels.swift | 2 ++ .../NotificationSettingsScreenViewModel.swift | 4 +++- .../View/NotificationSettingsScreen.swift | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift index 5811543c3..272424092 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenModels.swift @@ -31,6 +31,8 @@ struct NotificationSettingsScreenViewState: BindableState { var applyingChange = false var selectedAlertTone: NotificationTone var availableCustomTones: [NotificationTone] + + let customToneSelectionEnabled: Bool } struct NotificationSettingsScreenViewStateBindings { diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift index cd54de643..cff2956a6 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift @@ -43,7 +43,9 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy super.init(initialViewState: NotificationSettingsScreenViewState(bindings: bindings, isModallyPresented: isModallyPresented, selectedAlertTone: appSettings.selectedNotificationTone ?? NotificationToneManager.defaultElementXMessageTone, - availableCustomTones: notificationToneManager.customTones())) + availableCustomTones: notificationToneManager.customTones(), + // macos lacks default sounds and its sandbox Sounds directory is immutable + customToneSelectionEnabled: !ProcessInfo.processInfo.isiOSAppOnMac)) // Listen for changes to AppSettings. appSettings.$enableNotifications diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift index 11df431f6..cd0babb61 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/View/NotificationSettingsScreen.swift @@ -39,7 +39,9 @@ struct NotificationSettingsScreen: View { additionalSettingsSection } - soundSelectionSection + if context.viewState.customToneSelectionEnabled { + soundSelectionSection + } } } }