Skip to content

Commit

Permalink
Revert "add switchToLocationSettings to iOS".
Browse files Browse the repository at this point in the history
This reverts commit 74e1d97.
Resolves #262.
  • Loading branch information
dpa99c committed Dec 21, 2017
1 parent c201c21 commit 7f5bae2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 49 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Cordova diagnostic plugin [![Latest Stable Version](https://img.shields.io/npm/v
- [isWifiEnabled()](#iswifienabled)
- [isCameraAvailable()](#iscameraavailable)
- [isBluetoothAvailable()](#isbluetoothavailable)
- [switchToLocationSettings()](#switchtolocationsettings)
- [Android and Windows 10 Mobile only](#android-and-windows-10-mobile-only)
- [switchToLocationSettings()](#switchtolocationsettings)
- [switchToMobileDataSettings()](#switchtomobiledatasettings)
- [switchToBluetoothSettings()](#switchtobluetoothsettings)
- [switchToWifiSettings()](#switchtowifisettings)
Expand Down Expand Up @@ -422,6 +422,8 @@ This callback function is passed a single string parameter containing the error
console.error("The following error occurred: "+error);
});

## Android and Windows 10 Mobile only

### switchToLocationSettings()

Displays the device location settings to allow user to enable location services/change location mode.
Expand All @@ -430,8 +432,6 @@ Displays the device location settings to allow user to enable location services/

Note: On Android, you may want to consider using the [Request Location Accuracy Plugin for Android](https://github.com/dpa99c/cordova-plugin-request-location-accuracy) to request the desired location accuracy without needing the user to manually do this on the Location Settings page.

## Android and Windows 10 Mobile only

### switchToMobileDataSettings()

Displays mobile settings to allow user to enable mobile data.
Expand Down
1 change: 0 additions & 1 deletion src/ios/Diagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
- (void) isRegisteredForRemoteNotifications: (CDVInvokedUrlCommand*)command;

- (void) switchToSettings: (CDVInvokedUrlCommand*)command;
- (void) switchToLocationSettings: (CDVInvokedUrlCommand*)command;

- (void) isMicrophoneAuthorized: (CDVInvokedUrlCommand*)command;
- (void) getMicrophoneAuthorizationStatus: (CDVInvokedUrlCommand*)command;
Expand Down
29 changes: 0 additions & 29 deletions src/ios/Diagnostic.m
Original file line number Diff line number Diff line change
Expand Up @@ -339,35 +339,6 @@ - (void) switchToSettings: (CDVInvokedUrlCommand*)command
}
}

- (void) switchToLocationSettings: (CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult;
@try {
if (UIApplicationOpenSettingsURLString != nil){
NSURL *url;

#if __IPHONE_OS_VERSION_MAX_ALLOWED <= __IPHONE_8_0
url = [NSURL URLWithString: @"prefs:root=LOCATION_SERVICES"];
#else
url = [NSURL URLWithString: @"App-Prefs:root=Privacy&path=LOCATION"];
#endif

if (![[UIApplication sharedApplication] canOpenURL:url]) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Cannot open phone settings, check the URL schema for iOS 11"];
}else{
[[UIApplication sharedApplication] openURL:url];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
}
}else{
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Not supported below iOS 8"];
}
}
@catch (NSException *exception) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:exception.reason];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

#pragma mark - Audio
- (void) isMicrophoneAuthorized: (CDVInvokedUrlCommand*)command
{
Expand Down
16 changes: 0 additions & 16 deletions www/ios/diagnostic.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,6 @@ var Diagnostic = (function(){
[]);
};

/**
* Switch to location settings
*
* @param {Function} successCallback - The callback which will be called when switch to settings is successful.
* @param {Function} errorCallback - The callback which will be called when switch to settings encounters an error.
* This callback function is passed a single string parameter containing the error message.
* This works only on iOS 8+. iOS 7 and below will invoke the errorCallback.
*/
Diagnostic.switchToLocationSettings = function(successCallback, errorCallback) {
return cordova.exec(successCallback,
errorCallback,
'Diagnostic',
'switchToLocationSettings',
[]);
};

/************
* Location *
************/
Expand Down

0 comments on commit 7f5bae2

Please sign in to comment.