Skip to content

Commit

Permalink
feat: Add permission introduced in Android 13 (#33471)
Browse files Browse the repository at this point in the history
Summary:
Android 13 introduces two new permission,
- [NEARBY_WIFI_DEVICES](https://developer.android.com/about/versions/13/features/nearby-wifi-devices-permission) for scanning nearby wifi devices.
- [POST_NOTIFICATIONS](https://developer.android.com/about/versions/13/changes/notification-permission) for posting notifications.

This PR adds all the new permission (as of this PR creation) in Android 13.

## Changelog

[Android] [Added] - Add POST_NOTIFICATIONS, NEARBY_WIFI_DEVICES permission

Pull Request resolved: #33471

Test Plan:
```
PermissionsAndroid.POST_NOTIFICATIONS === 'android.permission.POST_NOTIFICATIONS'
PermissionsAndroid.NEARBY_WIFI_DEVICES === 'android.permission.NEARBY_WIFI_DEVICES'
```

Reviewed By: cortinico

Differential Revision: D35080683

Pulled By: GijsWeterings

fbshipit-source-id: cd5ba7f519feb77f939d5076ef414a01357329ab
  • Loading branch information
vincent-paing authored and facebook-github-bot committed Jun 1, 2022
1 parent 92ebb29 commit 0a854c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Libraries/PermissionsAndroid/NativePermissionsAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ export type PermissionType =
| 'android.permission.USE_SIP'
| 'android.permission.PROCESS_OUTGOING_CALLS'
| 'android.permission.BODY_SENSORS'
| 'android.permission.BODY_SENSORS_BACKGROUND'
| '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.READ_MEDIA_IMAGES',
| 'android.permission.READ_MEDIA_VIDEO',
| 'android.permission.READ_MEDIA_AUDIO',
| 'android.permission.WRITE_EXTERNAL_STORAGE'
| 'android.permission.BLUETOOTH_CONNECT'
| 'android.permission.BLUETOOTH_SCAN'
Expand All @@ -50,7 +54,9 @@ export type PermissionType =
| 'android.permission.ACTIVITY_RECOGNITION'
| 'android.permission.ANSWER_PHONE_CALLS'
| 'android.permission.READ_PHONE_NUMBERS'
| 'android.permission.UWB_RANGING';
| 'android.permission.UWB_RANGING'
| 'android.permission.POST_NOTIFICATIONS'
| 'android.permission.NEARBY_WIFI_DEVICES';
*/

export interface Spec extends TurboModule {
Expand Down
12 changes: 12 additions & 0 deletions Libraries/PermissionsAndroid/PermissionsAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ const PERMISSIONS = Object.freeze({
USE_SIP: 'android.permission.USE_SIP',
PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS',
BODY_SENSORS: 'android.permission.BODY_SENSORS',
BODY_SENSORS_BACKGROUND: 'android.permission.BODY_SENSORS_BACKGROUND',
SEND_SMS: 'android.permission.SEND_SMS',
RECEIVE_SMS: 'android.permission.RECEIVE_SMS',
READ_SMS: 'android.permission.READ_SMS',
RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH',
RECEIVE_MMS: 'android.permission.RECEIVE_MMS',
READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE',
READ_MEDIA_IMAGES: 'android.permission.READ_MEDIA_IMAGES',
READ_MEDIA_VIDEO: 'android.permission.READ_MEDIA_VIDEO',
READ_MEDIA_AUDIO: 'android.permission.READ_MEDIA_AUDIO',
WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE',
BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT',
BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN',
Expand All @@ -68,6 +72,8 @@ const PERMISSIONS = Object.freeze({
ANSWER_PHONE_CALLS: 'android.permission.ANSWER_PHONE_CALLS',
READ_PHONE_NUMBERS: 'android.permission.READ_PHONE_NUMBERS',
UWB_RANGING: 'android.permission.UWB_RANGING',
POST_NOTIFICATION: 'android.permission.POST_NOTIFICATIONS',
NEARBY_WIFI_DEVICES: 'android.permission.NEARBY_WIFI_DEVICES',
});

/**
Expand All @@ -90,14 +96,20 @@ class PermissionsAndroid {
BLUETOOTH_CONNECT: string,
BLUETOOTH_SCAN: string,
BODY_SENSORS: string,
BODY_SENSORS_BACKGROUND: string,
CALL_PHONE: string,
CAMERA: string,
GET_ACCOUNTS: string,
NEARBY_WIFI_DEVICES: string,
POST_NOTIFICATION: string,
PROCESS_OUTGOING_CALLS: string,
READ_CALENDAR: string,
READ_CALL_LOG: string,
READ_CONTACTS: string,
READ_EXTERNAL_STORAGE: string,
READ_MEDIA_IMAGES: string,
READ_MEDIA_VIDEO: string,
READ_MEDIA_AUDIO: string,
READ_PHONE_NUMBERS: string,
READ_PHONE_STATE: string,
READ_SMS: string,
Expand Down

0 comments on commit 0a854c7

Please sign in to comment.