Skip to content

Commit

Permalink
fix(push-notifications): make requestPermissions resolve if granted (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jul 7, 2023
1 parent 4872589 commit 798f788
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ public void checkPermissions(PluginCall call) {

@PluginMethod
public void requestPermissions(PluginCall call) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || getPermissionState(PUSH_NOTIFICATIONS) == PermissionState.GRANTED) {
JSObject permissionsResultJSON = new JSObject();
permissionsResultJSON.put("receive", "granted");
call.resolve(permissionsResultJSON);
} else {
if (getPermissionState(PUSH_NOTIFICATIONS) != PermissionState.GRANTED) {
requestPermissionForAlias(PUSH_NOTIFICATIONS, call, "permissionsCallback");
}
requestPermissionForAlias(PUSH_NOTIFICATIONS, call, "permissionsCallback");
}
}

Expand Down

0 comments on commit 798f788

Please sign in to comment.