@nativescript-community/perms 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.common.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { MultiResult, Result } from '.';
1
2
  export declare const PermsTraceCategory = "NativescriptPerms";
2
3
  export declare enum CLogTypes {
3
4
  log = 0,
@@ -6,3 +7,4 @@ export declare enum CLogTypes {
6
7
  error = 3
7
8
  }
8
9
  export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
10
+ export declare function isPermResultAuthorized(r: MultiResult | Result): boolean;
package/index.common.js CHANGED
@@ -10,4 +10,13 @@ export var CLogTypes;
10
10
  export const CLog = (type, ...args) => {
11
11
  Trace.write(args.map((a) => (a && typeof a === 'object' ? JSON.stringify(a) : a)).join(' '), PermsTraceCategory, type);
12
12
  };
13
+ export function isPermResultAuthorized(r) {
14
+ if (Array.isArray(r)) {
15
+ return r[0] === 'authorized';
16
+ }
17
+ else {
18
+ const unauthorized = Object.keys(r).some((s) => r[s] !== 'authorized');
19
+ return !unauthorized;
20
+ }
21
+ }
13
22
  //# sourceMappingURL=index.common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.common.js","sourceRoot":"","sources":["../../src/perms/index.common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAEtD,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACjB,uCAA2B,CAAA;IAC3B,yCAA6B,CAAA;IAC7B,+CAAgC,CAAA;IAChC,2CAA+B,CAAA;AACnC,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAe,EAAE,GAAG,IAAI,EAAE,EAAE;IAC7C,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC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,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC;QACvE,OAAO,CAAC,YAAY,CAAC;KACxB;AACL,CAAC"}
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable @typescript-eslint/unified-signatures */
2
2
  /* eslint-disable no-redeclare */
3
3
  export type Status = 'authorized' | 'denied' | 'limited' | 'restricted' | 'undetermined' | 'never_ask_again';
4
- export const PermsTraceCategory = 'NativescriptPerms';
4
+
5
+ export * from './index.common';
5
6
 
6
7
  export type AndroidPermissions<T = Exclude<keyof typeof android.Manifest.permission, keyof typeof java.lang.Object>> = {
7
8
  [K in keyof T]: T[K] extends string ? T : never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/perms",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "An unified permissions API for NativeScript on iOS and Android.",
5
5
  "main": "./index",
6
6
  "sideEffects": false,
@@ -32,5 +32,5 @@
32
32
  "license": "Apache-2.0",
33
33
  "homepage": "https://github.com/nativescript-community/perms",
34
34
  "readmeFilename": "README.md",
35
- "gitHead": "da10df4a27b3abe2da76db08ebe9002f84c1b9f5"
35
+ "gitHead": "f478a06d20b5a30423ddaf52619f11f8bb1e9a26"
36
36
  }