Rename setBadgesCount to setBadgeCount

This commit is contained in:
yogevbd
2020-01-13 19:16:12 +02:00
parent 1509072bf9
commit b634cb3343
6 changed files with 15 additions and 15 deletions

View File

@@ -152,14 +152,14 @@ The [example app](https://github.com/wix/react-native-notifications/tree/master/
Get the current number:
```javascript
Notifications.ios.getBadgesCount((count) => console.log(count));
Notifications.ios.getBadgeCount((count) => console.log(count));
```
Set to specific number:
```javascript
Notifications.ios.setBadgesCount(2);
Notifications.ios.setBadgeCount(2);
```
Clear badges icon:
```javascript
Notifications.ios.setBadgesCount(0);
Notifications.ios.setBadgeCount(0);
```

View File

@@ -238,14 +238,14 @@ The [example app](https://github.com/wix/react-native-notifications/tree/master/
Get the current number:
```javascript
NotificationsIOS.getBadgesCount((count) => console.log(count));
NotificationsIOS.getBadgeCount((count) => console.log(count));
```
Set to specific number:
```javascript
NotificationsIOS.setBadgesCount(2);
NotificationsIOS.setBadgeCount(2);
```
Clear badges icon:
```javascript
NotificationsIOS.setBadgesCount(0);
NotificationsIOS.setBadgeCount(0);
```

View File

@@ -60,12 +60,12 @@ RCT_EXPORT_METHOD(registerPushKit) {
[_commandsHandler registerPushKit];
}
RCT_EXPORT_METHOD(getBadgesCount:(RCTResponseSenderBlock)callback) {
[_commandsHandler getBadgesCount:callback];
RCT_EXPORT_METHOD(getBadgeCount:(RCTResponseSenderBlock)callback) {
[_commandsHandler getBadgeCount:callback];
}
RCT_EXPORT_METHOD(setBadgesCount:(int)count) {
[_commandsHandler setBadgesCount:count];
RCT_EXPORT_METHOD(setBadgeCount:(int)count) {
[_commandsHandler setBadgeCount:count];
}
RCT_EXPORT_METHOD(postLocalNotification:(NSDictionary *)notification withId:(nonnull NSNumber *)notificationId) {

View File

@@ -19,9 +19,9 @@
- (void)registerPushKit;
- (void)getBadgesCount:(RCTResponseSenderBlock)callback;
- (void)getBadgeCount:(RCTResponseSenderBlock)callback;
- (void)setBadgesCount:(int)count;
- (void)setBadgeCount:(int)count;
- (void)postLocalNotification:(NSDictionary *)notification withId:(NSNumber *)notificationId;

View File

@@ -41,12 +41,12 @@
[RNNotifications startMonitorPushKitNotifications];
}
- (void)getBadgesCount:(RCTResponseSenderBlock)callback {
- (void)getBadgeCount:(RCTResponseSenderBlock)callback {
NSInteger count = [UIApplication sharedApplication].applicationIconBadgeNumber;
callback(@[ [NSNumber numberWithInteger:count] ]);
}
- (void)setBadgesCount:(int)count {
- (void)setBadgeCount:(int)count {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
}

View File

@@ -38,7 +38,7 @@ export class NotificationsIOS {
}
/**
* getBadgesCount
* getBadgeCount
*/
public getBadgeCount(): Promise<number> {
return this.commands.getBadgeCount();