@unvired/cordova-plugin-unvired-universal-sdk 1.0.196 → 1.0.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,4 +60,48 @@ https://github.com/ionic-team/ionic-native/tree/master/src/%40ionic-native/plugi
60
60
 
61
61
  The source contains a single file, index.ts which contains declarations of all the functions available in www/kernel.js file of this repo. To expose newly added methods in kernel.js, you will have to fork https://github.com/ionic-team/ionic-native repo to your GitHub repo, make changes and submit a pull request.
62
62
 
63
- Once the Pull request is approved, the new method should be available publicly for all the users.
63
+ Once the Pull request is approved, the new method should be available publicly for all the users.
64
+
65
+ # Push Notifications (Firebase)
66
+
67
+ ## Electron Setup
68
+
69
+ For push notifications to work in an Electron environment, you must expose an Inter-Process Communication (IPC) bridge so the web app can communicate with the main process for Firebase Cloud Messaging (FCM).
70
+
71
+ In your Electron project's preload script (e.g., `cdv-electron-preload.js`), ensure you expose the `electronAPI` with the `fcm` object as shown below:
72
+
73
+ ```javascript
74
+ const { contextBridge, ipcRenderer, shell } = require('electron');
75
+
76
+ contextBridge.exposeInMainWorld('electronAPI', {
77
+ // ... other exposed APIs ...
78
+
79
+ fcm: {
80
+ startService: (firebaseCredentials) => ipcRenderer.send('PUSH_RECEIVER:::START_NOTIFICATION_SERVICE', firebaseCredentials),
81
+ onNotification: (callback) => {
82
+ ipcRenderer.on('PUSH_RECEIVER:::NOTIFICATION_RECEIVED', (event, notification) => {
83
+ callback(notification);
84
+ });
85
+ },
86
+ onToken: (callback) => {
87
+ ipcRenderer.on('PUSH_RECEIVER:::TOKEN_UPDATED', (event, token) => {
88
+ callback(token);
89
+ });
90
+ ipcRenderer.on('PUSH_RECEIVER:::NOTIFICATION_SERVICE_STARTED', (event, token) => {
91
+ callback(token);
92
+ });
93
+ },
94
+ onError: (callback) => {
95
+ ipcRenderer.on('PUSH_RECEIVER:::NOTIFICATION_SERVICE_ERROR', (event, error) => {
96
+ callback(error);
97
+ });
98
+ }
99
+ }
100
+ });
101
+ ```
102
+
103
+ ## Web / Browser Setup
104
+
105
+ For web apps running in a standard browser, you must include the `firebase-messaging-sw.js` service worker file at the **root level** of your web application (e.g., in the same directory as your `index.html` or in your `public` folder).
106
+
107
+ This service worker is mandatory for the browser to successfully register for FCM tokens and receive background push messages from Firebase.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvired/cordova-plugin-unvired-universal-sdk",
3
- "version": "1.0.196",
3
+ "version": "1.0.198",
4
4
  "description": "Unvired Cordova Plugin",
5
5
  "scripts": {
6
6
  "build": "webpack -c webpack.config.js",
package/plugin.xml CHANGED
@@ -1,8 +1,8 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="@unvired/cordova-plugin-unvired-universal-sdk" version="1.0.196" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="@unvired/cordova-plugin-unvired-universal-sdk" version="1.0.198" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>UnviredSDK</name>
4
4
  <dependency id="@unvired/cordova-plugin-unvired-device" version="^1.0.7" />
5
- <dependency id="@unvired/cordova-plugin-unvired-electron-db" version="^0.0.43" />
5
+ <dependency id="@unvired/cordova-plugin-unvired-electron-db" version="^0.0.44" />
6
6
  <dependency id="@unvired/cordova-plugin-unvired-logger" version="^0.0.30" />
7
7
  <dependency id="cordova-plugin-firebase-messaging" version="^8.0.1" />
8
8