From 5cd92c2ec8727dd0549fc75d72d550e58ba95921 Mon Sep 17 00:00:00 2001 From: yogevbd Date: Mon, 9 Sep 2019 15:39:28 +0300 Subject: [PATCH] Updated docs --- docs/android-api.md | 14 ++++----- docs/android-events.md | 40 ------------------------ docs/general-api.md | 4 +-- docs/general-events.md | 48 +++++++++++++++-------------- docs/ios-api.md | 69 ++++++++++++++++++++++++++++++++++++------ docs/ios-events.md | 36 ++++++---------------- website/i18n/en.json | 18 +++++------ website/sidebars.json | 4 +-- 8 files changed, 112 insertions(+), 121 deletions(-) delete mode 100755 docs/android-events.md diff --git a/docs/android-api.md b/docs/android-api.md index 49228c8..daa608d 100755 --- a/docs/android-api.md +++ b/docs/android-api.md @@ -1,14 +1,12 @@ --- id: android-api -title: Android specific +title: Android Specific Commands sidebar_label: Android specific --- -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. +## refreshToken +refreshToken -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. +```js +Notifications.refreshToken(); +``` diff --git a/docs/android-events.md b/docs/android-events.md deleted file mode 100755 index c1c01a8..0000000 --- a/docs/android-events.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: android-events -title: Android -sidebar_label: Android ---- - -## getInitialNotification -Return the notification that caused the app to launch from dead state. - -```js -const notification: Notification = await getInitialNotification(); -``` - -## postLocalNotification(notification, id?) -Posts local notification to the device notification center. - -```js -Notifications.postLocalNotification({ - body: 'Local notificiation!', - title: 'Local Notification Title', - sound: 'chime.aiff', - category: 'SOME_CATEGORY', - link: 'localNotificationLink', - fireDate: new Date() -}, id); -``` - -## cancelLocalNotification(id) -Relevant for notifications sent with `fireDate`. - -```js -Notifications.cancelLocalNotification(id); -``` - -## isRegisteredForRemoteNotifications() -Check if the app has permissions to send remote notifications. - -```js -const hasPermissions: boolean = await getInitialNotification(); -``` diff --git a/docs/general-api.md b/docs/general-api.md index f29ddd8..3a5b76d 100755 --- a/docs/general-api.md +++ b/docs/general-api.md @@ -1,7 +1,7 @@ --- id: general-api -title: General API -sidebar_label: General API +title: General Commands +sidebar_label: General --- ## getInitialNotification diff --git a/docs/general-events.md b/docs/general-events.md index f1ba020..a3f7b6b 100755 --- a/docs/general-events.md +++ b/docs/general-events.md @@ -1,40 +1,44 @@ --- id: general-events -title: Events subscription -sidebar_label: Events subscription +title: General +sidebar_label: General --- -## getInitialNotification -Return the notification that caused the app to launch from dead state. +## registerRemoteNotificationsRegistered +registerRemoteNotificationsRegistered ```js -const notification: Notification = await getInitialNotification(); +Notifications.events().registerRemoteNotificationsRegistered((event: Registered) => { + console.log(event.deviceToken); +}); ``` -## postLocalNotification(notification, id?) -Posts local notification to the device notification center. +## registerNotificationReceived +registerNotificationReceived ```js -Notifications.postLocalNotification({ - body: 'Local notificiation!', - title: 'Local Notification Title', - sound: 'chime.aiff', - category: 'SOME_CATEGORY', - link: 'localNotificationLink', - fireDate: new Date() -}, id); +Notifications.events().registerNotificationReceived((notification: Notification, completion: (response: NotificationCompletion) => void) => { + console.log(JSON.stringify(notification.data)); + + // Calling completion on iOS with `alert: true` will present the native iOS inApp notification. + completion({alert: true, sound: true, badge: false}); +}); ``` -## cancelLocalNotification(id) -Relevant for notifications sent with `fireDate`. +## registerRemoteNotificationOpened +registerRemoteNotificationOpened ```js -Notifications.cancelLocalNotification(id); +Notifications.events().registerRemoteNotificationOpened((notification: Notification) => { + console.log(JSON.stringify(notification.data)); +}); ``` -## isRegisteredForRemoteNotifications() -Check if the app has permissions to send remote notifications. +## registerRemoteNotificationsRegistrationFailed +registerRemoteNotificationsRegistrationFailed ```js -const hasPermissions: boolean = await getInitialNotification(); -``` +Notifications.events().registerRemoteNotificationsRegistrationFailed(() => { + +}); +``` \ No newline at end of file diff --git a/docs/ios-api.md b/docs/ios-api.md index e699f7a..f4f783c 100755 --- a/docs/ios-api.md +++ b/docs/ios-api.md @@ -1,19 +1,68 @@ --- id: ios-api -title: iOS Specific API +title: iOS Specific Commands sidebar_label: iOS specific --- -## Notifications.getInitialNotification() -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. +## requestPermissions +request permissions -## BBB -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. +```js +Notifications.requestPermissions(); +``` -## CCC -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. +## checkPermissions +checkPermissions -## DDD -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. +```js +Notifications.checkPermissions(); +``` -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. +## registerPushKit +registerPushKit + +```js +Notifications.registerPushKit(); +``` + +## cancelAllLocalNotifications +cancelAllLocalNotifications + +```js +Notifications.cancelAllLocalNotifications(); +``` + +## getDeliveredNotifications +getDeliveredNotifications + +```js +Notifications.getDeliveredNotifications(); +``` + +## removeAllDeliveredNotifications +removeAllDeliveredNotifications + +```js +Notifications.removeAllDeliveredNotifications(); +``` + +## removeDeliveredNotifications +removeDeliveredNotifications + +```js +Notifications.removeDeliveredNotifications(); +``` + +## getBadgeCount +getBadgeCount + +```js +Notifications.getBadgeCount(); +``` + +## setBadgeCount +setBadgeCount + +```js +Notifications.setBadgeCount(1); +``` \ No newline at end of file diff --git a/docs/ios-events.md b/docs/ios-events.md index a490bbf..f71c385 100755 --- a/docs/ios-events.md +++ b/docs/ios-events.md @@ -4,37 +4,21 @@ title: iOS sidebar_label: iOS specific --- -## getInitialNotification -Return the notification that caused the app to launch from dead state. +## registerPushKitRegistered +registerPushKitRegistered ```js -const notification: Notification = await getInitialNotification(); +Notifications.events().registerPushKitRegistered((event: RegisteredPushKit) => { + console.log(event.pushKitToken); +}); ``` -## postLocalNotification(notification, id?) -Posts local notification to the device notification center. +## registerPushKitNotificationReceived +registerPushKitNotificationReceived ```js -Notifications.postLocalNotification({ - body: 'Local notificiation!', - title: 'Local Notification Title', - sound: 'chime.aiff', - category: 'SOME_CATEGORY', - link: 'localNotificationLink', - fireDate: new Date() -}, id); +Notifications.events().registerPushKitNotificationReceived((event: object) => { + console.log(JSON.stringify(event)); +}); ``` -## cancelLocalNotification(id) -Relevant for notifications sent with `fireDate`. - -```js -Notifications.cancelLocalNotification(id); -``` - -## isRegisteredForRemoteNotifications() -Check if the app has permissions to send remote notifications. - -```js -const hasPermissions: boolean = await getInitialNotification(); -``` diff --git a/website/i18n/en.json b/website/i18n/en.json index 4741f9f..88c699f 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -6,13 +6,9 @@ "tagline": "Documentation", "docs": { "android-api": { - "title": "Android specific", + "title": "Android Specific Commands", "sidebar_label": "Android specific" }, - "android-events": { - "title": "Android", - "sidebar_label": "Android" - }, "doc2": { "title": "document number 2" }, @@ -26,12 +22,12 @@ "title": "Fifth Document" }, "general-api": { - "title": "General API", - "sidebar_label": "General API" + "title": "General Commands", + "sidebar_label": "General" }, "general-events": { - "title": "Events subscription", - "sidebar_label": "Events subscription" + "title": "General", + "sidebar_label": "General" }, "installation-android": { "title": "Android Installation", @@ -42,7 +38,7 @@ "sidebar_label": "iOS Installation" }, "ios-api": { - "title": "iOS Specific API", + "title": "iOS Specific Commands", "sidebar_label": "iOS specific" }, "ios-events": { @@ -61,7 +57,7 @@ "Subscription": "Subscription", "Notification Events": "Notification Events", "Advanced API - iOS": "Advanced API - iOS", - "Api": "Api", + "Commands": "Commands", "Events": "Events" } }, diff --git a/website/sidebars.json b/website/sidebars.json index 09ef80b..67e50c7 100755 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -6,7 +6,7 @@ "Advanced API - iOS": ["doc3"] }, "api": { - "Api": ["general-api", "ios-api", "android-api"], - "Events": ["general-events", "ios-events", "android-events"] + "Commands": ["general-api", "ios-api", "android-api"], + "Events": ["general-events", "ios-events"] } } -- 2.26.2