mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Bump the RustSDK, adopt new marking/flagging rooms as (un)read API and fix sending read receipts when entering rooms or making the app active again
This commit is contained in:
committed by
Stefan Ceriu
parent
e11450e61e
commit
5cb5862e5e
+12
-10
@@ -16,6 +16,7 @@
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import UIKit
|
||||
|
||||
class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
@@ -91,17 +92,18 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func sendReadReceipt(for itemID: TimelineItemIdentifier) async -> Result<Void, RoomTimelineControllerError> {
|
||||
guard let eventID = itemID.eventID else {
|
||||
return .failure(.generic)
|
||||
}
|
||||
func sendReadReceipt(for itemID: TimelineItemIdentifier) async {
|
||||
let receiptType: MatrixRustSDK.ReceiptType = appSettings.sharePresence ? .read : .readPrivate
|
||||
|
||||
switch await roomProxy.timeline.sendReadReceipt(for: eventID,
|
||||
type: appSettings.sharePresence ? .read : .readPrivate) {
|
||||
case .success:
|
||||
return .success(())
|
||||
case .failure:
|
||||
return .failure(.generic)
|
||||
// Mark the whole room as read if it's the last timeline item
|
||||
if timelineItems.last?.id == itemID {
|
||||
_ = await roomProxy.markAsRead(receiptType: receiptType)
|
||||
} else {
|
||||
guard let eventID = itemID.eventID else {
|
||||
return
|
||||
}
|
||||
|
||||
_ = await roomProxy.timeline.sendReadReceipt(for: eventID, type: receiptType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user