Skip to content

Commit 1e08069

Browse files
committed
Make requestNotifications options optional
1 parent c513c50 commit 1e08069

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ The `rationale` is only available and used on Android. It can be a native alert
755755

756756
```ts
757757
function requestNotifications(
758-
options: NotificationOption[], // only used by iOS
758+
options?: NotificationOption[], // only used by iOS
759759
rationale?: Rationale,
760760
): Promise<NotificationsResponse>;
761761
```

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ PODS:
15751575
- React-logger (= 0.76.2)
15761576
- React-perflogger (= 0.76.2)
15771577
- React-utils (= 0.76.2)
1578-
- RNPermissions (5.2.2):
1578+
- RNPermissions (5.2.3):
15791579
- DoubleConversion
15801580
- glog
15811581
- hermes-engine
@@ -1893,7 +1893,7 @@ SPEC CHECKSUMS:
18931893
React-utils: c8c0c746031419a29cfd8c72a394fdeac0684a84
18941894
ReactCodegen: a64e8f3a8bba0ecf88fce06c2874e021d55148f3
18951895
ReactCommon: 7b9403030ff3430ccffed63cd25c8aeab2a3ea7e
1896-
RNPermissions: 58daf8003d82766ca706ec9b19b7e54d74b5e4f4
1896+
RNPermissions: dd5cd0b304f83156d217b43564bb348d91b10d6a
18971897
RNVectorIcons: a24016b773380b1aa37fca501ec6b94a951890a0
18981898
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
18991899
Yoga: 96872ee462cfc43866ad013c8160d4ff6b85709b

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-permissions",
3-
"version": "5.2.2",
3+
"version": "5.2.3",
44
"license": "MIT",
55
"description": "An unified permissions API for React Native on iOS, Android and Windows",
66
"author": "Mathieu Acthernoene <[email protected]>",

src/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type Contract = {
2424
permissions: P,
2525
): Promise<Record<P[number], PermissionStatus>>;
2626
requestNotifications(
27-
options: NotificationOption[],
27+
options?: NotificationOption[],
2828
rationale?: Rationale,
2929
): Promise<NotificationsResponse>;
3030
};

src/methods.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const checkNotifications: Contract['checkNotifications'] = async () => {
7070
}
7171
};
7272

73-
const requestNotifications: Contract['requestNotifications'] = async (options, rationale) => {
73+
const requestNotifications: Contract['requestNotifications'] = async (options = [], rationale) => {
7474
if (USES_LEGACY_NOTIFICATIONS) {
7575
const response = (await NativeModule.requestNotifications(options)) as NotificationsResponse;
7676
return response;

src/methods.ios.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ const checkNotifications: Contract['checkNotifications'] = async () => {
3737
return response;
3838
};
3939

40-
const requestNotifications: Contract['requestNotifications'] = async (options) => {
40+
const requestNotifications: Contract['requestNotifications'] = async (
41+
options = ['alert', 'badge', 'sound'],
42+
) => {
4143
const response = (await NativeModule.requestNotifications(options)) as NotificationsResponse;
4244
return response;
4345
};

0 commit comments

Comments
 (0)