Browse Source

added method to open settings. bump!

Yonah Forst 8 years ago
parent
commit
ed0003c71e
2 changed files with 10 additions and 1 deletions
  1. 9
    0
      ReactNativePermissions.m
  2. 1
    1
      package.json

+ 9
- 0
ReactNativePermissions.m View File

@@ -47,6 +47,15 @@ RCT_EXPORT_MODULE();
47 47
               @"StatusRestricted" : @(RNPermissionsStatusRestricted)};
48 48
 };
49 49
 
50
+RCT_EXPORT_METHOD(openSettings)
51
+{
52
+    BOOL canOpenSettings = (&UIApplicationOpenSettingsURLString != NULL);
53
+    if (canOpenSettings) {
54
+        NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
55
+        [[UIApplication sharedApplication] openURL:url];
56
+    }
57
+}
58
+
50 59
 
51 60
 RCT_REMAP_METHOD(locationPermissionStatus, locationPermission:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
52 61
 {

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-permissions",
3
-  "version": "0.0.1",
3
+  "version": "0.0.2",
4 4
   "repository": {
5 5
     "type": "git",
6 6
     "url": "https://github.com/joshblour/react-native-permissions.git"