mirror of
https://github.com/zhigang1992/react-native-notifications.git
synced 2026-06-11 16:29:42 +08:00
Rename setBadgesCount to setBadgeCount
This commit is contained in:
@@ -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);
|
||||
```
|
||||
|
||||
@@ -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);
|
||||
```
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export class NotificationsIOS {
|
||||
}
|
||||
|
||||
/**
|
||||
* getBadgesCount
|
||||
* getBadgeCount
|
||||
*/
|
||||
public getBadgeCount(): Promise<number> {
|
||||
return this.commands.getBadgeCount();
|
||||
|
||||
Reference in New Issue
Block a user