diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a5d4a..e511cd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.7.0 +- Implemented closing of the iOS CallKit by VoIP push notification where `signal_type` is 'endCall' or 'rejectCall'; + ## 2.6.0 - Implemented the Notify for Incoming Calls feature (thanks for [tungs0ul](https://github.com/tungs0ul)); diff --git a/android/build.gradle b/android/build.gradle index a32704e..8fcb98f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ group 'com.connectycube.flutter.connectycube_flutter_call_kit' -version '2.6.0' +version '2.7.0' buildscript { ext.kotlin_version = '1.9.10' diff --git a/ios/Classes/VoIPController.swift b/ios/Classes/VoIPController.swift index d5bb4b7..1b32347 100644 --- a/ios/Classes/VoIPController.swift +++ b/ios/Classes/VoIPController.swift @@ -56,23 +56,34 @@ extension VoIPController: PKPushRegistryDelegate { if type == .voIP{ let callId = callData["session_id"] as! String - let callType = callData["call_type"] as! Int - let callInitiatorId = callData["caller_id"] as! Int - let callInitiatorName = callData["caller_name"] as! String - let callOpponentsString = callData["call_opponents"] as! String - let callOpponents = callOpponentsString.components(separatedBy: ",") - .map { Int($0) ?? 0 } - let userInfo = callData["user_info"] as? String + let signalingType = callData["signal_type"] as? String - self.callKitController.reportIncomingCall(uuid: callId.lowercased(), callType: callType, callInitiatorId: callInitiatorId, callInitiatorName: callInitiatorName, opponents: callOpponents, userInfo: userInfo) { (error) in + if (signalingType != nil && (signalingType == "endCall" || signalingType == "rejectCall")) { + self.callKitController.reportCallEnded(uuid: UUID(uuidString: callId.lowercased())!, reason: CallEndedReason.remoteEnded) completion() + } else if (signalingType != nil && signalingType == "startCall") { + let callType = callData["call_type"] as! Int + let callInitiatorId = callData["caller_id"] as! Int + let callInitiatorName = callData["caller_name"] as! String + let callOpponentsString = callData["call_opponents"] as! String + let callOpponents = callOpponentsString.components(separatedBy: ",") + .map { Int($0) ?? 0 } + let userInfo = callData["user_info"] as? String - if(error == nil){ - print("[VoIPController][didReceiveIncomingPushWith] reportIncomingCall SUCCESS") - } else { - print("[VoIPController][didReceiveIncomingPushWith] reportIncomingCall ERROR: \(error?.localizedDescription ?? "none")") + self.callKitController.reportIncomingCall(uuid: callId.lowercased(), callType: callType, callInitiatorId: callInitiatorId, callInitiatorName: callInitiatorName, opponents: callOpponents, userInfo: userInfo) { (error) in + + completion() + + if(error == nil){ + print("[VoIPController][didReceiveIncomingPushWith] reportIncomingCall SUCCESS") + } else { + print("[VoIPController][didReceiveIncomingPushWith] reportIncomingCall ERROR: \(error?.localizedDescription ?? "none")") + } } + } else { + print("[VoIPController][didReceiveIncomingPushWith] unknown 'signal_type' was received") + completion() } } else { completion() diff --git a/ios/connectycube_flutter_call_kit.podspec b/ios/connectycube_flutter_call_kit.podspec index 828db6f..50fefba 100644 --- a/ios/connectycube_flutter_call_kit.podspec +++ b/ios/connectycube_flutter_call_kit.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'connectycube_flutter_call_kit' - s.version = '2.6.0' + s.version = '2.7.0' s.summary = 'Connectycube Call Kit plugin for flutter.' s.description = <<-DESC Connectycube Call Kit plugin for flutter. diff --git a/pubspec.yaml b/pubspec.yaml index 129f56f..f755198 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: connectycube_flutter_call_kit description: A Flutter plugin for displaying call screen when app in background or terminated. -version: 2.6.0 +version: 2.7.0 homepage: https://connectycube.com/ issue_tracker: https://github.com/ConnectyCube/connectycube-flutter-call-kit/issues documentation: https://github.com/ConnectyCube/connectycube-flutter-call-kit/blob/master/README.md