public static PermissionRequestResult Create(string[] perms, bool[] isGranted)
        {
            PermissionRequestResult result = new PermissionRequestResult();

            result.permissions = new List <Tuple <string, bool> >();
            for (int i = 0; i < perms.Length; i++)
            {
                result.permissions.Add(new Tuple <string, bool>(perms[i], isGranted[i]));
            }

            return(result);
        }
Beispiel #2
0
        public IPromise <PermissionRequestResult> RequestPermissions(List <string> permissions)
        {
            logger.Log(Tag, "RequestPermissions: " + permissions.ToString());

            var result = new Promise <PermissionRequestResult>();

            Action <string[], bool[]> ResultHandler = null;

            ResultHandler = (string[] perms, bool[] isGranted) => {
                PermsWrapper.OnRequestPermissionsResultEvent -= ResultHandler;

                PermissionRequestResult permissionRequestResult = PermissionRequestResult.Create(perms, isGranted);
                result.Resolve(permissionRequestResult);
            };

            PermsWrapper.OnRequestPermissionsResultEvent += ResultHandler;

            return(result);
        }