From 7bdbb4cdc866c25f4736d04008ddbf023833236a Mon Sep 17 00:00:00 2001 From: Nick Redmond Date: Thu, 20 Apr 2017 11:15:56 -0700 Subject: [PATCH] react-native: Update PermissionsAndroid types --- types/react-native/index.d.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 6080851f38..3cf16334d5 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -7016,28 +7016,42 @@ export type Permission = "android.permission.READ_EXTERNAL_STORAGE" | "android.permission.WRITE_EXTERNAL_STORAGE" +export type PermissionStatus = "granted" | "denied" | "never_ask_again" + export interface PermissionsAndroidStatic { + /** + * A list of permission results that are returned + */ + RESULTS: {[key: string]: PermissionStatus} /** * A list of specified "dangerous" permissions that require prompting the user */ PERMISSIONS: {[key: string]: Permission} new(): PermissionsAndroidStatic /** - * Returns a promise resolving to a boolean value as to whether the specified - * permissions has been granted + * Deprecated */ checkPermission(permission: Permission): Promise + /** + * Returns a promise resolving to a boolean value as to whether the specified + * permissions has been granted + */ + check(permission: Permission): Promise + /** + * Deprecated + */ + requestPermission(permission: Permission, rationale?: Rationale): Promise /** * Prompts the user to enable a permission and returns a promise resolving to a - * boolean value indicating whether the user allowed or denied the request + * string value indicating whether the user allowed or denied the request * * If the optional rationale argument is included (which is an object with a - * `title` and `message`), this function checks with the OS whether it is - * necessary to show a dialog explaining why the permission is needed + * title and message), this function checks with the OS whether it is necessary + * to show a dialog explaining why the permission is needed * (https://developer.android.com/training/permissions/requesting.html#explain) * and then shows the system permission dialog */ - requestPermission(permission: Permission, rationale?: Rationale): Promise + request(permission: Permission, rationale?: Rationale): Promise } export interface PushNotificationPermissions {