mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-15 20:30:00 +02:00
@@ -8,6 +8,7 @@ Changes to be released in next version
|
||||
* Crypto: Do not decrypt synchronously. It asynchronously happens upstream now (#4306).
|
||||
* Navigation: Start decoupling view controllers managed by MasterTabBarController (#3596 and #3618).
|
||||
* Jitsi: Include optional server name field on JitsiJWTPayloadContextMatrix.
|
||||
* CallPresenter: Add more logs for group calls.
|
||||
|
||||
🐛 Bugfix
|
||||
* buildRelease.sh: Make bundler operations in the cloned repository folder.
|
||||
|
||||
@@ -118,18 +118,24 @@ class CallPresenter: NSObject {
|
||||
|
||||
/// Start the service
|
||||
func start() {
|
||||
NSLog("[CallPresenter] start")
|
||||
|
||||
addCallObservers()
|
||||
startCallTimer()
|
||||
}
|
||||
|
||||
/// Stop the service
|
||||
func stop() {
|
||||
NSLog("[CallPresenter] stop")
|
||||
|
||||
removeCallObservers()
|
||||
stopCallTimer()
|
||||
}
|
||||
|
||||
/// Method to be called when the call status bar is tapped.
|
||||
func callStatusBarTapped() {
|
||||
NSLog("[CallPresenter] callStatusBarTapped")
|
||||
|
||||
if let callVC = (inBarCallVC ?? activeCallVC) as? CallViewController {
|
||||
dismissCallBar(for: callVC)
|
||||
presentCallVC(callVC)
|
||||
@@ -146,6 +152,8 @@ class CallPresenter: NSObject {
|
||||
/// Open the Jitsi view controller from a widget.
|
||||
/// - Parameter widget: the jitsi widget
|
||||
func displayJitsiCall(withWidget widget: Widget) {
|
||||
NSLog("[CallPresenter] displayJitsiCall: for widget: \(widget.widgetId)")
|
||||
|
||||
#if canImport(JitsiMeetSDK)
|
||||
let createJitsiBlock = { [weak self] in
|
||||
guard let self = self else { return }
|
||||
@@ -183,20 +191,26 @@ class CallPresenter: NSObject {
|
||||
}
|
||||
|
||||
private func startJitsiCall(withWidget widget: Widget) {
|
||||
if self.jitsiCalls.first(where: { $0.value.widgetId == widget.widgetId })?.key != nil {
|
||||
NSLog("[CallPresenter] startJitsiCall")
|
||||
|
||||
if let uuid = self.jitsiCalls.first(where: { $0.value.widgetId == widget.widgetId })?.key {
|
||||
// this Jitsi call is already managed by this class, no need to report the call again
|
||||
NSLog("[CallPresenter] startJitsiCall: already managed with id: \(uuid.uuidString)")
|
||||
return
|
||||
}
|
||||
|
||||
guard let roomId = widget.roomId else {
|
||||
NSLog("[CallPresenter] startJitsiCall: no roomId on widget")
|
||||
return
|
||||
}
|
||||
|
||||
guard let session = sessions.first else {
|
||||
NSLog("[CallPresenter] startJitsiCall: no active session")
|
||||
return
|
||||
}
|
||||
|
||||
guard let room = session.room(withRoomId: roomId) else {
|
||||
NSLog("[CallPresenter] startJitsiCall: unknown room: \(roomId)")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -204,7 +218,12 @@ class CallPresenter: NSObject {
|
||||
let handle = CXHandle(type: .generic, value: roomId)
|
||||
let startCallAction = CXStartCallAction(call: newUUID, handle: handle)
|
||||
let transaction = CXTransaction(action: startCallAction)
|
||||
|
||||
NSLog("[CallPresenter] startJitsiCall: new call with id: \(newUUID.uuidString)")
|
||||
|
||||
JMCallKitProxy.request(transaction) { (error) in
|
||||
NSLog("[CallPresenter] startJitsiCall: JMCallKitProxy returned \(String(describing: error))")
|
||||
|
||||
if error == nil {
|
||||
JMCallKitProxy.reportCallUpdate(with: newUUID,
|
||||
handle: roomId,
|
||||
@@ -218,8 +237,11 @@ class CallPresenter: NSObject {
|
||||
}
|
||||
|
||||
func endActiveJitsiCall() {
|
||||
NSLog("[CallPresenter] endActiveJitsiCall")
|
||||
|
||||
guard let jitsiVC = jitsiVC else {
|
||||
// there is no active Jitsi call
|
||||
NSLog("[CallPresenter] endActiveJitsiCall: no active Jitsi call")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -235,16 +257,22 @@ class CallPresenter: NSObject {
|
||||
self.jitsiVC = nil
|
||||
|
||||
guard let widget = jitsiVC.widget else {
|
||||
NSLog("[CallPresenter] endActiveJitsiCall: no Jitsi widget for the active call")
|
||||
return
|
||||
}
|
||||
guard let uuid = self.jitsiCalls.first(where: { $0.value.widgetId == widget.widgetId })?.key else {
|
||||
// this Jitsi call is not managed by this class
|
||||
NSLog("[CallPresenter] endActiveJitsiCall: Not managed Jitsi call: \(widget.widgetId)")
|
||||
return
|
||||
}
|
||||
|
||||
let endCallAction = CXEndCallAction(call: uuid)
|
||||
let transaction = CXTransaction(action: endCallAction)
|
||||
|
||||
NSLog("[CallPresenter] endActiveJitsiCall: ended call with id: \(uuid.uuidString)")
|
||||
|
||||
JMCallKitProxy.request(transaction) { (error) in
|
||||
NSLog("[CallPresenter] endActiveJitsiCall: JMCallKitProxy returned \(String(describing: error))")
|
||||
if error == nil {
|
||||
self.jitsiCalls.removeValue(forKey: uuid)
|
||||
}
|
||||
@@ -252,34 +280,42 @@ class CallPresenter: NSObject {
|
||||
}
|
||||
|
||||
func processWidgetEvent(_ event: MXEvent, inSession session: MXSession) {
|
||||
NSLog("[CallPresenter] processWidgetEvent")
|
||||
|
||||
guard JMCallKitProxy.isProviderConfigured() else {
|
||||
// CallKit proxy is not configured, no benefit in parsing the event
|
||||
NSLog("[CallPresenter] processWidgetEvent: JMCallKitProxy not configured")
|
||||
return
|
||||
}
|
||||
|
||||
guard let widget = Widget(widgetEvent: event, inMatrixSession: session) else {
|
||||
NSLog("[CallPresenter] processWidgetEvent: widget couldn't be created")
|
||||
return
|
||||
}
|
||||
|
||||
if self.jitsiCalls.first(where: { $0.value.widgetId == widget.widgetId })?.key != nil {
|
||||
if let uuid = self.jitsiCalls.first(where: { $0.value.widgetId == widget.widgetId })?.key {
|
||||
// this Jitsi call is already managed by this class, no need to report the call again
|
||||
NSLog("[CallPresenter] processWidgetEvent: Jitsi call already managed with id: \(uuid.uuidString)")
|
||||
return
|
||||
}
|
||||
|
||||
if widget.isActive {
|
||||
guard widget.type == kWidgetTypeJitsiV1 || widget.type == kWidgetTypeJitsiV2 else {
|
||||
// not a Jitsi widget, ignore
|
||||
NSLog("[CallPresenter] processWidgetEvent: not a Jitsi widget")
|
||||
return
|
||||
}
|
||||
|
||||
if let jitsiVC = jitsiVC,
|
||||
jitsiVC.widget.widgetId == widget.widgetId {
|
||||
// this is already the Jitsi call we have atm
|
||||
NSLog("[CallPresenter] processWidgetEvent: ongoing Jitsi call")
|
||||
return
|
||||
}
|
||||
|
||||
if TimeInterval(event.age)/MSEC_PER_SEC > Constants.groupCallInviteLifetime {
|
||||
// too late to process the event
|
||||
NSLog("[CallPresenter] processWidgetEvent: expired call invite")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -291,6 +327,7 @@ class CallPresenter: NSObject {
|
||||
|
||||
if event.sender == session.myUserId {
|
||||
// outgoing call
|
||||
NSLog("[CallPresenter] processWidgetEvent: Report outgoing call with id: \(newUUID.uuidString)")
|
||||
JMCallKitProxy.reportOutgoingCall(with: newUUID, connectedAt: nil)
|
||||
} else {
|
||||
// incoming call
|
||||
@@ -301,10 +338,15 @@ class CallPresenter: NSObject {
|
||||
let user = session.user(withUserId: event.sender)
|
||||
let displayName = NSString.localizedUserNotificationString(forKey: "GROUP_CALL_FROM_USER",
|
||||
arguments: [user?.displayname as Any])
|
||||
|
||||
NSLog("[CallPresenter] processWidgetEvent: Report new incoming call with id: \(newUUID.uuidString)")
|
||||
|
||||
JMCallKitProxy.reportNewIncomingCall(UUID: newUUID,
|
||||
handle: widget.roomId,
|
||||
displayName: displayName,
|
||||
hasVideo: true) { (error) in
|
||||
NSLog("[CallPresenter] processWidgetEvent: JMCallKitProxy returned \(String(describing: error))")
|
||||
|
||||
if error != nil {
|
||||
self.jitsiCalls.removeValue(forKey: newUUID)
|
||||
}
|
||||
@@ -313,8 +355,10 @@ class CallPresenter: NSObject {
|
||||
} else {
|
||||
guard let uuid = self.jitsiCalls.first(where: { $0.value.widgetId == widget.widgetId })?.key else {
|
||||
// this Jitsi call is not managed by this class
|
||||
NSLog("[CallPresenter] processWidgetEvent: not managed Jitsi call: \(widget.widgetId)")
|
||||
return
|
||||
}
|
||||
NSLog("[CallPresenter] processWidgetEvent: ended call with id: \(uuid.uuidString)")
|
||||
JMCallKitProxy.reportCall(with: uuid, endedAt: nil, reason: .remoteEnded)
|
||||
self.jitsiCalls.removeValue(forKey: uuid)
|
||||
}
|
||||
@@ -396,9 +440,9 @@ class CallPresenter: NSObject {
|
||||
|
||||
private func logCallVC(_ callVC: UIViewController, log: String) {
|
||||
if let callVC = callVC as? CallViewController {
|
||||
NSLog("[CallPresenter] \(log): call: \(String(describing: callVC.mxCall?.callId))")
|
||||
NSLog("[CallPresenter] \(log): Matrix call: \(String(describing: callVC.mxCall?.callId))")
|
||||
} else if let callVC = callVC as? JitsiViewController {
|
||||
NSLog("[CallPresenter] \(log): call: \(callVC.widget.widgetId)")
|
||||
NSLog("[CallPresenter] \(log): Jitsi call: \(callVC.widget.widgetId)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user