mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
send .fullyRead marker when leaving the room
This commit is contained in:
@@ -122,6 +122,9 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
func stop() {
|
func stop() {
|
||||||
|
// When navigating away from the room, we need to mark the room as fully read.
|
||||||
|
// This does not affect the read receipts only the notification count.
|
||||||
|
Task { await roomProxy.markAsRead(receiptType: .fullyRead) }
|
||||||
// Work around QLPreviewController dismissal issues, see the InteractiveQuickLookModifier.
|
// Work around QLPreviewController dismissal issues, see the InteractiveQuickLookModifier.
|
||||||
state.bindings.mediaPreviewViewModel = nil
|
state.bindings.mediaPreviewViewModel = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,6 +248,28 @@ class RoomScreenViewModelTests: XCTestCase {
|
|||||||
XCTAssertTrue(viewModel.state.shouldShowCallButton)
|
XCTAssertTrue(viewModel.state.shouldShowCallButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testRoomFullyRead() async {
|
||||||
|
let expectation = XCTestExpectation(description: "Wait for fully read")
|
||||||
|
let roomProxyMock = JoinedRoomProxyMock(.init(id: "MyRoomID"))
|
||||||
|
roomProxyMock.markAsReadReceiptTypeClosure = { readReceiptType in
|
||||||
|
XCTAssertEqual(readReceiptType, .fullyRead)
|
||||||
|
expectation.fulfill()
|
||||||
|
return .success(())
|
||||||
|
}
|
||||||
|
let viewModel = RoomScreenViewModel(clientProxy: ClientProxyMock(),
|
||||||
|
roomProxy: roomProxyMock,
|
||||||
|
initialSelectedPinnedEventID: nil,
|
||||||
|
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||||
|
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||||
|
appMediator: AppMediatorMock.default,
|
||||||
|
appSettings: ServiceLocator.shared.settings,
|
||||||
|
analyticsService: ServiceLocator.shared.analytics,
|
||||||
|
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||||
|
self.viewModel = viewModel
|
||||||
|
viewModel.stop()
|
||||||
|
await fulfillment(of: [expectation])
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Knock Requests
|
// MARK: - Knock Requests
|
||||||
|
|
||||||
func testKnockRequestBanner() async throws {
|
func testKnockRequestBanner() async throws {
|
||||||
|
|||||||
Reference in New Issue
Block a user