From d9d715a2dc2081dd53897554f4adc4eb86e38cf4 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Fri, 15 Jun 2018 12:07:29 +0200 Subject: [PATCH] return GRANTED or DENIED instead of booleans --- .../react/modules/permissions/PermissionsModule.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java index 0b943bc6c08e7d..26701edd94cda7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java @@ -86,9 +86,9 @@ public void shouldShowRequestPermissionRationale(final String permission, final } /** - * Request the given permission. successCallback is called with true if the permission had been - * granted, false otherwise. For devices before Android M, this instead checks if the user has - * the permission given or not. + * Request the given permission. successCallback is called with GRANTED if the permission had been + * granted, DENIED or NEVER_ASK_AGAIN otherwise. For devices before Android M, this checks if the user has + * the permission given or not and resolves with GRANTED or DENIED. * See {@link Activity#checkSelfPermission}. */ @ReactMethod @@ -96,7 +96,7 @@ public void requestPermission(final String permission, final Promise promise) { Context context = getReactApplicationContext().getBaseContext(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { promise.resolve(context.checkPermission(permission, Process.myPid(), Process.myUid()) == - PackageManager.PERMISSION_GRANTED); + PackageManager.PERMISSION_GRANTED ? GRANTED : DENIED); return; } if (context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {