@nativescript-community/perms
Version:
An unified permissions API for NativeScript on iOS and Android.
29 lines • 1.13 kB
JavaScript
import { Trace } from '@nativescript/core';
export const PermsTraceCategory = 'NativescriptPerms';
export var Status;
(function (Status) {
Status["Undetermined"] = "undetermined";
Status["Denied"] = "denied";
Status["Authorized"] = "authorized";
Status["Limited"] = "limited";
Status["Restricted"] = "restricted";
Status["NeverAskAgain"] = "never_ask_again";
})(Status || (Status = {}));
export var CLogTypes;
(function (CLogTypes) {
CLogTypes[CLogTypes["log"] = 0] = "log";
CLogTypes[CLogTypes["info"] = 1] = "info";
CLogTypes[CLogTypes["warning"] = 2] = "warning";
CLogTypes[CLogTypes["error"] = 3] = "error";
})(CLogTypes || (CLogTypes = {}));
export const CLog = (type, ...args) => {
Trace.write(args.map((a) => (a && typeof a === 'object' ? JSON.stringify(a) : a)).join(' '), PermsTraceCategory, type);
};
export function isPermResultAuthorized(r) {
if (typeof r === 'object') {
const unauthorized = Object.keys(r).some((s) => r[s] !== Status.Authorized);
return !unauthorized;
}
return r === Status.Authorized;
}
//# sourceMappingURL=index.common.js.map