Fixes #2360 - Add support for manually marking rooms as unread (#2408)

* Fixes #2360 - Add support for manually marking rooms as unread

* Add analytics for marking rooms as (un)read

* Remove unnecessary analytics abstraction levels

* Fix breaking API changes following SDK bump

* Add changelog

* Handle PR comments

* Fix unit tests
This commit is contained in:
Stefan Ceriu
2024-02-05 18:06:50 +02:00
committed by GitHub
parent e80612b968
commit 9915a33964
46 changed files with 250 additions and 305 deletions
@@ -1847,11 +1847,6 @@ class RoomProxyMock: RoomProxyProtocol {
}
var underlyingHasOngoingCall: Bool!
var canonicalAlias: String?
var hasUnreadNotifications: Bool {
get { return underlyingHasUnreadNotifications }
set(value) { underlyingHasUnreadNotifications = value }
}
var underlyingHasUnreadNotifications: Bool!
var ownUserID: String {
get { return underlyingOwnUserID }
set(value) { underlyingOwnUserID = value }
@@ -2222,6 +2217,44 @@ class RoomProxyMock: RoomProxyProtocol {
return canUserTriggerRoomNotificationUserIDReturnValue
}
}
//MARK: - markAsUnread
var markAsUnreadCallsCount = 0
var markAsUnreadCalled: Bool {
return markAsUnreadCallsCount > 0
}
var markAsUnreadReturnValue: Result<Void, RoomProxyError>!
var markAsUnreadClosure: (() async -> Result<Void, RoomProxyError>)?
func markAsUnread() async -> Result<Void, RoomProxyError> {
markAsUnreadCallsCount += 1
if let markAsUnreadClosure = markAsUnreadClosure {
return await markAsUnreadClosure()
} else {
return markAsUnreadReturnValue
}
}
//MARK: - markAsRead
var markAsReadSendReadReceiptsReceiptTypeCallsCount = 0
var markAsReadSendReadReceiptsReceiptTypeCalled: Bool {
return markAsReadSendReadReceiptsReceiptTypeCallsCount > 0
}
var markAsReadSendReadReceiptsReceiptTypeReceivedArguments: (sendReadReceipts: Bool, receiptType: ReceiptType)?
var markAsReadSendReadReceiptsReceiptTypeReceivedInvocations: [(sendReadReceipts: Bool, receiptType: ReceiptType)] = []
var markAsReadSendReadReceiptsReceiptTypeReturnValue: Result<Void, RoomProxyError>!
var markAsReadSendReadReceiptsReceiptTypeClosure: ((Bool, ReceiptType) async -> Result<Void, RoomProxyError>)?
func markAsRead(sendReadReceipts: Bool, receiptType: ReceiptType) async -> Result<Void, RoomProxyError> {
markAsReadSendReadReceiptsReceiptTypeCallsCount += 1
markAsReadSendReadReceiptsReceiptTypeReceivedArguments = (sendReadReceipts: sendReadReceipts, receiptType: receiptType)
markAsReadSendReadReceiptsReceiptTypeReceivedInvocations.append((sendReadReceipts: sendReadReceipts, receiptType: receiptType))
if let markAsReadSendReadReceiptsReceiptTypeClosure = markAsReadSendReadReceiptsReceiptTypeClosure {
return await markAsReadSendReadReceiptsReceiptTypeClosure(sendReadReceipts, receiptType)
} else {
return markAsReadSendReadReceiptsReceiptTypeReturnValue
}
}
//MARK: - canUserJoinCall
var canUserJoinCallUserIDCallsCount = 0
@@ -1,4 +1,4 @@
// Generated using Sourcery 2.1.2 — https://github.com/krzysztofzablocki/Sourcery
// Generated using Sourcery 2.1.3 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable all
@@ -29,7 +29,6 @@ struct RoomProxyMockConfiguration {
var isEncrypted = true
var hasOngoingCall = true
var canonicalAlias: String?
var hasUnreadNotifications = Bool.random()
var timeline = {
let mock = TimelineProxyMock()
@@ -64,7 +63,6 @@ extension RoomProxyMock {
isEncrypted = configuration.isEncrypted
hasOngoingCall = configuration.hasOngoingCall
canonicalAlias = configuration.canonicalAlias
hasUnreadNotifications = configuration.hasUnreadNotifications
timeline = configuration.timeline