diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f2b20c..fec2017 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# [1.0.0-beta.1](https://github.com/HaylLtd/capacitor-push-notifications/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2023-04-05)
+
+
+
# [1.0.0-alpha.2](https://github.com/HaylLtd/capacitor-push-notifications/compare/1.0.0-alpha.1...v1.0.0-alpha.2) (2023-04-04)
diff --git a/README.md b/README.md
index f583357..6429541 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ func application(_ application: UIApplication, didFailToRegisterForRemoteNotific
## Android
-The Push Notification API uses [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) SDK for handling notifications. See [Set up a Firebase Cloud Messaging client app on Android](https://firebase.google.com/docs/cloud-messaging/android/client) and follow the instructions for creating a Firebase project and registering your application. There is no need to add the Firebase SDK to your app or edit your app manifest - the Push Notifications provides that for you. All that is required is your Firebase project's `google-services.json` file added to the module (app-level) directory of your app.
+The Push Notification API uses [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) SDK for handling notifications. See [Set up a Firebase Cloud Messaging client app on Android](https://firebase.google.com/docs/cloud-messaging/android/client) and follow the instructions for creating a Firebase project and registering your application. There is no need to add the Firebase SDK to your app or edit your app manifest - the Push Notifications provides that for you. All that is required is your Firebase project's `google-services.json` file added to the module (app-level) directory of your app.
### Variables
@@ -88,7 +88,7 @@ In `capacitor.config.json`:
In `capacitor.config.ts`:
```ts
-///
+///
import { CapacitorConfig } from '@capacitor/cli';
@@ -110,17 +110,21 @@ export default config;
## Silent Push Notifications / Data-only Notifications
+
#### iOS
+
This plugin does not support iOS Silent Push (Remote Notifications). We recommend using native code solutions for handling these types of notifications, see [Pushing Background Updates to Your App](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app).
#### Android
-This plugin does support data-only notifications, but will NOT call `pushNotificationReceived` if the app has been killed. To handle this scenario, you will need to create a service that extends `FirebaseMessagingService`, see [Handling FCM Messages](https://firebase.google.com/docs/cloud-messaging/android/receive).
+
+This plugin does support data-only notifications, but will NOT call `pushNotificationReceived` if the app has been killed. To handle this scenario, you will need to create a service that extends `FirebaseMessagingService`, see [Handling FCM Messages](https://firebase.google.com/docs/cloud-messaging/android/receive).
## Common Issues
+
On Android, there are various system and app states that can affect the delivery of push notifications:
-* If the device has entered [Doze](https://developer.android.com/training/monitoring-device-state/doze-standby) mode, your application may have restricted capabilities. To increase the chance of your notification being received, consider using [FCM high priority messages](https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message).
-* There are differences in behavior between development and production. Try testing your app outside of being launched by Android Studio. Read more [here](https://stackoverflow.com/a/50238790/1351469).
+- If the device has entered [Doze](https://developer.android.com/training/monitoring-device-state/doze-standby) mode, your application may have restricted capabilities. To increase the chance of your notification being received, consider using [FCM high priority messages](https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message).
+- There are differences in behavior between development and production. Try testing your app outside of being launched by Android Studio. Read more [here](https://stackoverflow.com/a/50238790/1351469).
---
@@ -138,14 +142,24 @@ const addListeners = async () => {
console.error('Registration error: ', err.error);
});
- await PushNotifications.addListener('pushNotificationReceived', notification => {
- console.log('Push notification received: ', notification);
- });
-
- await PushNotifications.addListener('pushNotificationActionPerformed', notification => {
- console.log('Push notification action performed', notification.actionId, notification.inputValue);
- });
-}
+ await PushNotifications.addListener(
+ 'pushNotificationReceived',
+ notification => {
+ console.log('Push notification received: ', notification);
+ },
+ );
+
+ await PushNotifications.addListener(
+ 'pushNotificationActionPerformed',
+ notification => {
+ console.log(
+ 'Push notification action performed',
+ notification.actionId,
+ notification.inputValue,
+ );
+ },
+ );
+};
const registerNotifications = async () => {
let permStatus = await PushNotifications.checkPermissions();
@@ -159,12 +173,12 @@ const registerNotifications = async () => {
}
await PushNotifications.register();
-}
+};
const getDeliveredNotifications = async () => {
const notificationList = await PushNotifications.getDeliveredNotifications();
console.log('delivered notifications', notificationList);
-}
+};
```
## API
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 92f06b5..31cca49 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/package.json b/package.json
index 82f4152..37d687e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@haylltd/capacitor-push-notifications",
- "version": "1.0.0-alpha.2",
+ "version": "1.0.0-beta.1",
"description": "Improved push notification support for Capacitor apps",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
@@ -48,14 +48,14 @@
"@capacitor/android": "^4.0.0",
"@capacitor/cli": "^4.0.0",
"@capacitor/core": "^4.0.0",
- "@capacitor/docgen": "^0.0.18",
+ "@capacitor/docgen": "^0.2.0",
"@capacitor/ios": "^4.0.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@ionic/swiftlint-config": "^1.1.2",
"conventional-changelog-cli": "^2.2.2",
"eslint": "^7.11.0",
- "prettier": "~2.3.0",
+ "prettier": "~2.8.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.32.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c253ad9..17e9c9d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4,14 +4,14 @@ specifiers:
'@capacitor/android': ^4.0.0
'@capacitor/cli': ^4.0.0
'@capacitor/core': ^4.0.0
- '@capacitor/docgen': ^0.0.18
+ '@capacitor/docgen': ^0.2.0
'@capacitor/ios': ^4.0.0
'@ionic/eslint-config': ^0.3.0
'@ionic/prettier-config': ^1.0.1
'@ionic/swiftlint-config': ^1.1.2
conventional-changelog-cli: ^2.2.2
eslint: ^7.11.0
- prettier: ~2.3.0
+ prettier: ~2.8.0
prettier-plugin-java: ~1.0.2
rimraf: ^3.0.2
rollup: ^2.32.0
@@ -22,14 +22,14 @@ devDependencies:
'@capacitor/android': 4.7.3_@capacitor+core@4.7.3
'@capacitor/cli': 4.7.3
'@capacitor/core': 4.7.3
- '@capacitor/docgen': 0.0.18
+ '@capacitor/docgen': 0.2.1
'@capacitor/ios': 4.7.3_@capacitor+core@4.7.3
'@ionic/eslint-config': 0.3.0_j5k3gtgvc7l7uexttprsfsq27m
- '@ionic/prettier-config': 1.0.1_prettier@2.3.2
+ '@ionic/prettier-config': 1.0.1_prettier@2.8.7
'@ionic/swiftlint-config': 1.1.2
conventional-changelog-cli: 2.2.2
eslint: 7.32.0
- prettier: 2.3.2
+ prettier: 2.8.7
prettier-plugin-java: 1.0.2
rimraf: 3.0.2
rollup: 2.79.1
@@ -105,13 +105,13 @@ packages:
tslib: 2.5.0
dev: true
- /@capacitor/docgen/0.0.18:
- resolution: {integrity: sha512-BVqzrbSi9u5IaKRLlG0H/ZW8M23FDJpH2018RTGVHRn2Yk3na9jOcItBc3r+rYiwgRgAHylNw9Lt7+lWmJBD3Q==}
+ /@capacitor/docgen/0.2.1:
+ resolution: {integrity: sha512-COS5teC6n+EOSaBS7voHnIeIKH7owALnVoI1AhVArIWtBrc1JxSgkUuvLHpti4VGZdXdsrtp4yBPUwGm8WOZKA==}
engines: {node: '>=14.5.0'}
hasBin: true
dependencies:
'@types/node': 14.18.42
- colorette: 1.4.0
+ colorette: 2.0.19
github-slugger: 1.5.0
minimist: 1.2.8
typescript: 4.2.4
@@ -190,12 +190,12 @@ packages:
- typescript
dev: true
- /@ionic/prettier-config/1.0.1_prettier@2.3.2:
+ /@ionic/prettier-config/1.0.1_prettier@2.8.7:
resolution: {integrity: sha512-/v8UOW7rxkw/hvrRe/QfjlQsdjkm3sfAHoE3uqffO5BoNGijQMARrT32JT9Ei0g6KySXPyxxW+7LzPHrQmfzCw==}
peerDependencies:
prettier: ^2.0.0
dependencies:
- prettier: 2.3.2
+ prettier: 2.8.7
dev: true
/@ionic/swiftlint-config/1.1.2:
@@ -718,8 +718,8 @@ packages:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
dev: true
- /colorette/1.4.0:
- resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==}
+ /colorette/2.0.19:
+ resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==}
dev: true
/commander/9.5.0:
@@ -2370,8 +2370,8 @@ packages:
hasBin: true
dev: true
- /prettier/2.3.2:
- resolution: {integrity: sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==}
+ /prettier/2.8.7:
+ resolution: {integrity: sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==}
engines: {node: '>=10.13.0'}
hasBin: true
dev: true
diff --git a/src/definitions.ts b/src/definitions.ts
index d48ac8b..be69abe 100644
--- a/src/definitions.ts
+++ b/src/definitions.ts
@@ -75,6 +75,7 @@ export interface PushNotificationsPlugin {
* notification permissions, use `requestPermissions()` first.
*
* @since 1.0.0
+ * @return {Promise}
*/
register(): Promise;
@@ -82,6 +83,7 @@ export interface PushNotificationsPlugin {
* Get a list of notifications that are visible on the notifications screen.
*
* @since 1.0.0
+ * @return {Promise}
*/
getDeliveredNotifications(): Promise;
@@ -89,6 +91,8 @@ export interface PushNotificationsPlugin {
* Remove the specified notifications from the notifications screen.
*
* @since 1.0.0
+ * @param {DeliveredNotifications} delivered
+ * @return {Promise}
*/
removeDeliveredNotifications(
delivered: DeliveredNotifications,
@@ -98,6 +102,7 @@ export interface PushNotificationsPlugin {
* Remove all the notifications from the notifications screen.
*
* @since 1.0.0
+ * @return {Promise}
*/
removeAllDeliveredNotifications(): Promise;
@@ -107,6 +112,8 @@ export interface PushNotificationsPlugin {
* Only available on Android O or newer (SDK 26+).
*
* @since 1.0.0
+ * @param {Channel} channel
+ * @return {Promise}
*/
createChannel(channel: Channel): Promise;
@@ -116,6 +123,8 @@ export interface PushNotificationsPlugin {
* Only available on Android O or newer (SDK 26+).
*
* @since 1.0.0
+ * @param { {string} id } args
+ * @return {Promise}
*/
deleteChannel(args: { id: string }): Promise;
@@ -125,6 +134,7 @@ export interface PushNotificationsPlugin {
* Only available on Android O or newer (SDK 26+).
*
* @since 1.0.0
+ * @return {Promise}
*/
listChannels(): Promise;
@@ -136,6 +146,7 @@ export interface PushNotificationsPlugin {
* to display notifications, use local-notifications plugin.
*
* @since 1.0.0
+ * @return {Promise}
*/
checkPermissions(): Promise;
@@ -151,6 +162,7 @@ export interface PushNotificationsPlugin {
* the permission without prompting again.
*
* @since 1.0.0
+ * @return {Promise}
*/
requestPermissions(): Promise;
@@ -160,6 +172,9 @@ export interface PushNotificationsPlugin {
* Provides the push notification token.
*
* @since 1.0.0
+ * @param {string} eventName
+ * @param {({Token} token) => void} listenerFunc
+ * @return {Promise}
*/
addListener(
eventName: 'registration',
@@ -172,6 +187,9 @@ export interface PushNotificationsPlugin {
* Provides an error with the registration problem.
*
* @since 1.0.0
+ * @param {string} eventName
+ * @param {({RegistrationError} error) => void} listenerFunc
+ * @return {Promise}
*/
addListener(
eventName: 'registrationError',
@@ -182,6 +200,9 @@ export interface PushNotificationsPlugin {
* Called when the device receives a push notification.
*
* @since 1.0.0
+ * @param {string} eventName
+ * @param {({PushNotificationSchema} notification) => void} listenerFunc
+ * @return {Promise}
*/
addListener(
eventName: 'pushNotificationReceived',
@@ -192,6 +213,9 @@ export interface PushNotificationsPlugin {
* Called when an action is performed on a push notification.
*
* @since 1.0.0
+ * @param {string} eventName
+ * @param {({ActionPerformed} notification) => void} listenerFunc
+ * @return {Promise}
*/
addListener(
eventName: 'pushNotificationActionPerformed',
@@ -202,6 +226,7 @@ export interface PushNotificationsPlugin {
* Remove all native listeners for this plugin.
*
* @since 1.0.0
+ * @return {Promise}
*/
removeAllListeners(): Promise;
}
diff --git a/src/web.ts b/src/web.ts
deleted file mode 100644
index 853071d..0000000
--- a/src/web.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { WebPlugin } from '@capacitor/core';
-
-import type { PushNotificationsPlugin } from './definitions';
-
-export class PushNotificationsWeb
- extends WebPlugin
- implements PushNotificationsPlugin
-{
- async echo(options: { value: string }): Promise<{ value: string }> {
- console.log('ECHO', options);
- return options;
- }
-}