Merge branch 'charlesmchen/callkitLocale'

pull/2/head
Matthew Chen 6 years ago
commit a4c4ac9be4

@ -207,7 +207,9 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
selector:@selector(didToggleCallsHideIPAddressSwitch:)]];
[contents addSection:callingSection];
if (@available(iOS 11, *)) {
if (CallUIAdapter.isCallkitDisabledForLocale) {
// Hide all CallKit-related prefs; CallKit is disabled.
} else if (@available(iOS 11, *)) {
OWSTableSection *callKitSection = [OWSTableSection new];
[callKitSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(

@ -100,6 +100,9 @@ extension CallUIAdaptee {
// So we use the non-CallKit call UI.
Logger.info("choosing non-callkit adaptee for simulator.")
adaptee = NonCallKitCallUIAdaptee(callService: callService, notificationPresenter: notificationPresenter)
} else if CallUIAdapter.isCallkitDisabledForLocale {
Logger.info("choosing non-callkit adaptee due to locale.")
adaptee = NonCallKitCallUIAdaptee(callService: callService, notificationPresenter: notificationPresenter)
} else if #available(iOS 11, *) {
Logger.info("choosing callkit adaptee for iOS11+")
let showNames = Environment.shared.preferences.notificationPreviewType() != .noNameNoPreview
@ -129,6 +132,22 @@ extension CallUIAdaptee {
callService.addObserverAndSyncState(observer: self)
}
@objc
public static var isCallkitDisabledForLocale: Bool {
let locale = Locale.current
guard let regionCode = locale.regionCode else {
owsFailDebug("Missing region code.")
return false
}
// Apple has stopped approving apps that use CallKit functionality in mainland China.
// When the "CN" region is enabled, this check simply switches to the same pre-CallKit
// interface that is still used by everyone on iOS 9.
//
// For further reference: https://forums.developer.apple.com/thread/103083
return regionCode == "CN"
}
// MARK: Dependencies
var audioSession: OWSAudioSession {

Loading…
Cancel
Save