fix call issues

pull/1061/head
Ryan ZHAO 3 weeks ago
parent 3c3fbec6b4
commit c4ac8bbe46

@ -296,10 +296,10 @@ public final class SessionCall: CurrentCallProtocol, WebRTCSessionDelegate {
func endSessionCall() {
guard !hasEnded else { return }
let sessionId: String = self.sessionId
webRTCSession.hangUp()
webRTCSession.endCall(with: sessionId)
dependencies[singleton: .appReadiness].runNowOrWhenAppDidBecomeReady { [webRTCSession, sessionId] in
webRTCSession.endCall(with: sessionId)
}
hasEnded = true
}

@ -230,7 +230,7 @@ public final class SessionCallManager: NSObject, CallManagerProtocol {
else { return }
if
let conversationVC: ConversationVC = (presentingVC as? TopBannerController)?.wrappedViewController() as? ConversationVC,
let conversationVC: ConversationVC = presentingVC as? ConversationVC,
conversationVC.viewModel.threadData.threadId == call.sessionId
{
let callVC = CallVC(for: call, using: dependencies)
@ -301,7 +301,9 @@ public final class SessionCallManager: NSObject, CallManagerProtocol {
dependencies[defaults: .appGroup, key: .lastCallPreOffer] = nil
if dependencies[singleton: .appContext].isNotInForeground {
dependencies[singleton: .currentUserPoller].stop()
dependencies[singleton: .appReadiness].runNowOrWhenAppDidBecomeReady { [dependencies] in
dependencies[singleton: .currentUserPoller].stop()
}
Log.flush()
}
}

@ -365,7 +365,7 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {
public func endCall(with sessionId: String) {
return dependencies[singleton: .storage]
.writePublisher { [dependencies] db -> Network.PreparedRequest<Void> in
.writePublisher { [dependencies, uuid] db -> Network.PreparedRequest<Void> in
guard let thread: SessionThread = try SessionThread.fetchOne(db, id: sessionId) else {
throw WebRTCSessionError.noThread
}
@ -376,7 +376,7 @@ public final class WebRTCSession : NSObject, RTCPeerConnectionDelegate {
.preparedSend(
db,
message: CallMessage(
uuid: self.uuid,
uuid: uuid,
kind: .endCall,
sdps: []
)

@ -295,13 +295,11 @@ public class PushRegistrationManager: NSObject, PKPushRegistryDelegate {
dependencies[singleton: .jobRunner].appDidBecomeActive()
dependencies[singleton: .appReadiness].runNowOrWhenAppDidBecomeReady {
dependencies[singleton: .appReadiness].runNowOrWhenAppDidBecomeReady { [dependencies] in
// NOTE: Just start 1-1 poller so that it won't wait for polling group messages
dependencies[singleton: .currentUserPoller].startIfNeeded(forceStartInBackground: true)
}
// NOTE: Just start 1-1 poller so that it won't wait for polling group messages
dependencies[singleton: .currentUserPoller].startIfNeeded(forceStartInBackground: true)
call.reportIncomingCallIfNeeded { error in
if let error = error {
Log.error(.calls, "Failed to report incoming call to CallKit due to error: \(error)")

Loading…
Cancel
Save