Commit 71482400 by Sebastian Roth

Cleanup iOS version for phone service status & document.

parent d06ed39e
...@@ -36,22 +36,16 @@ ...@@ -36,22 +36,16 @@
* Returns YES if the device can place a phone call * Returns YES if the device can place a phone call
*/ */
// Check if the device can place a phone call // Device supports phone calls, lets confirm it can place one right now
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]]) { CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
// Device supports phone calls, lets confirm it can place one right now CTCarrier *carrier = [netInfo subscriberCellularProvider];
CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init]; NSString *mnc = [carrier mobileNetworkCode];
CTCarrier *carrier = [netInfo subscriberCellularProvider]; if (([mnc length] == 0) || ([mnc isEqualToString:@"65535"])) {
NSString *mnc = [carrier mobileNetworkCode]; // Device cannot place a call at this time. SIM might be removed.
if (([mnc length] == 0) || ([mnc isEqualToString:@"65535"])) { return NO;
// Device cannot place a call at this time. SIM might be removed.
return NO;
} else {
// Device can place a phone call
return YES;
}
} else { } else {
// Device does not support phone calls // Device can place a phone call
return NO; return YES;
} }
} }
......
...@@ -42,13 +42,20 @@ class PermissionHandler { ...@@ -42,13 +42,20 @@ class PermissionHandler {
/// Returns a [Future] containing the current service status for the supplied [PermissionGroup]. /// Returns a [Future] containing the current service status for the supplied [PermissionGroup].
/// ///
/// Notes about specific PermissionGroups: /// Notes about specific PermissionGroups:
/// - **PermissionGroup.phone** on Android: /// - **PermissionGroup.phone**
/// - The method will return [ServiceStatus.notApplicable] when: /// - Android:
/// 1. the device lacks the TELEPHONY feature /// - The method will return [ServiceStatus.notApplicable] when:
/// 1. TelephonyManager.getPhoneType() returns PHONE_TYPE_NONE /// 1. the device lacks the TELEPHONY feature
/// 1. when no Intents can be resolved to handle the `tel:` scheme /// 1. TelephonyManager.getPhoneType() returns PHONE_TYPE_NONE
/// - The method will return [ServiceStatus.disabled] when: /// 1. when no Intents can be resolved to handle the `tel:` scheme
/// 1. the SIM card is missing /// - The method will return [ServiceStatus.disabled] when:
/// 1. the SIM card is missing
/// - iOS:
/// - The method will return [ServiceStatus.notApplicable] when:
/// 1. the native code can not find a handler for the `tel:` scheme
/// - The method will return [ServiceStatus.disabled] when:
/// 1. the mobile network code (MNC) is either 0 or 65535. See
/// https://stackoverflow.com/a/11595365 for details
/// - **PLEASE NOTE that this is still not a perfect indication** of the /// - **PLEASE NOTE that this is still not a perfect indication** of the
/// devices' capability to place & connect phone calls /// devices' capability to place & connect phone calls
/// as it also depends on the network condition. /// as it also depends on the network condition.
......
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