[expo] Update Permission typings to match SDK31 docs

This commit is contained in:
Bartosz Dotryw
2018-12-21 04:31:20 +01:00
parent 37c37a0e2a
commit 249ac80428
2 changed files with 15 additions and 11 deletions
+2 -3
View File
@@ -695,13 +695,12 @@ Permissions.CAMERA === 'camera';
Permissions.CAMERA_ROLL === 'cameraRoll';
Permissions.AUDIO_RECORDING === 'audioRecording';
Permissions.CONTACTS === 'contacts';
Permissions.NOTIFICATIONS === 'remoteNotifications';
Permissions.REMOTE_NOTIFICATIONS === 'remoteNotifications';
Permissions.NOTIFICATIONS === 'notifications';
Permissions.SYSTEM_BRIGHTNESS === 'systemBrightness';
Permissions.USER_FACING_NOTIFICATIONS === 'userFacingNotifications';
Permissions.REMINDERS === 'reminders';
async () => {
const result = await Permissions.askAsync(Permissions.CAMERA);
const result = await Permissions.askAsync(Permissions.CAMERA, Permissions.CONTACTS);
result.status === 'granted';
result.status === 'denied';
+13 -8
View File
@@ -1905,7 +1905,7 @@ export namespace Pedometer {
export namespace Permissions {
type PermissionType = 'audioRecording' | 'calendar' |
'cameraRoll' | 'camera' | 'contacts' | 'location' | 'reminders' |
'remoteNotifications' | 'systemBrightness' | 'userFacingNotifications';
'notifications' | 'systemBrightness' | 'userFacingNotifications';
type PermissionStatus = 'undetermined' | 'granted' | 'denied';
type PermissionExpires = 'never';
@@ -1917,17 +1917,23 @@ export namespace Permissions {
scope: 'fine' | 'coarse' | 'none';
}
interface PermissionResponse {
interface SinglePermissionResponse {
status: PermissionStatus;
expires: PermissionExpires;
ios?: PermissionDetailsLocationIOS;
android?: PermissionDetailsLocationAndroid;
}
function getAsync(type: PermissionType): Promise<PermissionResponse>;
function askAsync(type: PermissionType): Promise<PermissionResponse>;
interface PermissionResponse {
status: PermissionStatus;
expires: PermissionExpires;
permissions: {
[key in PermissionType]: SinglePermissionResponse
};
}
type RemoteNotificationPermission = 'remoteNotifications';
function getAsync(...permissionTypes: PermissionType[]): Promise<PermissionResponse>;
function askAsync(...permissionTypes: PermissionType[]): Promise<PermissionResponse>;
const AUDIO_RECORDING: 'audioRecording';
const CALENDAR: 'calendar';
@@ -1935,9 +1941,8 @@ export namespace Permissions {
const CAMERA: 'camera';
const CONTACTS: 'contacts';
const LOCATION: 'location';
const NOTIFICATIONS: RemoteNotificationPermission;
const REMINDERS = 'reminders';
const REMOTE_NOTIFICATIONS: RemoteNotificationPermission;
const NOTIFICATIONS: 'notifications';
const REMINDERS: 'reminders';
const SYSTEM_BRIGHTNESS: 'systemBrightness';
const USER_FACING_NOTIFICATIONS = 'userFacingNotifications';
}