Skip to content

Commit

Permalink
Merge pull request #569 from ebsangam/fix/call-end-accept-ios
Browse files Browse the repository at this point in the history
fix[ios]: end current call and join new
  • Loading branch information
hiennguyen92 authored Sep 23, 2024
2 parents d726b0d + 9f66bbf commit 1a903b2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ios/Classes/SwiftFlutterCallkitIncomingPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,18 @@ public class SwiftFlutterCallkitIncomingPlugin: NSObject, FlutterPlugin, CXProvi
}
}

// private func checkUnlockedAndFulfill(action: CXAnswerCallAction, counter: Int) {
// if UIApplication.shared.isProtectedDataAvailable {
// action.fulfill()
// } else if counter > 180 { // fail if waiting for more then 3 minutes
// action.fail()
// } else {
// DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
// self.checkUnlockedAndFulfill(action: action, counter: counter + 1)
// }
// }
// }


public func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
guard let call = self.callManager.callWithUUID(uuid: action.callUUID) else {
Expand Down Expand Up @@ -662,15 +674,6 @@ public class SwiftFlutterCallkitIncomingPlugin: NSObject, FlutterPlugin, CXProvi
print("Call is on hold")
return
}
self.outgoingCall?.endCall()
if(self.outgoingCall != nil){
self.outgoingCall = nil
}
self.answerCall?.endCall()
if(self.answerCall != nil){
self.answerCall = nil
}
self.callManager.removeAllCalls()

self.sendEvent(SwiftFlutterCallkitIncomingPlugin.ACTION_CALL_TOGGLE_AUDIO_SESSION, [ "isActivate": false ])
}
Expand Down

0 comments on commit 1a903b2

Please sign in to comment.