Commit 4e2fde62 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

CallKit: deactivate functionality in China

Change-Id: Ie2a8381a7c827a48eaf33b7859bee640630a521a
parent 73faae18
...@@ -173,7 +173,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -173,7 +173,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
} else { } else {
self.unregisterVoipNotifications() self.unregisterVoipNotifications()
} }
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
return return
} }
// reimit new call signal to show incoming call alert // reimit new call signal to show incoming call alert
...@@ -225,7 +225,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -225,7 +225,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func applicationDidBecomeActive(_ application: UIApplication) { func applicationDidBecomeActive(_ application: UIApplication) {
self.clearBadgeNumber() self.clearBadgeNumber()
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
return return
} }
self.callService.checkForIncomingCall() self.callService.checkForIncomingCall()
...@@ -487,7 +487,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -487,7 +487,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication, func application(_ application: UIApplication,
continue userActivity: NSUserActivity, continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
guard let handle = userActivity.startCallHandle else { guard let handle = userActivity.startCallHandle else {
return false return false
} }
...@@ -507,7 +507,7 @@ extension AppDelegate: PKPushRegistryDelegate { ...@@ -507,7 +507,7 @@ extension AppDelegate: PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) { func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
self.accountService.pushNotificationReceived(data: payload.dictionaryPayload) self.accountService.pushNotificationReceived(data: payload.dictionaryPayload)
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
return return
} }
if UIApplication.shared.applicationState != .active { if UIApplication.shared.applicationState != .active {
......
...@@ -112,7 +112,7 @@ class CallViewModel: Stateable, ViewModel { ...@@ -112,7 +112,7 @@ class CallViewModel: Stateable, ViewModel {
if hide { if hide {
self?.videoService.setCameraOrientation(orientation: UIDevice.current.orientation, callID: nil) self?.videoService.setCameraOrientation(orientation: UIDevice.current.orientation, callID: nil)
self?.videoService.stopAudioDevice() self?.videoService.stopAudioDevice()
if #available(iOS 10.0, *), let call = self?.call { if #available(iOS 10.0, *), UIDevice.useCallKit(), let call = self?.call {
self?.callsProvider.stopCall(callUUID: call.callUUID) self?.callsProvider.stopCall(callUUID: call.callUUID)
} }
} }
...@@ -356,7 +356,7 @@ class CallViewModel: Stateable, ViewModel { ...@@ -356,7 +356,7 @@ class CallViewModel: Stateable, ViewModel {
guard let call = self.call else { guard let call = self.call else {
return return
} }
if #available(iOS 10.0, *), stopProvider { if #available(iOS 10.0, *), UIDevice.useCallKit(), stopProvider {
self.callsProvider.stopCall(callUUID: call.callUUID) self.callsProvider.stopCall(callUUID: call.callUUID)
} }
self.callService.hangUp(callId: call.callId) self.callService.hangUp(callId: call.callId)
...@@ -394,7 +394,7 @@ class CallViewModel: Stateable, ViewModel { ...@@ -394,7 +394,7 @@ class CallViewModel: Stateable, ViewModel {
.subscribe(onSuccess: { [weak self] callModel in .subscribe(onSuccess: { [weak self] callModel in
callModel.callUUID = UUID() callModel.callUUID = UUID()
self?.call = callModel self?.call = callModel
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
self?.callsProvider self?.callsProvider
.startCall(account: account, call: callModel) .startCall(account: account, call: callModel)
} }
......
...@@ -97,4 +97,11 @@ public extension UIDevice { ...@@ -97,4 +97,11 @@ public extension UIDevice {
return mapToDevice(identifier: identifier) return mapToDevice(identifier: identifier)
}() }()
static func useCallKit() -> Bool {
guard let regionCode = Locale.current.regionCode else {return false}
if regionCode.contains("CN") || regionCode.contains("CHN") || regionCode.contains("MO") || regionCode.contains("HK") {
return false
}
return true
}
} }
...@@ -104,7 +104,7 @@ class ConversationsCoordinator: Coordinator, StateableResponsive, ConversationNa ...@@ -104,7 +104,7 @@ class ConversationsCoordinator: Coordinator, StateableResponsive, ConversationNa
callViewController.viewModel.call = call callViewController.viewModel.call = call
var tempBag = DisposeBag() var tempBag = DisposeBag()
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
call.callUUID = UUID() call.callUUID = UUID()
callsProvider callsProvider
.reportIncomingCall(account: account, call: call) { _ in .reportIncomingCall(account: account, call: call) { _ in
......
...@@ -405,7 +405,7 @@ class AccountsService: AccountAdapterDelegate { ...@@ -405,7 +405,7 @@ class AccountsService: AccountAdapterDelegate {
func setDetails(forAccountId accountId: String) { func setDetails(forAccountId accountId: String) {
let details = self.getAccountDetails(fromAccountId: accountId) let details = self.getAccountDetails(fromAccountId: accountId)
var filename = "default.wav" var filename = "default.wav"
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
filename = "" filename = ""
} }
if details if details
......
...@@ -34,7 +34,7 @@ class CallsProviderDelegate: NSObject { ...@@ -34,7 +34,7 @@ class CallsProviderDelegate: NSObject {
override init() { override init() {
self.sharedResponseStream = responseStream.share() self.sharedResponseStream = responseStream.share()
super.init() super.init()
if #available(iOS 10.0, *) { if #available(iOS 10.0, *), UIDevice.useCallKit() {
let providerConfiguration = CXProviderConfiguration(localizedName: "Jami") let providerConfiguration = CXProviderConfiguration(localizedName: "Jami")
providerConfiguration.supportsVideo = true providerConfiguration.supportsVideo = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment