mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
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:
@@ -11,7 +11,7 @@ import UserNotifications
|
||||
import XCTest
|
||||
|
||||
extension UNNotification {
|
||||
static func with(userInfo: [AnyHashable: Any]) throws -> UNNotification {
|
||||
static func with(userInfo: [AnyHashable: Any], date: Date? = nil) throws -> UNNotification {
|
||||
let content = UNMutableNotificationContent()
|
||||
content.userInfo = userInfo
|
||||
let request = UNNotificationRequest(identifier: "",
|
||||
@@ -20,6 +20,9 @@ extension UNNotification {
|
||||
let archiver = MockCoder(requiringSecureCoding: false)
|
||||
let notification = try XCTUnwrap(UNNotification(coder: archiver))
|
||||
notification.setValue(request, forKey: "request")
|
||||
if let date {
|
||||
notification.setValue(date, forKey: "date")
|
||||
}
|
||||
return notification
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user