Mark rooms as read on push and pop. (#462)

We don't have visibility into timeline item read status so can't do this continuously yet.

* Simplify RoomTimelineProvider's responsibilities.
This commit is contained in:
Doug
2023-01-18 15:14:03 +00:00
committed by GitHub
parent 6615116226
commit 5017ba7122
14 changed files with 183 additions and 226 deletions
@@ -23,6 +23,7 @@ enum RoomProxyError: Error {
case failedPaginatingBackwards
case failedRetrievingMemberAvatarURL
case failedRetrievingMemberDisplayName
case failedSendingReadReceipt
case failedSendingMessage
case failedSendingReaction
case failedEditingMessage
@@ -39,6 +40,7 @@ protocol RoomProxyProtocol {
var isSpace: Bool { get }
var isEncrypted: Bool { get }
var isTombstoned: Bool { get }
var hasUnreadNotifications: Bool { get }
var name: String? { get }
var displayName: String? { get }
@@ -59,21 +61,23 @@ protocol RoomProxyProtocol {
func paginateBackwards(requestSize: UInt, untilNumberOfItems: UInt) async -> Result<Void, RoomProxyError>
func sendMessage(_ message: String, inReplyToEventId: String?) async -> Result<Void, RoomProxyError>
func sendReadReceipt(for eventID: String) async -> Result<Void, RoomProxyError>
func sendReaction(_ reaction: String, for eventId: String) async -> Result<Void, RoomProxyError>
func sendMessage(_ message: String, inReplyTo eventID: String?) async -> Result<Void, RoomProxyError>
func sendReaction(_ reaction: String, to eventID: String) async -> Result<Void, RoomProxyError>
func editMessage(_ newMessage: String, originalEventId: String) async -> Result<Void, RoomProxyError>
func editMessage(_ newMessage: String, original eventID: String) async -> Result<Void, RoomProxyError>
func redact(_ eventID: String) async -> Result<Void, RoomProxyError>
func members() async -> Result<[RoomMemberProxy], RoomProxyError>
func retryDecryption(forSessionId sessionId: String) async
func retryDecryption(for sessionID: String) async
}
extension RoomProxyProtocol {
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError> {
await sendMessage(message, inReplyToEventId: nil)
await sendMessage(message, inReplyTo: nil)
}
}