From 296ceba684ba11033817a5e39861dc2cc5faaaef Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:34:19 +0000 Subject: [PATCH] Don't send a profile tag when registering a pusher. (#6442) * Re-organise AppSettings a bit. Some of the preferences were in the wrong sections. * Don't send a profile tag when registering a pusher. --- .../Sources/GeneratedAccessibilityTests.swift | 2 +- .../Application/Settings/AppSettings.swift | 43 +++++++++---------- .../Mocks/Generated/GeneratedMocks.swift | 2 +- .../TestablePreviewsDictionary.swift | 2 +- .../Service/NotificationService.swift | 16 +------ .../Sources/GeneratedPreviewTests.swift | 2 +- .../NotificationServiceTests.swift | 20 +-------- 7 files changed, 26 insertions(+), 61 deletions(-) diff --git a/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift b/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift index 7aca4abe4..9b52c3fe6 100644 --- a/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift +++ b/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift @@ -1,4 +1,4 @@ -// Generated using Sourcery 2.3.0 — https://github.com/krzysztofzablocki/Sourcery +// Generated using Sourcery 2.4.1 — https://github.com/krzysztofzablocki/Sourcery // DO NOT EDIT // swiftlint:disable all diff --git a/ElementX/Sources/Application/Settings/AppSettings.swift b/ElementX/Sources/Application/Settings/AppSettings.swift index f7d1d2394..e883e2161 100644 --- a/ElementX/Sources/Application/Settings/AppSettings.swift +++ b/ElementX/Sources/Application/Settings/AppSettings.swift @@ -106,6 +106,12 @@ final nonisolated class AppSettings: @unchecked Sendable { @UserPreference var lastVersionLaunched: String? + /// Whether a user session has ever been set up on this device. Deliberately not cleared on + /// logout: it stops the Classic app migration prompt from reappearing when an Element X + /// user is signed out unexpectedly (invalidated token, corrupted storage, etc). + @UserPreference(defaultValue: false) + var hasSignedInBefore: Bool + /// Defaults to `true` for new users, and we use a migration to set it to `false` for existing users. @UserPreference(defaultValue: true) var hasSeenNewSoundBanner: Bool @@ -228,11 +234,7 @@ final nonisolated class AppSettings: @unchecked Sendable { } @UserPreference(defaultValue: false) - var hideQuietNotificationAlerts: Bool - - /// Tag describing which set of device specific rules a pusher executes. - @UserPreference - var pusherProfileTag: String? + var hasRunNotificationPermissionsOnboarding: Bool /// The device's last boot time as recorded by the NSE. @UserPreference @@ -281,24 +283,11 @@ final nonisolated class AppSettings: @unchecked Sendable { } /// Whether the user has opted in to send analytics. + /// + /// **Note:** Opt-in is app-wide, not per-session. @UserPreference(defaultValue: AnalyticsConsentState.unknown) var analyticsConsentState: AnalyticsConsentState - /// Whether a user session has ever been set up on this device. Deliberately not cleared on - /// logout: it stops the Classic app migration prompt from reappearing when an Element X - /// user is signed out unexpectedly (invalidated token, corrupted storage, etc). - @UserPreference(defaultValue: false) - var hasSignedInBefore: Bool - - @UserPreference(defaultValue: false) - var hasRunNotificationPermissionsOnboarding: Bool - - @UserPreference(defaultValue: false) - var hasRequestedLocationAlwaysLocationAuthorization: Bool - - @UserPreference(defaultValue: [FrequentlyUsedEmoji]()) - var frequentlyUsedSystemEmojis: [FrequentlyUsedEmoji] - // MARK: - Live Location @UserPreference(defaultValue: 10) @@ -307,6 +296,9 @@ final nonisolated class AppSettings: @unchecked Sendable { @UserPreference(defaultValue: false) var liveLocationDisclaimerDisplayed: Bool + @UserPreference(defaultValue: false) + var hasRequestedLocationAlwaysLocationAuthorization: Bool + // MARK: - Room Screen @UserPreference(defaultValue: AppBuildType.current == .debug) @@ -318,6 +310,9 @@ final nonisolated class AppSettings: @unchecked Sendable { @UserPreference(defaultValue: AudioPlaybackSpeed.default) var voiceMessagePlaybackSpeed: AudioPlaybackSpeed + @UserPreference(defaultValue: [FrequentlyUsedEmoji]()) + var frequentlyUsedSystemEmojis: [FrequentlyUsedEmoji] + /// Whether or not to show a warning on the media caption composer so the user knows /// that captions might not be visible to users who are using other Matrix clients. let shouldShowMediaCaptionWarning = true @@ -352,7 +347,9 @@ final nonisolated class AppSettings: @unchecked Sendable { // MARK: - Feature Flags - /// Others + @UserPreference(defaultValue: AppBuildType.current != .release) + var developerOptionsEnabled: Bool + @UserPreference(defaultValue: false) var fuzzyRoomListSearchEnabled: Bool @@ -395,8 +392,8 @@ final nonisolated class AppSettings: @unchecked Sendable { @UserPreference(key: "clientPausingAndResumingEnabledV2", defaultValue: false, volatile: true) var clientPausingAndResumingEnabled: Bool - @UserPreference(defaultValue: AppBuildType.current != .release) - var developerOptionsEnabled: Bool + @UserPreference(defaultValue: false) + var hideQuietNotificationAlerts: Bool /// Runs calls through the native matrix-rust-rtc stack instead of the Element Call web view. @UserPreference(defaultValue: false) diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 360c8e0dc..068c29a63 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -1,4 +1,4 @@ -// Generated using Sourcery 2.3.0 — https://github.com/krzysztofzablocki/Sourcery +// Generated using Sourcery 2.4.1 — https://github.com/krzysztofzablocki/Sourcery // DO NOT EDIT // swiftlint:disable all diff --git a/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift b/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift index c1a2d035a..882f46b4e 100644 --- a/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift +++ b/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift @@ -1,4 +1,4 @@ -// Generated using Sourcery 2.3.0 — https://github.com/krzysztofzablocki/Sourcery +// Generated using Sourcery 2.4.1 — https://github.com/krzysztofzablocki/Sourcery // DO NOT EDIT // swiftlint:disable all diff --git a/ElementX/Sources/Services/Notification/Service/NotificationService.swift b/ElementX/Sources/Services/Notification/Service/NotificationService.swift index 8d3933b88..7e5805a09 100644 --- a/ElementX/Sources/Services/Notification/Service/NotificationService.swift +++ b/ElementX/Sources/Services/Notification/Service/NotificationService.swift @@ -151,23 +151,9 @@ final class NotificationService: NotificationServiceProtocol { defaultPayload: defaultPayload.toJsonString())), appDisplayName: "\(InfoPlistReader.main.bundleDisplayName) (iOS)", deviceDisplayName: UIDevice.current.name, - profileTag: pusherProfileTag(), + profileTag: nil, lang: Bundle.app.preferredLocalizations.first ?? "en", // Otherwise accounts on the same homeserver delete each other's pusher. append: userSettings.app.multiAccountEnabled) } - - private func pusherProfileTag() -> String { - if let currentTag = userSettings.app.pusherProfileTag { - return currentTag - } - let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" - let newTag = (0..<16).map { _ in - let offset = Int.random(in: 0..