mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Hook up CallKit lock screen muting controls to the ElementCall widget
This commit is contained in:
committed by
Stefan Ceriu
parent
2cce310540
commit
d16ba9f3ef
@@ -58,11 +58,35 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: intercept EC mute state changes and pass them over to CallKit
|
||||
// elementCallService.setCallMuted(roomID: roomProxy.id, muted: muted)
|
||||
|
||||
Task {
|
||||
await self.widgetDriver.sendMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
elementCallService.actions
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
|
||||
switch action {
|
||||
case let .setCallMuted(muted, roomID):
|
||||
guard roomID == roomProxy.id else {
|
||||
MXLog.error("Received mute request for a different room: \(roomID) != \(roomProxy.id)")
|
||||
return
|
||||
}
|
||||
|
||||
Task {
|
||||
await self.setMuted(muted)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
widgetDriver.messagePublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] receivedMessage in
|
||||
@@ -115,6 +139,8 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
||||
|
||||
await elementCallService.setupCallSession(roomID: roomProxy.id, roomDisplayName: roomProxy.roomTitle)
|
||||
|
||||
// TODO: Pass over the current EC mute status to CallKit
|
||||
|
||||
let _ = await roomProxy.sendCallNotificationIfNeeeded()
|
||||
}
|
||||
}
|
||||
@@ -137,6 +163,10 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func setMuted(_ muted: Bool) async {
|
||||
// Not supported on EC yet
|
||||
}
|
||||
|
||||
private func hangUp() async {
|
||||
let hangUpMessage = """
|
||||
{"api":"fromWidget",
|
||||
|
||||
Reference in New Issue
Block a user