@@ -539,6 +539,7 @@ class myapp extends Component {
539539 }
540540
541541 _onRemoteNotification (notification ) {
542+ // Note notification will be a JSON string for android
542543 console .warn (' Notification received: ' + notification);
543544 }
544545` ` `
@@ -550,25 +551,55 @@ const NotificationHub = require('react-native-azurenotificationhub/index.ios');
550551
551552const connectionString = ' ...' ; // The Notification Hub connection string
552553const hubName = ' ...' ; // The Notification Hub name
553- const senderID = ' ...' ; // The Sender ID from the Cloud Messaging tab of the Firebase console
554554const tags = [ ... ]; // The set of tags to subscribe to
555555
556556var remoteNotificationsDeviceToken = ' ' ; // The device token registered with APNS
557557
558558class myapp extends Component {
559559 requestPermissions () {
560+ // register: Fired when the user registers for remote notifications. The
561+ // handler will be invoked with a hex string representing the deviceToken.
560562 NotificationHub .addEventListener (' register' , this ._onRegistered );
563+
564+ // registrationError: Fired when the user fails to register for remote
565+ // notifications. Typically occurs when APNS is having issues, or the device
566+ // is a simulator. The handler will be invoked with {message: string, code: number, details: any}.
561567 NotificationHub .addEventListener (' registrationError' , this ._onRegistrationError );
562- NotificationHub .addEventListener (' registerAzureNotificationHub' , this ._onAzureNotificationHubRegistered );
568+
569+ // registerAzureNotificationHub: Fired when registration with azure notification hubs successful
570+ // with object {success: true}
571+ NotificationHub .addEventListener (' registerAzureNotificationHub' this ._onAzureNotificationHubRegistered );
572+
573+ // azureNotificationHubRegistrationError: Fired when registration with azure notification hubs
574+ // fails with object {message: string, details: any}
563575 NotificationHub .addEventListener (' azureNotificationHubRegistrationError' , this ._onAzureNotificationHubRegistrationError );
576+
577+ // notification: Fired when a remote notification is received. The
578+ // handler will be invoked with an instance of `AzureNotificationHubIOS`.
564579 NotificationHub .addEventListener (' notification' , this ._onRemoteNotification );
580+
581+ // localNotification: Fired when a local notification is received. The
582+ // handler will be invoked with an instance of `AzureNotificationHubIOS`.
565583 NotificationHub .addEventListener (' localNotification' , this ._onLocalNotification );
566584
585+ // Requests notification permissions from iOS, prompting the user's
586+ // dialog box. By default, it will request all notification permissions, but
587+ // a subset of these can be requested by passing a map of requested
588+ // permissions.
589+ // The following permissions are supported:
590+ // - `alert`
591+ // - `badge`
592+ // - `sound`
593+ //
594+ // returns a promise that will resolve when the user accepts,
595+ // rejects, or if the permissions were previously rejected. The promise
596+ // resolves to the current state of the permission of
597+ // {alert: boolean, badge: boolean,sound: boolean }
567598 NotificationHub .requestPermissions ();
568599 }
569600
570601 register () {
571- NotificationHub .register (remoteNotificationsDeviceToken, {connectionString, hubName, senderID, tags});
602+ NotificationHub .register (remoteNotificationsDeviceToken, {connectionString, hubName, tags});
572603 }
573604
574605 unregister () {
@@ -659,6 +690,7 @@ class myapp extends Component {
659690 }
660691
661692 _onLocalNotification (notification ){
693+ // Note notification will be object for iOS
662694 AlertIOS .alert (
663695 ' Local Notification Received' ,
664696 ' Alert message: ' + notification .getMessage (),
0 commit comments