|
10 | 10 | #import <WindowsAzureMessaging/WindowsAzureMessaging.h>
|
11 | 11 | #import "RCTAzureNotificationHubManager.h"
|
12 | 12 |
|
13 |
| -#import "RCTBridge.h" |
14 |
| -#import "RCTConvert.h" |
15 |
| -#import "RCTEventDispatcher.h" |
16 |
| -#import "RCTUtils.h" |
| 13 | +#import "React/RCTBridge.h" |
| 14 | +#import "React/RCTConvert.h" |
| 15 | +#import "React/RCTEventDispatcher.h" |
| 16 | +#import "React/RCTUtils.h" |
17 | 17 |
|
18 | 18 | // The default error code to use as the `code` property for callback error objects
|
19 | 19 | RCT_EXTERN NSString *const RCTErrorUnspecified;
|
|
35 | 35 | // Keys
|
36 | 36 | NSString *const RCTConnectionStringKey = @"connectionString";
|
37 | 37 | NSString *const RCTHubNameKey = @"hubName";
|
| 38 | +NSString *const RCTTagsKey = @"tags"; |
38 | 39 |
|
39 | 40 | @implementation RCTConvert (UILocalNotification)
|
40 | 41 |
|
@@ -69,6 +70,9 @@ @implementation RCTAzureNotificationHubManager
|
69 | 70 |
|
70 | 71 | // The Notification Hub name
|
71 | 72 | NSString *_hubName;
|
| 73 | + |
| 74 | + // The Notification Hub tags |
| 75 | + NSSet *_tags; |
72 | 76 | }
|
73 | 77 |
|
74 | 78 | static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification)
|
@@ -441,25 +445,26 @@ - (void)handleRegisterUserNotificationSettings:(NSNotification *)notification
|
441 | 445 | resolver:(RCTPromiseResolveBlock)resolve
|
442 | 446 | rejecter:(RCTPromiseRejectBlock)reject)
|
443 | 447 | {
|
444 |
| - // Store the connection string and hub name |
| 448 | + // Store the connection string, hub name and tags |
445 | 449 | _connectionString = [config objectForKey:RCTConnectionStringKey];
|
446 | 450 | _hubName = [config objectForKey:RCTHubNameKey];
|
447 |
| - |
| 451 | + _tags = [config objectForKey:RCTTagsKey]; |
| 452 | + |
448 | 453 | // Check arguments
|
449 | 454 | if (![self assertArguments:reject])
|
450 | 455 | {
|
451 | 456 | return;
|
452 | 457 | }
|
453 | 458 |
|
454 | 459 | // Initialize hub
|
455 |
| - SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:_connectionString |
| 460 | + SBNotificationHub *hub = [[SBNotificationHub alloc] initWithConnectionString:_connectionString |
456 | 461 | notificationHubPath:_hubName];
|
457 | 462 |
|
458 | 463 | // Register for native notifications
|
459 | 464 | dispatch_async(dispatch_get_main_queue(), ^
|
460 | 465 | {
|
461 | 466 | [hub registerNativeWithDeviceToken:deviceToken
|
462 |
| - tags:nil |
| 467 | + tags:_tags |
463 | 468 | completion:^(NSError* error)
|
464 | 469 | {
|
465 | 470 | if (error != nil)
|
@@ -488,13 +493,13 @@ - (void)handleRegisterUserNotificationSettings:(NSNotification *)notification
|
488 | 493 | }
|
489 | 494 |
|
490 | 495 | // Initialize hub
|
491 |
| - SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:_connectionString |
| 496 | + SBNotificationHub *hub = [[SBNotificationHub alloc] initWithConnectionString:_connectionString |
492 | 497 | notificationHubPath:_hubName];
|
493 | 498 |
|
494 | 499 | // Unregister for native notifications
|
495 | 500 | dispatch_async(dispatch_get_main_queue(), ^
|
496 | 501 | {
|
497 |
| - [hub unregisterNativeWithCompletion:^(NSError* error) |
| 502 | + [hub unregisterNativeWithCompletion:^(NSError *error) |
498 | 503 | {
|
499 | 504 | if (error != nil)
|
500 | 505 | {
|
|
0 commit comments