Files
react-native/Libraries/PermissionsAndroid/NativePermissionsAndroid.js
T
Connor Tumbleson 2bcc6fac38 feat: add Android 12 BLUETOOTH_ADVERTISE to PermissionsAndroid (#32079)
Summary:
This PR adds BLUETOOTH_ADVERTISE, which showed up in the latest Android 12 Beta build as new `dangerous` permissions requiring approval for them.

https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_ADVERTISE

You can see the new set of `SCAN/ADVERTISE/CONNECT` added in this doc - https://developer.android.com/about/versions/12/features/bluetooth-permissions, previously SCAN/CONNECT were added in: https://github.com/facebook/react-native/pull/31488

## Changelog

[Android] [Changed] - Add BLUETOOTH_ADVERTISE to PermissionsAndroid

Pull Request resolved: https://github.com/facebook/react-native/pull/32079

Test Plan:
```
PermissionsAndroid.BLUETOOTH_ADVERTISE === 'android.permission.BLUETOOTH_ADVERTISE'
```

Reviewed By: cortinico

Differential Revision: D30532656

Pulled By: yungsters

fbshipit-source-id: 986ad8cbfc27913df13ab24bba36f6e13104e7d9
2021-08-25 12:46:44 -07:00

62 lines
2.2 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict
*/
import type {TurboModule} from '../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
// TODO: Use proper enum types.
export type PermissionStatus = string;
export type PermissionType = string;
/*
export type PermissionStatus = 'granted' | 'denied' | 'never_ask_again';
export type PermissionType =
| 'android.permission.READ_CALENDAR'
| 'android.permission.WRITE_CALENDAR'
| 'android.permission.CAMERA'
| 'android.permission.READ_CONTACTS'
| 'android.permission.WRITE_CONTACTS'
| 'android.permission.GET_ACCOUNTS'
| 'android.permission.ACCESS_BACKGROUND_LOCATION'
| 'android.permission.ACCESS_FINE_LOCATION'
| 'android.permission.ACCESS_COARSE_LOCATION'
| 'android.permission.RECORD_AUDIO'
| 'android.permission.READ_PHONE_STATE'
| 'android.permission.CALL_PHONE'
| 'android.permission.READ_CALL_LOG'
| 'android.permission.WRITE_CALL_LOG'
| 'com.android.voicemail.permission.ADD_VOICEMAIL'
| 'android.permission.USE_SIP'
| 'android.permission.PROCESS_OUTGOING_CALLS'
| 'android.permission.BODY_SENSORS'
| 'android.permission.SEND_SMS'
| 'android.permission.RECEIVE_SMS'
| 'android.permission.READ_SMS'
| 'android.permission.RECEIVE_WAP_PUSH'
| 'android.permission.RECEIVE_MMS'
| 'android.permission.READ_EXTERNAL_STORAGE'
| 'android.permission.WRITE_EXTERNAL_STORAGE'
| 'android.permission.BLUETOOTH_CONNECT'
| 'android.permission.BLUETOOTH_SCAN'
| 'android.permission.BLUETOOTH_ADVERTISE';
*/
export interface Spec extends TurboModule {
+checkPermission: (permission: PermissionType) => Promise<boolean>;
+requestPermission: (permission: PermissionType) => Promise<PermissionStatus>;
+shouldShowRequestPermissionRationale: (
permission: string,
) => Promise<boolean>;
+requestMultiplePermissions: (
permissions: Array<PermissionType>,
) => Promise<{[permission: PermissionType]: PermissionStatus, ...}>;
}
export default (TurboModuleRegistry.get<Spec>('PermissionsAndroid'): ?Spec);