mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Expose isLiveKitRTCSupported on the ClientProxy. (#4238)
This commit is contained in:
@@ -97,6 +97,7 @@ extension ClientProxyMock {
|
||||
userIdentityForReturnValue = .success(UserIdentityProxyMock(configuration: .init()))
|
||||
|
||||
underlyingIsReportRoomSupported = true
|
||||
underlyingIsLiveKitRTCSupported = true
|
||||
|
||||
underlyingTimelineMediaVisibilityPublisher = CurrentValueSubject<TimelineMediaVisibility, Never>(configuration.timelineMediaVisibility).asCurrentValuePublisher()
|
||||
underlyingHideInviteAvatarsPublisher = CurrentValueSubject<Bool, Never>(configuration.hideInviteAvatars).asCurrentValuePublisher()
|
||||
|
||||
@@ -2330,6 +2330,23 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
var underlyingIsReportRoomSupported: Bool!
|
||||
var isReportRoomSupportedClosure: (() async -> Bool)?
|
||||
var isLiveKitRTCSupportedCallsCount = 0
|
||||
var isLiveKitRTCSupportedCalled: Bool {
|
||||
return isLiveKitRTCSupportedCallsCount > 0
|
||||
}
|
||||
|
||||
var isLiveKitRTCSupported: Bool {
|
||||
get async {
|
||||
isLiveKitRTCSupportedCallsCount += 1
|
||||
if let isLiveKitRTCSupportedClosure = isLiveKitRTCSupportedClosure {
|
||||
return await isLiveKitRTCSupportedClosure()
|
||||
} else {
|
||||
return underlyingIsLiveKitRTCSupported
|
||||
}
|
||||
}
|
||||
}
|
||||
var underlyingIsLiveKitRTCSupported: Bool!
|
||||
var isLiveKitRTCSupportedClosure: (() async -> Bool)?
|
||||
|
||||
//MARK: - isOnlyDeviceLeft
|
||||
|
||||
|
||||
@@ -425,15 +425,17 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
}
|
||||
|
||||
extension RoomScreenViewModel {
|
||||
static func mock(roomProxyMock: JoinedRoomProxyMock) -> RoomScreenViewModel {
|
||||
RoomScreenViewModel(clientProxy: ClientProxyMock(),
|
||||
static func mock(roomProxyMock: JoinedRoomProxyMock,
|
||||
clientProxyMock: ClientProxyMock = ClientProxyMock(),
|
||||
appHooks: AppHooks = AppHooks()) -> RoomScreenViewModel {
|
||||
RoomScreenViewModel(clientProxy: clientProxyMock,
|
||||
roomProxy: roomProxyMock,
|
||||
initialSelectedPinnedEventID: nil,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
appHooks: appHooks,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}
|
||||
|
||||
@@ -299,6 +299,17 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isLiveKitRTCSupported: Bool {
|
||||
get async {
|
||||
do {
|
||||
return try await client.isLivekitRtcSupported()
|
||||
} catch {
|
||||
MXLog.error("Failed checking LiveKit RTC support with error: \(error)")
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private(set) lazy var pusherNotificationClientIdentifier: String? = {
|
||||
// NOTE: The result is stored as part of the restoration token. Any changes
|
||||
|
||||
@@ -127,6 +127,8 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
||||
|
||||
var isReportRoomSupported: Bool { get async }
|
||||
|
||||
var isLiveKitRTCSupported: Bool { get async }
|
||||
|
||||
func isOnlyDeviceLeft() async -> Result<Bool, ClientProxyError>
|
||||
|
||||
func startSync()
|
||||
|
||||
Reference in New Issue
Block a user