mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Update the SDK with a fix for read receipts. (#5991)
This commit is contained in:
@@ -10425,7 +10425,7 @@
|
|||||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 26.08.06;
|
version = 26.08.07;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||||
|
|||||||
@@ -167,8 +167,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "bb2701951010f08d39627e99a816f532d42e6f62",
|
"revision" : "4201e58f36d416dd16673dc7aaebdfbdc90e7d95",
|
||||||
"version" : "26.8.6"
|
"version" : "26.8.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,9 +124,12 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
func stop() {
|
func stop() {
|
||||||
// When navigating away from the room, we need to mark the room as fully read.
|
Task {
|
||||||
// This does not affect the read receipts only the notification count.
|
// When navigating away from the room, we need to mark the room as both read
|
||||||
Task { await roomProxy.markAsRead(receiptType: .fullyRead) }
|
// and fully read for Synapse to clear this room from the app's badge count.
|
||||||
|
_ = await roomProxy.markAsRead(receiptType: appSettings.sharePresence ? .read : .readPrivate)
|
||||||
|
_ = 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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
var isLiveKitRTCSupported: Bool {
|
var isLiveKitRTCSupported: Bool {
|
||||||
get async {
|
get async {
|
||||||
do {
|
do {
|
||||||
return try await client.isLivekitRtcSupported()
|
return try await client.isLivekitRtcSupported(fallbackToWellKnown: true)
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed checking LiveKit RTC support with error: \(error)")
|
MXLog.error("Failed checking LiveKit RTC support with error: \(error)")
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -1723,34 +1723,48 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
|||||||
|
|
||||||
//MARK: - isLivekitRtcSupported
|
//MARK: - isLivekitRtcSupported
|
||||||
|
|
||||||
open var isLivekitRtcSupportedThrowableError: Error?
|
open var isLivekitRtcSupportedFallbackToWellKnownThrowableError: Error?
|
||||||
private let isLivekitRtcSupportedCallsCountLock = NSLock()
|
private let isLivekitRtcSupportedFallbackToWellKnownCallsCountLock = NSLock()
|
||||||
private var isLivekitRtcSupportedUnderlyingCallsCount = 0
|
private var isLivekitRtcSupportedFallbackToWellKnownUnderlyingCallsCount = 0
|
||||||
open var isLivekitRtcSupportedCallsCount: Int {
|
open var isLivekitRtcSupportedFallbackToWellKnownCallsCount: Int {
|
||||||
get { isLivekitRtcSupportedCallsCountLock.withLock { isLivekitRtcSupportedUnderlyingCallsCount } }
|
get { isLivekitRtcSupportedFallbackToWellKnownCallsCountLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingCallsCount } }
|
||||||
set { isLivekitRtcSupportedCallsCountLock.withLock { isLivekitRtcSupportedUnderlyingCallsCount = newValue } }
|
set { isLivekitRtcSupportedFallbackToWellKnownCallsCountLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingCallsCount = newValue } }
|
||||||
}
|
}
|
||||||
open var isLivekitRtcSupportedCalled: Bool {
|
open var isLivekitRtcSupportedFallbackToWellKnownCalled: Bool {
|
||||||
return isLivekitRtcSupportedCallsCount > 0
|
return isLivekitRtcSupportedFallbackToWellKnownCallsCount > 0
|
||||||
|
}
|
||||||
|
private let isLivekitRtcSupportedFallbackToWellKnownReceivedFallbackToWellKnownLock = NSLock()
|
||||||
|
private var isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedFallbackToWellKnown: Bool?
|
||||||
|
open var isLivekitRtcSupportedFallbackToWellKnownReceivedFallbackToWellKnown: Bool? {
|
||||||
|
get { isLivekitRtcSupportedFallbackToWellKnownReceivedFallbackToWellKnownLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedFallbackToWellKnown } }
|
||||||
|
set { isLivekitRtcSupportedFallbackToWellKnownReceivedFallbackToWellKnownLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedFallbackToWellKnown = newValue } }
|
||||||
|
}
|
||||||
|
private let isLivekitRtcSupportedFallbackToWellKnownReceivedInvocationsLock = NSLock()
|
||||||
|
private var isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedInvocations: [Bool] = []
|
||||||
|
open var isLivekitRtcSupportedFallbackToWellKnownReceivedInvocations: [Bool] {
|
||||||
|
get { isLivekitRtcSupportedFallbackToWellKnownReceivedInvocationsLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedInvocations } }
|
||||||
|
set { isLivekitRtcSupportedFallbackToWellKnownReceivedInvocationsLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedInvocations = newValue } }
|
||||||
}
|
}
|
||||||
|
|
||||||
private let isLivekitRtcSupportedReturnValueLock = NSLock()
|
private let isLivekitRtcSupportedFallbackToWellKnownReturnValueLock = NSLock()
|
||||||
open var isLivekitRtcSupportedUnderlyingReturnValue: Bool!
|
open var isLivekitRtcSupportedFallbackToWellKnownUnderlyingReturnValue: Bool!
|
||||||
open var isLivekitRtcSupportedReturnValue: Bool! {
|
open var isLivekitRtcSupportedFallbackToWellKnownReturnValue: Bool! {
|
||||||
get { isLivekitRtcSupportedReturnValueLock.withLock { isLivekitRtcSupportedUnderlyingReturnValue } }
|
get { isLivekitRtcSupportedFallbackToWellKnownReturnValueLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReturnValue } }
|
||||||
set { isLivekitRtcSupportedReturnValueLock.withLock { isLivekitRtcSupportedUnderlyingReturnValue = newValue } }
|
set { isLivekitRtcSupportedFallbackToWellKnownReturnValueLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReturnValue = newValue } }
|
||||||
}
|
}
|
||||||
open var isLivekitRtcSupportedClosure: (() async throws -> Bool)?
|
open var isLivekitRtcSupportedFallbackToWellKnownClosure: ((Bool) async throws -> Bool)?
|
||||||
|
|
||||||
open override func isLivekitRtcSupported() async throws -> Bool {
|
open override func isLivekitRtcSupported(fallbackToWellKnown: Bool = false) async throws -> Bool {
|
||||||
if let error = isLivekitRtcSupportedThrowableError {
|
if let error = isLivekitRtcSupportedFallbackToWellKnownThrowableError {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
isLivekitRtcSupportedCallsCountLock.withLock { isLivekitRtcSupportedUnderlyingCallsCount += 1 }
|
isLivekitRtcSupportedFallbackToWellKnownCallsCountLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingCallsCount += 1 }
|
||||||
if let isLivekitRtcSupportedClosure = isLivekitRtcSupportedClosure {
|
isLivekitRtcSupportedFallbackToWellKnownReceivedFallbackToWellKnown = fallbackToWellKnown
|
||||||
return try await isLivekitRtcSupportedClosure()
|
isLivekitRtcSupportedFallbackToWellKnownReceivedInvocationsLock.withLock { isLivekitRtcSupportedFallbackToWellKnownUnderlyingReceivedInvocations.append(fallbackToWellKnown) }
|
||||||
|
if let isLivekitRtcSupportedFallbackToWellKnownClosure = isLivekitRtcSupportedFallbackToWellKnownClosure {
|
||||||
|
return try await isLivekitRtcSupportedFallbackToWellKnownClosure(fallbackToWellKnown)
|
||||||
} else {
|
} else {
|
||||||
return isLivekitRtcSupportedReturnValue
|
return isLivekitRtcSupportedFallbackToWellKnownReturnValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import Combine
|
|||||||
import Foundation
|
import Foundation
|
||||||
import MatrixRustSDK
|
import MatrixRustSDK
|
||||||
import MatrixRustSDKMocks
|
import MatrixRustSDKMocks
|
||||||
|
import Synchronization
|
||||||
import Testing
|
import Testing
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
@@ -305,10 +306,13 @@ final class RoomScreenViewModelTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
func roomFullyRead() async {
|
func roomFullyRead() async {
|
||||||
await waitForConfirmation("Wait for fully read") { confirm in
|
let expectedReceipts: [ReceiptType] = [.read, .fullyRead]
|
||||||
|
let receivedReceipts = Mutex<[ReceiptType]>([])
|
||||||
|
|
||||||
|
await waitForConfirmation("Wait for fully read", expectedCount: expectedReceipts.count) { confirm in
|
||||||
let roomProxyMock = JoinedRoomProxyMock(.init(id: "MyRoomID"))
|
let roomProxyMock = JoinedRoomProxyMock(.init(id: "MyRoomID"))
|
||||||
roomProxyMock.markAsReadReceiptTypeClosure = { readReceiptType in
|
roomProxyMock.markAsReadReceiptTypeClosure = { readReceiptType in
|
||||||
#expect(readReceiptType == .fullyRead)
|
receivedReceipts.withLock { $0.append(readReceiptType) }
|
||||||
confirm()
|
confirm()
|
||||||
return .success(())
|
return .success(())
|
||||||
}
|
}
|
||||||
@@ -322,6 +326,8 @@ final class RoomScreenViewModelTests {
|
|||||||
userIndicatorController: UserIndicatorControllerMock())
|
userIndicatorController: UserIndicatorControllerMock())
|
||||||
viewModel.stop()
|
viewModel.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#expect(receivedReceipts.withLock { $0 } == expectedReceipts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Knock Requests
|
// MARK: - Knock Requests
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ packages:
|
|||||||
# Element/Matrix dependencies
|
# Element/Matrix dependencies
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||||
exactVersion: 26.08.06
|
exactVersion: 26.08.07
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
path: compound-ios
|
path: compound-ios
|
||||||
|
|||||||
Reference in New Issue
Block a user