cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nikhilkh <...@git.apache.org>
Subject [GitHub] cordova-android pull request: Current Cordova-Android 5.0 changes.
Date Thu, 24 Sep 2015 23:46:44 GMT
Github user nikhilkh commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/220#discussion_r40386990
  
    --- Diff: framework/src/org/apache/cordova/CordovaInterfaceImpl.java ---
    @@ -161,4 +164,35 @@ public ActivityResultHolder(int requestCode, int resultCode, Intent
intent) {
                 this.intent = intent;
             }
         }
    +
    +    /**
    +     * Called by the system when the user grants permissions
    +     *
    +     * @param requestCode
    +     * @param permissions
    +     * @param grantResults
    +     */
    +    public void onRequestPermissionResult(int requestCode, String[] permissions,
    +                                          int[] grantResults) throws JSONException {
    +        if(permissionResultCallback != null)
    +        {
    +            permissionResultCallback.onRequestPermissionResult(requestCode, permissions,
grantResults);
    +            permissionResultCallback = null;
    +        }
    +    }
    +
    +    public void requestPermission(CordovaPlugin plugin, int requestCode, String permission)
{
    +        permissionResultCallback = plugin;
    +        String[] permissions = new String [1];
    +        permissions[0] = permission;
    +        getActivity().requestPermissions(permissions, requestCode);
    +    }
    +
    +    public void requestPermissions(CordovaPlugin plugin, int requestCode)
    +    {
    +        permissionResultCallback = plugin;
    +        String[] permissions = plugin.getPermissionRequest();
    --- End diff --
    
    It's kinda odd to have the permission array not being passed along instead we invoking
a callback on plugin to get the permissions. Passing the permissions array would be a simpler
design.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message