diff --git a/.gitignore b/.gitignore index 00c5396c76ffe6fa5ac187bc41006d10514949b5..82b4d3ace05a6a8f0ff3184ca261490023840e61 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ lib/android/*.iml lib/android/.idea lib/android/build lib/android/.gradle +*.gradle ##### # OS X temporary files that should never be committed diff --git a/docs/android-api.md b/docs/android-api.md index 7ce9e3f6a3035a5cd7c3fccfa3577a2678184c84..9ee6f98711277bddac9fe87b740ae0da8e32ecac 100755 --- a/docs/android-api.md +++ b/docs/android-api.md @@ -4,8 +4,8 @@ title: Android Specific Commands sidebar_label: Android specific --- -## refreshToken -refreshToken +## refreshToken() +Request a new token for sending push notifications. ```js Notifications.android.refreshToken(); diff --git a/docs/doc2.md b/docs/doc2.md deleted file mode 100755 index 20c0c95a6bc8ebd0b2ff867f4cb9e73f3715cc98..0000000000000000000000000000000000000000 --- a/docs/doc2.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -id: doc2 -title: document number 2 ---- - -This is a link to [another document.](doc3.md) -This is a link to an [external page.](http://www.example.com) diff --git a/docs/doc3.md b/docs/doc3.md deleted file mode 100755 index bcb9054fc75cc5c9ac412adf48d632a480c13009..0000000000000000000000000000000000000000 --- a/docs/doc3.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: doc3 -title: This is document number 3 ---- -Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac euismod odio, eu consequat dui. Nullam molestie consectetur risus id imperdiet. Proin sodales ornare turpis, non mollis massa ultricies id. Nam at nibh scelerisque, feugiat ante non, dapibus tortor. Vivamus volutpat diam quis tellus elementum bibendum. Praesent semper gravida velit quis aliquam. Etiam in cursus neque. Nam lectus ligula, malesuada et mauris a, bibendum faucibus mi. Phasellus ut interdum felis. Phasellus in odio pulvinar, porttitor urna eget, fringilla lectus. Aliquam sollicitudin est eros. Mauris consectetur quam vitae mauris interdum hendrerit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. - -Duis et egestas libero, imperdiet faucibus ipsum. Sed posuere eget urna vel feugiat. Vivamus a arcu sagittis, fermentum urna dapibus, congue lectus. Fusce vulputate porttitor nisl, ac cursus elit volutpat vitae. Nullam vitae ipsum egestas, convallis quam non, porta nibh. Morbi gravida erat nec neque bibendum, eu pellentesque velit posuere. Fusce aliquam erat eu massa eleifend tristique. - -Sed consequat sollicitudin ipsum eget tempus. Integer a aliquet velit. In justo nibh, pellentesque non suscipit eget, gravida vel lacus. Donec odio ante, malesuada in massa quis, pharetra tristique ligula. Donec eros est, tristique eget finibus quis, semper non nisl. Vivamus et elit nec enim ornare placerat. Sed posuere odio a elit cursus sagittis. - -Phasellus feugiat purus eu tortor ultrices finibus. Ut libero nibh, lobortis et libero nec, dapibus posuere eros. Sed sagittis euismod justo at consectetur. Nulla finibus libero placerat, cursus sapien at, eleifend ligula. Vivamus elit nisl, hendrerit ac nibh eu, ultrices tempus dui. Nam tellus neque, commodo non rhoncus eu, gravida in risus. Nullam id iaculis tortor. - -Nullam at odio in sem varius tempor sit amet vel lorem. Etiam eu hendrerit nisl. Fusce nibh mauris, vulputate sit amet ex vitae, congue rhoncus nisl. Sed eget tellus purus. Nullam tempus commodo erat ut tristique. Cras accumsan massa sit amet justo consequat eleifend. Integer scelerisque vitae tellus id consectetur. diff --git a/docs/exampledoc4.md b/docs/exampledoc4.md deleted file mode 100755 index 6f94ffe91b5821efd088da38b1a317560436acef..0000000000000000000000000000000000000000 --- a/docs/exampledoc4.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -id: doc4 -title: Other Document ---- - -this is another document diff --git a/docs/exampledoc5.md b/docs/exampledoc5.md deleted file mode 100755 index 92e2d0d5b914535e50d9c01eea8debf3986ca19a..0000000000000000000000000000000000000000 --- a/docs/exampledoc5.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -id: doc5 -title: Fifth Document ---- - -Another one diff --git a/docs/general-api.md b/docs/general-api.md index 49d09648717fae8baccb799d5fb10b4fa9b15a0e..06b787a538493c28f4092f12db62df653219bb2f 100755 --- a/docs/general-api.md +++ b/docs/general-api.md @@ -4,8 +4,16 @@ title: General Commands sidebar_label: General --- -## getInitialNotification -Return the notification that caused the app to launch from dead state. +## registerRemoteNotifications() +Requests remote notification permissions, prompting the user's dialog box on iOS and request a token on Android. +If the user accept the remote notifications permissions, `RemoteNotificationsRegistered` event will get called with the device token. + +```js +Notifications.registerRemoteNotifications(); +``` + +## getInitialNotification() +This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type Notification. Otherwise, it resolves to undefined. ```js const notification: Notification = await Notifications.getInitialNotification(); diff --git a/docs/general-events.md b/docs/general-events.md index a3f7b6b6e87e7079daf8de401c44ccdc915cd491..fbb1f27d59bf0b3bea6791efcb34ba4cfffa28cc 100755 --- a/docs/general-events.md +++ b/docs/general-events.md @@ -4,8 +4,8 @@ title: General sidebar_label: General --- -## registerRemoteNotificationsRegistered -registerRemoteNotificationsRegistered +## registerRemoteNotificationsRegistered() +Fired when the user registers for remote notifications. The handler will be invoked with an event holding the hex string representing the `deviceToken` ```js Notifications.events().registerRemoteNotificationsRegistered((event: Registered) => { @@ -13,8 +13,9 @@ Notifications.events().registerRemoteNotificationsRegistered((event: Registered) }); ``` -## registerNotificationReceived -registerNotificationReceived +## registerNotificationReceived() +Fired when a remote notification is received in foreground state. The handler will be invoked with an instance of `Notification`. +Should call completion function on iOS, will be ignored on Android. ```js Notifications.events().registerNotificationReceived((notification: Notification, completion: (response: NotificationCompletion) => void) => { @@ -25,20 +26,22 @@ Notifications.events().registerNotificationReceived((notification: Notification, }); ``` -## registerRemoteNotificationOpened -registerRemoteNotificationOpened +## registerRemoteNotificationOpened() +Fired when a remote notification is opened from dead or background state. The handler will be invoked with an instance of `Notification`. +Should call completion function on iOS, will be ignored on Android. ```js -Notifications.events().registerRemoteNotificationOpened((notification: Notification) => { +Notifications.events().registerRemoteNotificationOpened((notification: Notification, completion: () => void) => { console.log(JSON.stringify(notification.data)); + completion(); }); ``` -## registerRemoteNotificationsRegistrationFailed -registerRemoteNotificationsRegistrationFailed +## registerRemoteNotificationsRegistrationFailed() +Fired when the user fails to register for remote notifications. Typically occurs when APNS is having issues, or the device is a simulator. The handler will be invoked with {localizedDescription: string, code: string, domain: string}. ```js -Notifications.events().registerRemoteNotificationsRegistrationFailed(() => { - +Notifications.events().registerRemoteNotificationsRegistrationFailed((event: RegistrationError) => { + console.log(event.code, event.localizedDescription, event.domain); }); ``` \ No newline at end of file diff --git a/docs/ios-api.md b/docs/ios-api.md index 8c034dc4357b6644ce60ccb316f5705c84655576..bc1b8d1c867d9e3dfec0645f6330094821b703a4 100755 --- a/docs/ios-api.md +++ b/docs/ios-api.md @@ -4,71 +4,73 @@ title: iOS Specific Commands sidebar_label: iOS specific --- -## requestPermissions -request permissions +## requestPermissions() +Requests notification permissions from iOS, prompting the user's dialog box. ```js Notifications.ios.requestPermissions(); ``` -## checkPermissions -checkPermissions +## checkPermissions() +See what push permissions are currently enabled. ```js Notifications.ios.checkPermissions(); ``` -## abandonPermissions -Unregister for all remote notifications received via Apple Push Notification service +## abandonPermissions() +Unregister for all remote notifications received via Apple Push Notification service. + +You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register. ```js Notifications.ios.abandonPermissions(); ``` -## registerPushKit -registerPushKit +## registerPushKit() +Register for PushKit notifications ```js Notifications.ios.registerPushKit(); ``` -## cancelAllLocalNotifications -cancelAllLocalNotifications +## cancelAllLocalNotifications() +Cancels all scheduled localNotifications ```js Notifications.ios.cancelAllLocalNotifications(); ``` -## getDeliveredNotifications -getDeliveredNotifications +## getDeliveredNotifications() +Provides you with a list of the app’s notifications that are still displayed in Notification Center ```js Notifications.ios.getDeliveredNotifications(); ``` -## removeAllDeliveredNotifications -removeAllDeliveredNotifications +## removeAllDeliveredNotifications() +Remove all delivered notifications from Notification Center ```js Notifications.ios.removeAllDeliveredNotifications(); ``` -## removeDeliveredNotifications -removeDeliveredNotifications +## removeDeliveredNotifications() +Removes the specified notifications from Notification Center ```js -Notifications.ios.removeDeliveredNotifications(); +Notifications.ios.removeDeliveredNotifications(identifiers); ``` -## getBadgeCount -getBadgeCount +## getBadgeCount() +Gets the badge count number from the aps object ```js Notifications.ios.getBadgeCount(); ``` -## setBadgeCount -setBadgeCount +## setBadgeCount() +Sets the badge number for the app icon on the home screen ```js Notifications.ios.setBadgeCount(1); diff --git a/docs/ios-events.md b/docs/ios-events.md index f71c385ca455ee3475da400be320a750084c5f46..603bd7dcdedafa7a22d1e91ac7cf3bbd1386c146 100755 --- a/docs/ios-events.md +++ b/docs/ios-events.md @@ -4,8 +4,8 @@ title: iOS sidebar_label: iOS specific --- -## registerPushKitRegistered -registerPushKitRegistered +## registerPushKitRegistered() +Fired when the user registers for PushKit notifications. The handler will be invoked with an event holding the hex string representing the `pushKitToken` ```js Notifications.events().registerPushKitRegistered((event: RegisteredPushKit) => { @@ -13,8 +13,8 @@ Notifications.events().registerPushKitRegistered((event: RegisteredPushKit) => { }); ``` -## registerPushKitNotificationReceived -registerPushKitNotificationReceived +## registerPushKitNotificationReceived() +Fired when a PushKit notification is received. The handler will be invoked with the notification object. ```js Notifications.events().registerPushKitNotificationReceived((event: object) => {