UNPKG

@btfuse/core

Version:

A native-first framework for building hybdrid web-native applications

42 lines (41 loc) 2.03 kB
import { ContentType } from './ContentType'; import { TAPIBridgeFunction } from './FusePlugin'; import { IFusePermissionRequest } from './IFusePermissionRequest'; import { TFuseSerializable } from './TSerializable'; import { FusePermissionGrantResult } from './FusePermissionGrantResult'; /** * Invoked to handle when permission justification is necessary. * * This is an android concept, so it will only be invoked on Android devices, * as iOS has justification text embedded into the actual permission prompt. * * User dialog should be displayed to explain why the app wants to use the permission. * Android recommends giving the user the ability to accept or deny at this time, if the user deny, * then resolve the promise will false. * * Return true if the permission request should proceed. */ export type TFuseJustificationHandler = () => Promise<boolean>; interface __IPermissionRequestArguments<T extends number> { permissionSet: T[]; isJustified: boolean; } export type TFusePermissionRequestArguments<T extends number> = TFuseSerializable<__IPermissionRequestArguments<T>>; export type TFuseAPIPermissionRequest<T extends number = number> = TAPIBridgeFunction<ContentType.JSON, TFusePermissionRequestArguments<T>>; /** * Abstract class to handle permission request. * Concrete classes should implement the protected _request method to call on their * permission request Fuse API. */ export declare class FusePermissionRequest<TSupportedPermission extends number> implements IFusePermissionRequest<TSupportedPermission> { private static readonly TAG; private $api; private $permissionSet; private $justificationHandler; constructor(apiBridge: TFuseAPIPermissionRequest<TSupportedPermission>, permissionSet: TSupportedPermission[], justificationHandler?: TFuseJustificationHandler); getPermissionSet(): TSupportedPermission[]; private $request; private $onJustificationRequest; request(): Promise<FusePermissionGrantResult<TSupportedPermission>>; } export {};