瀏覽代碼

added method to open settings. bump!

Yonah Forst 8 年之前
父節點
當前提交
ed0003c71e
共有 2 個檔案被更改,包括 10 行新增1 行删除
  1. 9
    0
      ReactNativePermissions.m
  2. 1
    1
      package.json

+ 9
- 0
ReactNativePermissions.m 查看文件

@@ -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 查看文件

@@ -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"