[notifications] Continued work on iOS notification functionality
This commit is contained in:
parent
6b911b207b
commit
665cd1a277
|
@ -27,6 +27,7 @@ RCT_EXPORT_METHOD(cancelNotification:(NSString*) notificationId) {
|
|||
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
|
||||
for (UILocalNotification *notification in RCTSharedApplication().scheduledLocalNotifications) {
|
||||
NSDictionary *notificationInfo = notification.userInfo;
|
||||
// TODO: NotificationId?
|
||||
if ([notificationId isEqualToString:[notificationInfo valueForKey:@"notificationId"]]) {
|
||||
[RCTSharedApplication() cancelLocalNotification:notification];
|
||||
}
|
||||
|
@ -194,7 +195,7 @@ RCT_EXPORT_METHOD(scheduleNotification:(NSDictionary*) notification
|
|||
content.sound = notification[@"sound"];
|
||||
}
|
||||
if (notification[@"subtitle"]) {
|
||||
content.title = notification[@"subtitle"];
|
||||
content.subtitle = notification[@"subtitle"];
|
||||
}
|
||||
if (notification[@"title"]) {
|
||||
content.title = notification[@"title"];
|
||||
|
@ -240,14 +241,90 @@ RCT_EXPORT_METHOD(scheduleNotification:(NSDictionary*) notification
|
|||
- (NSDictionary*) parseUILocalNotification:(UILocalNotification *) localNotification {
|
||||
NSMutableDictionary *notification = [[NSMutableDictionary alloc] init];
|
||||
|
||||
if (localNotification.alertBody) {
|
||||
notification[@"body"] = localNotification.alertBody;
|
||||
}
|
||||
if (localNotification.userInfo) {
|
||||
notification[@"data"] = localNotification.userInfo;
|
||||
}
|
||||
if (localNotification.soundName) {
|
||||
notification[@"sound"] = localNotification.soundName;
|
||||
}
|
||||
if (localNotification.alertTitle) {
|
||||
notification[@"title"] = localNotification.alertTitle;
|
||||
}
|
||||
|
||||
NSMutableDictionary *ios = [[NSMutableDictionary alloc] init];
|
||||
if (localNotification.alertAction) {
|
||||
ios[@"alertAction"] = localNotification.alertAction;
|
||||
}
|
||||
if (localNotification.applicationIconBadgeNumber) {
|
||||
ios[@"badge"] = @(localNotification.applicationIconBadgeNumber);
|
||||
}
|
||||
if (localNotification.category) {
|
||||
ios[@"category"] = localNotification.category;
|
||||
}
|
||||
if (localNotification.hasAction) {
|
||||
ios[@"hasAction"] = @(localNotification.hasAction);
|
||||
}
|
||||
if (localNotification.alertLaunchImage) {
|
||||
ios[@"launchImage"] = localNotification.alertLaunchImage;
|
||||
}
|
||||
notification[@"ios"] = ios;
|
||||
|
||||
return notification;
|
||||
// TODO
|
||||
}
|
||||
|
||||
- (NSDictionary*) parseUNNotificationRequest:(UNNotificationRequest *) localNotification {
|
||||
// TODO
|
||||
NSMutableDictionary *notification = [[NSMutableDictionary alloc] init];
|
||||
|
||||
notification[@"identifier"] = localNotification.identifier;
|
||||
|
||||
if (localNotification.content.body) {
|
||||
notification[@"body"] = localNotification.content.body;
|
||||
}
|
||||
if (localNotification.content.userInfo) {
|
||||
notification[@"data"] = localNotification.content.userInfo;
|
||||
}
|
||||
if (localNotification.content.sound) {
|
||||
notification[@"sound"] = localNotification.content.sound;
|
||||
}
|
||||
if (localNotification.content.subtitle) {
|
||||
notification[@"subtitle"] = localNotification.content.subtitle;
|
||||
}
|
||||
if (localNotification.content.title) {
|
||||
notification[@"title"] = localNotification.content.title;
|
||||
}
|
||||
|
||||
NSMutableDictionary *ios = [[NSMutableDictionary alloc] init];
|
||||
|
||||
if (localNotification.content.attachments) {
|
||||
NSMutableArray *attachments = [[NSMutableArray alloc] init];
|
||||
for (UNNotificationAttachment *a in localNotification.content.attachments) {
|
||||
NSMutableDictionary *attachment = [[NSMutableDictionary alloc] init];
|
||||
attachment[@"identifier"] = a.identifier;
|
||||
attachment[@"type"] = a.type;
|
||||
attachment[@"url"] = [a.URL absoluteString];
|
||||
[attachments addObject:attachment];
|
||||
}
|
||||
ios[@"attachments"] = attachments;
|
||||
}
|
||||
|
||||
if (localNotification.content.badge) {
|
||||
ios[@"badge"] = localNotification.content.badge;
|
||||
}
|
||||
if (localNotification.content.categoryIdentifier) {
|
||||
ios[@"category"] = localNotification.content.categoryIdentifier;
|
||||
}
|
||||
if (localNotification.content.launchImageName) {
|
||||
ios[@"launchImage"] = localNotification.content.launchImageName;
|
||||
}
|
||||
if (localNotification.content.threadIdentifier) {
|
||||
ios[@"threadIdentifier"] = localNotification.content.threadIdentifier;
|
||||
}
|
||||
notification[@"ios"] = ios;
|
||||
|
||||
return notification;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents {
|
||||
|
|
|
@ -7,44 +7,44 @@ PODS:
|
|||
- BoringSSL/Interface (9.2)
|
||||
- Crashlytics (3.9.3):
|
||||
- Fabric (~> 1.7.2)
|
||||
- Fabric (1.7.2)
|
||||
- Firebase/AdMob (4.8.1):
|
||||
- Fabric (1.7.3)
|
||||
- Firebase/AdMob (4.8.2):
|
||||
- Firebase/Core
|
||||
- Google-Mobile-Ads-SDK (= 7.27.0)
|
||||
- Firebase/Auth (4.8.1):
|
||||
- Firebase/Auth (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseAuth (= 4.4.2)
|
||||
- Firebase/Core (4.8.1):
|
||||
- FirebaseAnalytics (= 4.0.7)
|
||||
- Firebase/Core (4.8.2):
|
||||
- FirebaseAnalytics (= 4.0.9)
|
||||
- FirebaseCore (= 4.0.14)
|
||||
- Firebase/Crash (4.8.1):
|
||||
- Firebase/Crash (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseCrash (= 2.0.2)
|
||||
- Firebase/Database (4.8.1):
|
||||
- Firebase/Database (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseDatabase (= 4.1.4)
|
||||
- Firebase/DynamicLinks (4.8.1):
|
||||
- Firebase/DynamicLinks (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseDynamicLinks (= 2.3.2)
|
||||
- Firebase/Firestore (4.8.1):
|
||||
- Firebase/Firestore (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseFirestore (= 0.10.0)
|
||||
- Firebase/Messaging (4.8.1):
|
||||
- Firebase/Messaging (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseMessaging (= 2.0.8)
|
||||
- Firebase/Performance (4.8.1):
|
||||
- Firebase/Performance (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebasePerformance (= 1.1.1)
|
||||
- Firebase/RemoteConfig (4.8.1):
|
||||
- Firebase/RemoteConfig (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseRemoteConfig (= 2.1.1)
|
||||
- Firebase/Storage (4.8.1):
|
||||
- Firebase/Storage (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseStorage (= 2.1.2)
|
||||
- FirebaseABTesting (1.0.0):
|
||||
- FirebaseCore (~> 4.0)
|
||||
- Protobuf (~> 3.1)
|
||||
- FirebaseAnalytics (4.0.7):
|
||||
- FirebaseAnalytics (4.0.9):
|
||||
- FirebaseCore (~> 4.0)
|
||||
- FirebaseInstanceID (~> 2.0)
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
|
@ -114,26 +114,26 @@ PODS:
|
|||
- GoogleToolboxForMac/Defines (= 2.1.3)
|
||||
- GoogleToolboxForMac/NSString+URLArguments (= 2.1.3)
|
||||
- GoogleToolboxForMac/NSString+URLArguments (2.1.3)
|
||||
- gRPC (1.8.4):
|
||||
- gRPC-RxLibrary (= 1.8.4)
|
||||
- gRPC/Main (= 1.8.4)
|
||||
- gRPC-Core (1.8.4):
|
||||
- gRPC-Core/Implementation (= 1.8.4)
|
||||
- gRPC-Core/Interface (= 1.8.4)
|
||||
- gRPC-Core/Implementation (1.8.4):
|
||||
- gRPC (1.9.1):
|
||||
- gRPC-RxLibrary (= 1.9.1)
|
||||
- gRPC/Main (= 1.9.1)
|
||||
- gRPC-Core (1.9.1):
|
||||
- gRPC-Core/Implementation (= 1.9.1)
|
||||
- gRPC-Core/Interface (= 1.9.1)
|
||||
- gRPC-Core/Implementation (1.9.1):
|
||||
- BoringSSL (~> 9.0)
|
||||
- gRPC-Core/Interface (= 1.8.4)
|
||||
- gRPC-Core/Interface (= 1.9.1)
|
||||
- nanopb (~> 0.3)
|
||||
- gRPC-Core/Interface (1.8.4)
|
||||
- gRPC-ProtoRPC (1.8.4):
|
||||
- gRPC (= 1.8.4)
|
||||
- gRPC-RxLibrary (= 1.8.4)
|
||||
- gRPC-Core/Interface (1.9.1)
|
||||
- gRPC-ProtoRPC (1.9.1):
|
||||
- gRPC (= 1.9.1)
|
||||
- gRPC-RxLibrary (= 1.9.1)
|
||||
- Protobuf (~> 3.0)
|
||||
- gRPC-RxLibrary (1.8.4)
|
||||
- gRPC/Main (1.8.4):
|
||||
- gRPC-Core (= 1.8.4)
|
||||
- gRPC-RxLibrary (= 1.8.4)
|
||||
- GTMSessionFetcher/Core (1.1.12)
|
||||
- gRPC-RxLibrary (1.9.1)
|
||||
- gRPC/Main (1.9.1):
|
||||
- gRPC-Core (= 1.9.1)
|
||||
- gRPC-RxLibrary (= 1.9.1)
|
||||
- GTMSessionFetcher/Core (1.1.13)
|
||||
- leveldb-library (1.20)
|
||||
- nanopb (0.3.8):
|
||||
- nanopb/decode (= 0.3.8)
|
||||
|
@ -201,10 +201,10 @@ EXTERNAL SOURCES:
|
|||
SPEC CHECKSUMS:
|
||||
BoringSSL: f3d6b8ce199b9c450a8cfc14895d07a2627fc232
|
||||
Crashlytics: dbb07d01876c171c5ccbdf7826410380189e452c
|
||||
Fabric: 9cd6a848efcf1b8b07497e0b6a2e7d336353ba15
|
||||
Firebase: 2721056b8885eef90233b03f37be64358d35d262
|
||||
Fabric: bb495bb9a7a7677c6d03a1f8b83d95bc49b47e41
|
||||
Firebase: 7d3b8cd837ad9fcd391657734c0d56dab8e9a5a3
|
||||
FirebaseABTesting: d07d0ee833b842d5153549e4c7e2e2cb1c23a3f9
|
||||
FirebaseAnalytics: 617afa8c26b57a0c3f11361b248bc9e17bfd8dfd
|
||||
FirebaseAnalytics: 388b630c15713f5dbf364071f5f3d6077fb52f4e
|
||||
FirebaseAuth: bd2738c5c1e92b108ba5f7f7335908097a4e50bb
|
||||
FirebaseCore: 2e0b98fb2d64ca8140136beff15772bdd14d2dd7
|
||||
FirebaseCrash: cded0fc566c03651aea606a101bc156085f333ca
|
||||
|
@ -219,11 +219,11 @@ SPEC CHECKSUMS:
|
|||
FirebaseSwizzlingUtilities: f1c49a5a372ac852c853722a5891a0a5e2344a6c
|
||||
Google-Mobile-Ads-SDK: 83f7f890e638ce8f1debd440ea363338c9f6be3b
|
||||
GoogleToolboxForMac: 2501e2ad72a52eb3dfe7bd9aee7dad11b858bd20
|
||||
gRPC: 572520c17b794362388d5c95396329592a3c199b
|
||||
gRPC-Core: af0d4f0a53735e335fccc815c50c0a03da695287
|
||||
gRPC-ProtoRPC: 6596fde8d27e0718d7de1de1dc99a951d832a809
|
||||
gRPC-RxLibrary: f6b1432a667c3354c7b345affed9886c0d4ff549
|
||||
GTMSessionFetcher: ebaa1f79a5366922c1735f1566901f50beba23b7
|
||||
gRPC: 58828d611419d49da19ad02a60679ffa10a10a87
|
||||
gRPC-Core: 66413bf1f2d038a6221bc7bfcbeeaa5a117cee29
|
||||
gRPC-ProtoRPC: f29e8b7445e0d3c0311678ab121e6c164da4ca5e
|
||||
gRPC-RxLibrary: 8e0067bfe8a054022c7a81470baace4f2f633b48
|
||||
GTMSessionFetcher: 5bb1eae636127de695590f50e7d248483eb891e6
|
||||
leveldb-library: '08cba283675b7ed2d99629a4bc5fd052cd2bb6a5'
|
||||
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
|
||||
Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03
|
||||
|
|
Loading…
Reference in New Issue