Skip to content

Commit 7e7cf15

Browse files
authored
Use the new notification sound. (#4572)
* Use the new notification sound. * Add a banner informing the user of the new notification sound.
1 parent a226c99 commit 7e7cf15

File tree

18 files changed

+133
-2
lines changed

18 files changed

+133
-2
lines changed

AccessibilityTests/Sources/GeneratedAccessibilityTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ extension AccessibilityTests {
183183
try await performAccessibilityAudit(named: "HomeScreenKnockedCell_Previews")
184184
}
185185

186+
func testHomeScreenNewSoundBanner() async throws {
187+
try await performAccessibilityAudit(named: "HomeScreenNewSoundBanner_Previews")
188+
}
189+
186190
func testHomeScreenRecoveryKeyConfirmationBanner() async throws {
187191
try await performAccessibilityAudit(named: "HomeScreenRecoveryKeyConfirmationBanner_Previews")
188192
}

ElementX.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
1621BF6316FFFEF5AE067C77 /* Avatars.swift in Sources */ = {isa = PBXBuildFile; fileRef = C142248014E08E885E323E56 /* Avatars.swift */; };
138138
1653275750CE11F5CE94DDFD /* ReadReceiptsSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8063E65441E771200108C558 /* ReadReceiptsSummaryView.swift */; };
139139
167D00CAA13FAFB822298021 /* MediaProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A81CCC2516D9CF9322DF01 /* MediaProviderTests.swift */; };
140+
167D5024DB9D44197AEA0507 /* HomeScreenNewSoundBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5480F03306234FC086E93B /* HomeScreenNewSoundBanner.swift */; };
140141
16A1F6C703305FCAF4E14EC6 /* TimelineProxyMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A8AA0DFA06012A9DAB951E /* TimelineProxyMock.swift */; };
141142
16A5D1749A32B91203495EF7 /* FrequentlyUsedEmoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A2074C0449B83D5858BD2D7 /* FrequentlyUsedEmoji.swift */; };
142143
16CBD087038DE3815CDA512C /* PollMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = D38391154120264910D19528 /* PollMock.swift */; };
@@ -2479,6 +2480,7 @@
24792480
BC51BF90469412ABDE658CDD /* portrait_test_image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = portrait_test_image.jpg; sourceTree = "<group>"; };
24802481
BC8AA23D4F37CC26564F63C5 /* LayoutMocks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutMocks.swift; sourceTree = "<group>"; };
24812482
BCDA016D05107DED3B9495CB /* TimelineItemDebugView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineItemDebugView.swift; sourceTree = "<group>"; };
2483+
BD5480F03306234FC086E93B /* HomeScreenNewSoundBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenNewSoundBanner.swift; sourceTree = "<group>"; };
24822484
BE148A4FFEE853C5A281500C /* UNNotificationContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UNNotificationContent.swift; sourceTree = "<group>"; };
24832485
BE89A8BD65CCE3FCC925CA14 /* TimelineItemReplyDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineItemReplyDetails.swift; sourceTree = "<group>"; };
24842486
BE98688578F8B0541D853695 /* test_pdf.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = test_pdf.pdf; sourceTree = "<group>"; };
@@ -4131,6 +4133,7 @@
41314133
C0FEA560929DD73FFEF8C3DF /* HomeScreenEmptyStateView.swift */,
41324134
D8FC33C3F6BF597E095CE9FA /* HomeScreenInviteCell.swift */,
41334135
A103580EBA06155B1343EF16 /* HomeScreenKnockedCell.swift */,
4136+
BD5480F03306234FC086E93B /* HomeScreenNewSoundBanner.swift */,
41344137
05512FB13987D221B7205DE0 /* HomeScreenRecoveryKeyConfirmationBanner.swift */,
41354138
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */,
41364139
C7661EFFCAA307A97D71132A /* HomeScreenRoomList.swift */,
@@ -7775,6 +7778,7 @@
77757778
22C5483D01EEB290B8339817 /* HomeScreenInviteCell.swift in Sources */,
77767779
86DFA58FBBEB0AF671D2A1E1 /* HomeScreenKnockedCell.swift in Sources */,
77777780
8810A2A30A68252EBB54EE05 /* HomeScreenModels.swift in Sources */,
7781+
167D5024DB9D44197AEA0507 /* HomeScreenNewSoundBanner.swift in Sources */,
77787782
B04E9EB589CE99C3929E817A /* HomeScreenRecoveryKeyConfirmationBanner.swift in Sources */,
77797783
0AE0AB1952F186EB86719B4F /* HomeScreenRoomCell.swift in Sources */,
77807784
A10D6CCDE2010C09EEA1A593 /* HomeScreenRoomList.swift in Sources */,

ElementX/Resources/Localizations/en.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@
160160
"banner_migrate_to_native_sliding_sync_description" = "Your server now supports a new, faster protocol. Log out and log back in to upgrade now. Doing this now will help you avoid a forced logout when the old protocol is removed later.";
161161
"banner_migrate_to_native_sliding_sync_force_logout_title" = "Your homeserver no longer supports the old protocol. Please log out and log back in to continue using the app.";
162162
"banner_migrate_to_native_sliding_sync_title" = "Upgrade available";
163+
"banner_new_sound_message" = "Your notification ping has been updated—clearer, quicker, and less disruptive.";
164+
"banner_new_sound_title" = "We’ve refreshed your sounds";
163165
"banner_set_up_recovery_content" = "Recover your cryptographic identity and message history with a recovery key if you have lost all your existing devices.";
164166
"banner_set_up_recovery_title" = "Set up recovery to protect your account";
165167
"call_invalid_audio_device_bluetooth_devices_disabled" = "Element Call does not support using Bluetooth audio devices in this Android version. Please select a different audio device.";
-5.58 KB
Binary file not shown.

ElementX/Sources/Application/AppCoordinator.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
437437
await userSession.clientProxy.expireSyncSessions()
438438
}
439439

440+
if oldVersion < Version(25, 10, 0) {
441+
MXLog.info("Migrating to version 25.10.0, showing new sound banner to existing user.")
442+
appSettings.hasSeenNewSoundBanner = false
443+
}
444+
440445
userSessionMigrationsOldVersion = nil
441446
}
442447

ElementX/Sources/Application/Settings/AppSettings.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ final class AppSettings {
2929
private enum UserDefaultsKeys: String {
3030
case lastVersionLaunched
3131
case seenInvites
32+
case hasSeenNewSoundBanner
3233
case appLockNumberOfPINAttempts
3334
case appLockNumberOfBiometricAttempts
3435
case timelineStyle
@@ -161,6 +162,10 @@ final class AppSettings {
161162
@UserPreference(key: UserDefaultsKeys.seenInvites, defaultValue: [], storageType: .userDefaults(store))
162163
var seenInvites: Set<String>
163164

165+
/// Defaults to `true` for new users, and we use a migration to set it to `false` for existing users.
166+
@UserPreference(key: UserDefaultsKeys.hasSeenNewSoundBanner, defaultValue: true, storageType: .userDefaults(store))
167+
var hasSeenNewSoundBanner
168+
164169
/// The initial set of account providers shown to the user in the authentication flow.
165170
///
166171
/// Account provider is the friendly term for the server name. It should not contain an `https` prefix and should

ElementX/Sources/Generated/Strings.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ internal enum L10n {
360360
internal static var bannerMigrateToNativeSlidingSyncForceLogoutTitle: String { return L10n.tr("Localizable", "banner_migrate_to_native_sliding_sync_force_logout_title") }
361361
/// Upgrade available
362362
internal static var bannerMigrateToNativeSlidingSyncTitle: String { return L10n.tr("Localizable", "banner_migrate_to_native_sliding_sync_title") }
363+
/// Your notification ping has been updated—clearer, quicker, and less disruptive.
364+
internal static var bannerNewSoundMessage: String { return L10n.tr("Localizable", "banner_new_sound_message") }
365+
/// We’ve refreshed your sounds
366+
internal static var bannerNewSoundTitle: String { return L10n.tr("Localizable", "banner_new_sound_title") }
363367
/// Recover your cryptographic identity and message history with a recovery key if you have lost all your existing devices.
364368
internal static var bannerSetUpRecoveryContent: String { return L10n.tr("Localizable", "banner_set_up_recovery_content") }
365369
/// Set up recovery

ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum TestablePreviewsDictionary {
5353
"HomeScreenEmptyStateView_Previews" : HomeScreenEmptyStateView_Previews.self,
5454
"HomeScreenInviteCell_Previews" : HomeScreenInviteCell_Previews.self,
5555
"HomeScreenKnockedCell_Previews" : HomeScreenKnockedCell_Previews.self,
56+
"HomeScreenNewSoundBanner_Previews" : HomeScreenNewSoundBanner_Previews.self,
5657
"HomeScreenRecoveryKeyConfirmationBanner_Previews" : HomeScreenRecoveryKeyConfirmationBanner_Previews.self,
5758
"HomeScreenRoomCell_Previews" : HomeScreenRoomCell_Previews.self,
5859
"HomeScreen_Previews" : HomeScreen_Previews.self,

ElementX/Sources/Screens/HomeScreen/HomeScreenModels.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ enum HomeScreenViewAction {
3939
case confirmRecoveryKey
4040
case resetEncryption
4141
case skipRecoveryKeyConfirmation
42+
case dismissNewSoundBanner
4243
case updateVisibleItemRange(Range<Int>)
4344
case globalSearch
4445
case markRoomAsUnread(roomIdentifier: String)
@@ -92,6 +93,7 @@ struct HomeScreenViewState: BindableState {
9293
var userAvatarURL: URL?
9394

9495
var securityBannerMode = HomeScreenSecurityBannerMode.none
96+
var shouldShowNewSoundBanner = false
9597

9698
var requiresExtraAccountSetup = false
9799

@@ -134,6 +136,10 @@ struct HomeScreenViewState: BindableState {
134136
var shouldShowFilters: Bool {
135137
!bindings.isSearchFieldFocused && roomListMode == .rooms
136138
}
139+
140+
var shouldShowBanner: Bool {
141+
securityBannerMode.isShown || shouldShowNewSoundBanner
142+
}
137143
}
138144

139145
struct HomeScreenViewStateBindings {

ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
105105
}
106106
.store(in: &cancellables)
107107

108+
appSettings.$hasSeenNewSoundBanner
109+
.sink { [weak self] hasSeenNewSoundBanner in
110+
self?.state.shouldShowNewSoundBanner = !hasSeenNewSoundBanner
111+
}
112+
.store(in: &cancellables)
113+
108114
userSession.clientProxy.hideInviteAvatarsPublisher
109115
.removeDuplicates()
110116
.receive(on: DispatchQueue.main)
@@ -160,6 +166,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
160166
actionsSubject.send(.presentEncryptionResetScreen)
161167
case .skipRecoveryKeyConfirmation:
162168
state.securityBannerMode = .dismissed
169+
case .dismissNewSoundBanner:
170+
appSettings.hasSeenNewSoundBanner = true
163171
case .updateVisibleItemRange(let range):
164172
roomSummaryProvider?.updateVisibleRange(range)
165173
case .startChat:

0 commit comments

Comments
 (0)