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

Tapping a message notification always opened the room on a timeline
focussed on that event, even when it was the newest message and the
live timeline already ends with it.

On tap, the notification manager now checks whether any other delivered
notification for the same room is more recent. If none is, the room is
opened live instead of focussed. Older notifications in a room keep
focussing on their event.
This commit is contained in:
Stefan Ceriu
2026-09-30 13:07:01 +03:00
parent 7973da8251
commit 4c71cae0f5
6 changed files with 50 additions and 14 deletions
@@ -10,15 +10,9 @@ import UserNotifications
import XCTest
extension UNTextInputNotificationResponse {
static func with(userInfo: [AnyHashable: Any], actionIdentifier: String = UNNotificationDefaultActionIdentifier) throws -> UNNotificationResponse {
let content = UNMutableNotificationContent()
content.userInfo = userInfo
let request = UNNotificationRequest(identifier: "",
content: content,
trigger: nil)
static func with(userInfo: [AnyHashable: Any], date: Date? = nil, actionIdentifier: String = UNNotificationDefaultActionIdentifier) throws -> UNNotificationResponse {
let notification = try UNNotification.with(userInfo: userInfo, date: date)
let archiver = MockCoder(requiringSecureCoding: false)
let notification = try XCTUnwrap(UNNotification(coder: archiver))
notification.setValue(request, forKey: "request")
let response = try XCTUnwrap(UNTextInputNotificationResponse(coder: archiver))
response.setValue(notification, forKey: "notification")