From 76d24b9972d2dc894bad2b4f1b8b5517f7387203 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Tue, 4 Nov 2025 13:45:48 +0100 Subject: [PATCH] FF to enable/disable focussing the event on notification tap --- ElementX/Sources/Application/AppCoordinator.swift | 5 +++-- ElementX/Sources/Application/Settings/AppSettings.swift | 4 ++++ .../DeveloperOptionsScreenModels.swift | 1 + .../DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 20bc87597..df6af9010 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -347,6 +347,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg return } + let eventID = appSettings.focusEventOnNotificationTap ? content.eventID : nil if content.categoryIdentifier == NotificationConstants.Category.invite { if let userSession { userSession.clientProxy.roomsToAwait.insert(roomID) @@ -355,8 +356,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg } handleAppRoute(.room(roomID: roomID, via: [])) } else if appSettings.threadsEnabled, let threadRootEventID = content.threadRootEventID { - handleAppRoute(.thread(roomID: roomID, threadRootEventID: threadRootEventID, focusEventID: content.eventID)) - } else if let eventID = content.eventID { + handleAppRoute(.thread(roomID: roomID, threadRootEventID: threadRootEventID, focusEventID: eventID)) + } else if let eventID { handleAppRoute(.event(eventID: eventID, roomID: roomID, via: [])) } else { handleAppRoute(.room(roomID: roomID, via: [])) diff --git a/ElementX/Sources/Application/Settings/AppSettings.swift b/ElementX/Sources/Application/Settings/AppSettings.swift index 2a6a24e22..1e18db5b4 100644 --- a/ElementX/Sources/Application/Settings/AppSettings.swift +++ b/ElementX/Sources/Application/Settings/AppSettings.swift @@ -66,6 +66,7 @@ final class AppSettings { case linkPreviewsEnabled case latestEventSorterEnabled case spaceSettingsEnabled + case focusEventOnNotificationTap // Doug's tweaks 🔧 case hideUnreadMessagesBadge @@ -390,6 +391,9 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: false, storageType: .userDefaults(store)) var threadsEnabled + @UserPreference(key: UserDefaultsKeys.focusEventOnNotificationTap, defaultValue: false, storageType: .userDefaults(store)) + var focusEventOnNotificationTap + @UserPreference(key: UserDefaultsKeys.spaceSettingsEnabled, defaultValue: false, storageType: .userDefaults(store)) var spaceSettingsEnabled diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 83e249a8f..f48cae097 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -43,6 +43,7 @@ protocol DeveloperOptionsProtocol: AnyObject { var enableOnlySignedDeviceIsolationMode: Bool { get set } var enableKeyShareOnInvite: Bool { get set } var hideQuietNotificationAlerts: Bool { get set } + var focusEventOnNotificationTap: Bool { get set } var hideUnreadMessagesBadge: Bool { get set } var elementCallBaseURLOverride: URL? { get set } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 08fcc2e48..534c5c1b6 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -121,6 +121,9 @@ struct DeveloperOptionsScreen: View { Text("Hide quiet alerts") Text("The badge count will still be updated") } + Toggle(isOn: $context.focusEventOnNotificationTap) { + Text("Focus event on notification tap") + } } Section {