Skip to content

Commit

Permalink
expose provisional state (#756)
Browse files Browse the repository at this point in the history
* expose provisional state

* feederco:expose-interface

Co-authored-by: Daniel Eliraz <[email protected]>
  • Loading branch information
DanielEliraz and Daniel Eliraz authored Jul 13, 2021
1 parent c7e381e commit eb8a1c6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ PODS:
- React-cxxreact (= 0.62.2)
- React-jsi (= 0.62.2)
- React-jsinspector (0.62.2)
- react-native-notifications (3.4.2):
- react-native-notifications (4.0.0):
- React-Core
- React-RCTActionSheet (0.62.2):
- React-Core/RCTActionSheetHeaders (= 0.62.2)
Expand Down Expand Up @@ -354,7 +354,7 @@ SPEC CHECKSUMS:
React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161
React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
react-native-notifications: 51ed8167f70f01c5000ba81a4465ea98b4612e23
react-native-notifications: 18675bc9c976f9f23e722d4b150fcc30d06fc8fc
React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c
React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0
React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71
Expand All @@ -369,4 +369,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 9915be56de9d009ce5a3ab024f14f80ca53c9b92

COCOAPODS: 1.9.3
COCOAPODS: 1.10.1
1 change: 1 addition & 0 deletions lib/ios/RNNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ - (void)checkPermissions:(RCTPromiseResolveBlock)resolve {
if (@available(iOS 12.0, *)) {
allSettings[@"criticalAlert"] = [NSNumber numberWithBool:settings.criticalAlertSetting == UNNotificationSettingEnabled];
allSettings[@"providesAppNotificationSettings"] = [NSNumber numberWithBool:settings.providesAppNotificationSettings];
allSettings[@"provisional"] = [NSNumber numberWithBool:settings.authorizationStatus == UNAuthorizationStatusProvisional];
}
if (@available(iOS 13.0, *)) {
allSettings[@"announcement"] = [NSNumber numberWithBool:settings.announcementSetting == UNNotificationSettingEnabled];
Expand Down
3 changes: 3 additions & 0 deletions lib/ios/RNNotifications.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <UIKit/UIKit.h>
#import <PushKit/PushKit.h>
#import <UserNotifications/UserNotifications.h>
#import "RNNotificationCenterMulticast.h"

@interface RNNotifications : NSObject

Expand All @@ -17,4 +18,6 @@
+ (void)addNativeDelegate:(id<UNUserNotificationCenterDelegate>)delegate;
+ (void)removeNativeDelegate:(id<UNUserNotificationCenterDelegate>)delegate;

- (RNNotificationCenterMulticast*)multicast;

@end
4 changes: 4 additions & 0 deletions lib/ios/RNNotifications.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ + (void)removeNativeDelegate:(id<UNUserNotificationCenterDelegate>)delegate {
[[self sharedInstance] removeNativeDelegate:delegate];
}

- (RNNotificationCenterMulticast*)multicast {
return _notificationCenterMulticast;
}

- (void)startMonitorNotifications {
_notificationCenterListener = [[RNNotificationCenterListener alloc] initWithNotificationEventHandler:_notificationEventHandler];

Expand Down
3 changes: 2 additions & 1 deletion website/docs/docs/subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Notifications.ios.checkPermissions().then((currentPermissions) => {
console.log('Alerts enabled: ' + !!currentPermissions.alert);
console.log('Car Play enabled: ' + !!currentPermissions.carPlay);
console.log('Critical Alerts enabled: ' + !!currentPermissions.criticalAlert);
console.log('Provisioanl enabled: ' + !!currentPermissions.provisional);
console.log('Provides App Notification Settings enabled: ' + !!currentPermissions.providesAppNotificationSettings);
console.log('Announcement enabled: ' + !!currentPermissions.announcement);
console.log('Announcement enabled: ' + !!currentPermissions.announcement);
});
```

0 comments on commit eb8a1c6

Please sign in to comment.