|
@@ -10,6 +10,7 @@ import android.support.v4.content.PermissionChecker;
|
10
|
10
|
|
11
|
11
|
import com.facebook.react.bridge.Callback;
|
12
|
12
|
import com.facebook.react.bridge.Promise;
|
|
13
|
+import com.facebook.react.bridge.PromiseImpl;
|
13
|
14
|
import com.facebook.react.bridge.ReactApplicationContext;
|
14
|
15
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
15
|
16
|
import com.facebook.react.bridge.ReactMethod;
|
|
@@ -79,13 +80,19 @@ public class ReactNativePermissionsModule extends ReactContextBaseJavaModule {
|
79
|
80
|
@ReactMethod
|
80
|
81
|
public void requestPermission(final String permissionString, String nullForiOSCompat, final Promise promise) {
|
81
|
82
|
String permission = permissionForString(permissionString);
|
82
|
|
- mPermissionsModule.requestPermission(permission, new Callback() {
|
|
83
|
+ Callback resolve = new Callback() {
|
83
|
84
|
@Override
|
84
|
85
|
public void invoke(Object... args) {
|
85
|
86
|
getPermissionStatus(permissionString, promise);
|
86
|
|
-// promise.resolve((boolean)args[1] ? "authorized" : "denied");
|
87
|
87
|
}
|
88
|
|
- }, null);
|
|
88
|
+ };
|
|
89
|
+ Callback reject = new Callback() {
|
|
90
|
+ @Override
|
|
91
|
+ public void invoke(Object... args) {
|
|
92
|
+ // NOOP
|
|
93
|
+ }
|
|
94
|
+ };
|
|
95
|
+ mPermissionsModule.requestPermission(permission, new PromiseImpl(resolve, reject));
|
89
|
96
|
}
|
90
|
97
|
|
91
|
98
|
|