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
} else {
self.unregisterVoipNotifications()
}
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
return
}
// reimit new call signal to show incoming call alert
......@@ -225,7 +225,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func applicationDidBecomeActive(_ application: UIApplication) {
self.clearBadgeNumber()
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
return
}
self.callService.checkForIncomingCall()
......@@ -487,7 +487,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
guard let handle = userActivity.startCallHandle else {
return false
}
......@@ -507,7 +507,7 @@ extension AppDelegate: PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
self.accountService.pushNotificationReceived(data: payload.dictionaryPayload)
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
return
}
if UIApplication.shared.applicationState != .active {
......
......@@ -112,7 +112,7 @@ class CallViewModel: Stateable, ViewModel {
if hide {
self?.videoService.setCameraOrientation(orientation: UIDevice.current.orientation, callID: nil)
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)
}
}
......@@ -356,7 +356,7 @@ class CallViewModel: Stateable, ViewModel {
guard let call = self.call else {
return
}
if #available(iOS 10.0, *), stopProvider {
if #available(iOS 10.0, *), UIDevice.useCallKit(), stopProvider {
self.callsProvider.stopCall(callUUID: call.callUUID)
}
self.callService.hangUp(callId: call.callId)
......@@ -394,7 +394,7 @@ class CallViewModel: Stateable, ViewModel {
.subscribe(onSuccess: { [weak self] callModel in
callModel.callUUID = UUID()
self?.call = callModel
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
self?.callsProvider
.startCall(account: account, call: callModel)
}
......
......@@ -97,4 +97,11 @@ public extension UIDevice {
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
callViewController.viewModel.call = call
var tempBag = DisposeBag()
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
call.callUUID = UUID()
callsProvider
.reportIncomingCall(account: account, call: call) { _ in
......
......@@ -405,7 +405,7 @@ class AccountsService: AccountAdapterDelegate {
func setDetails(forAccountId accountId: String) {
let details = self.getAccountDetails(fromAccountId: accountId)
var filename = "default.wav"
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
filename = ""
}
if details
......
......@@ -34,7 +34,7 @@ class CallsProviderDelegate: NSObject {
override init() {
self.sharedResponseStream = responseStream.share()
super.init()
if #available(iOS 10.0, *) {
if #available(iOS 10.0, *), UIDevice.useCallKit() {
let providerConfiguration = CXProviderConfiguration(localizedName: "Jami")
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