Revert "Open the room live when tapping the notification for its newest message"

This reverts commit 4c71cae0f.

Comparing against other delivered notifications doesn't reflect the timeline:
in rooms set to mentions and keywords, after swiping away newer notifications
or with messages sent from another device, newer messages can exist without a
notification, so the room opened live with the tapped event out of view.
This commit is contained in:
Stefan Ceriu
2026-10-02 15:22:48 +03:00
parent a50c80c179
commit 52b411e954
6 changed files with 14 additions and 50 deletions
@@ -21,7 +21,6 @@ final class NotificationManagerTests {
private var shouldDisplayInAppNotificationReturnValue = false
private var handleInlineReplyDelegateCalled = false
private var notificationTappedDelegateCalled = false
private var notificationTappedIsNewestInRoom: Bool?
private var registerForRemoteNotificationsDelegateCalled: (() -> Void)?
private let appSettings: AppSettings
@@ -239,31 +238,6 @@ final class NotificationManagerTests {
#expect(notificationTappedDelegateCalled)
}
@Test
func whenTappedNotificationIsTheNewestInItsRoom_delegateIsToldItIsNewest() async throws {
notificationManager.delegate = self
let date = Date.now
notificationCenter.deliveredNotificationsReturnValue = try [UNNotification.with(userInfo: [NotificationConstants.UserInfoKey.roomIdentifier: "!room:matrix.org"], date: date - 60),
UNNotification.with(userInfo: [NotificationConstants.UserInfoKey.roomIdentifier: "!other:matrix.org"], date: date + 60)]
let response = try UNTextInputNotificationResponse.with(userInfo: [NotificationConstants.UserInfoKey.roomIdentifier: "!room:matrix.org"], date: date)
await notificationManager.userNotificationCenter(UNUserNotificationCenter.current(), didReceive: response)
#expect(notificationTappedIsNewestInRoom == true)
}
@Test
func whenTappedNotificationIsOlderThanAnotherInItsRoom_delegateIsToldItIsNotNewest() async throws {
notificationManager.delegate = self
let date = Date.now
notificationCenter.deliveredNotificationsReturnValue = try [UNNotification.with(userInfo: [NotificationConstants.UserInfoKey.roomIdentifier: "!room:matrix.org"], date: date + 60)]
let response = try UNTextInputNotificationResponse.with(userInfo: [NotificationConstants.UserInfoKey.roomIdentifier: "!room:matrix.org"], date: date)
await notificationManager.userNotificationCenter(UNUserNotificationCenter.current(), didReceive: response)
#expect(notificationTappedIsNewestInRoom == false)
}
@Test
func updatingAppBadgeCountUsesTheClientSideCount() async {
clientProxy.totalUnreadNotifications = 7
@@ -298,9 +272,8 @@ extension NotificationManagerTests: @MainActor NotificationManagerDelegate {
shouldDisplayInAppNotificationReturnValue
}
func notificationTapped(content: UNNotificationContent, isNewestInRoom: Bool) async {
func notificationTapped(content: UNNotificationContent) async {
notificationTappedDelegateCalled = true
notificationTappedIsNewestInRoom = isNewestInRoom
}
func handleInlineReply(_ service: ElementX.NotificationManagerProtocol, content: UNNotificationContent, replyText: String) async {