pushwoosh-react-native-plugin 6.1.55 → 6.1.56

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
@@ -53,17 +53,28 @@ npm install pushwoosh-react-native-plugin --save
53
53
  cd ios && pod install
54
54
  ```
55
55
 
56
- ### Android Setup
56
+ ### Android Setup (Firebase Cloud Messaging)
57
57
 
58
- Add to your project's `build.gradle`:
58
+ Push notifications on Android require Firebase Cloud Messaging (FCM).
59
59
 
60
- ```groovy
61
- buildscript {
62
- dependencies {
63
- classpath 'com.google.gms:google-services:4.3.15'
64
- }
65
- }
66
- ```
60
+ **Option A — Android Studio (recommended):**
61
+ Open the `android/` folder in Android Studio, then go to
62
+ Tools > Firebase > Cloud Messaging > Set up Firebase Cloud Messaging.
63
+ The wizard will automatically add all required configuration.
64
+
65
+ **Option B — Manual setup:**
66
+ 1. Create a project in [Firebase Console](https://console.firebase.google.com)
67
+ 2. Download `google-services.json` and place it in `android/app/`
68
+ 3. Add the Google Services classpath to `android/build.gradle`:
69
+ ```groovy
70
+ classpath("com.google.gms:google-services:4.3.15")
71
+ ```
72
+ 4. Apply the plugin in `android/app/build.gradle`:
73
+ ```groovy
74
+ apply plugin: "com.google.gms.google-services"
75
+ ```
76
+
77
+ The Pushwoosh plugin already includes the `firebase-messaging` dependency, so you do not need to add it manually.
67
78
 
68
79
  ## AI-Assisted Integration
69
80
 
@@ -131,8 +142,7 @@ DeviceEventEmitter.addListener('pushOpened', (e) => {
131
142
 
132
143
  // Initialize Pushwoosh
133
144
  Pushwoosh.init({
134
- pw_appid: "YOUR_PUSHWOOSH_APP_ID",
135
- project_number: "YOUR_FCM_SENDER_ID"
145
+ pw_appid: "YOUR_PUSHWOOSH_APP_ID"
136
146
  });
137
147
 
138
148
  // Register for push notifications
@@ -228,7 +238,6 @@ import Pushwoosh from 'pushwoosh-react-native-plugin';
228
238
 
229
239
  Pushwoosh.init({
230
240
  pw_appid: "YOUR_PUSHWOOSH_APP_ID",
231
- project_number: "YOUR_FCM_SENDER_ID",
232
241
  pw_notification_handling: "CUSTOM"
233
242
  });
234
243
  ```
@@ -318,6 +327,12 @@ Pushwoosh.init({
318
327
  | `setCommunicationEnabled(enable, success?, fail?)` | Enable/disable all Pushwoosh communication |
319
328
  | `isCommunicationEnabled(success)` | Check if communication is enabled |
320
329
 
330
+ ### Reverse Proxy
331
+
332
+ | Method | Description |
333
+ |--------|-------------|
334
+ | `setReverseProxy(url, headers?)` | Route all SDK requests through a reverse proxy. Call before `init()` |
335
+
321
336
  ### Events (DeviceEventEmitter)
322
337
 
323
338
  | Event | Description |
package/docs/README.md CHANGED
@@ -8,7 +8,7 @@ Example:
8
8
  ```js
9
9
  var Pushwoosh = require('pushwoosh-react-native-plugin');
10
10
 
11
- Pushwoosh.init({ "pw_appid" : "PUSHWOOSH_APP_ID" , "project_number" : "GOOGLE_PROJECT_NUMBER" });
11
+ Pushwoosh.init({ "pw_appid" : "PUSHWOOSH_APP_ID" });
12
12
 
13
13
  Pushwoosh.register(
14
14
  (token) => {
@@ -61,6 +61,7 @@ DeviceEventEmitter.addListener('pushOpened', (e: Event) => {
61
61
  <tr class="even"><td><a href="#enableHuaweiPushNotifications">enableHuaweiPushNotifications()</a></td></tr>
62
62
  <tr class="even"><td><a href="#registersmsnumber">registerSMSNumber(phoneNumber)</a></td></tr>
63
63
  <tr class="even"><td><a href="#registerwhatsappnumber">registerWhatsappNumber(phoneNumber)</a></td></tr>
64
+ <tr class="even"><td><a href="#setreverseproxy">setReverseProxy(url, headers)</a></td></tr>
64
65
  <tr>
65
66
  <th align="left" colspan="2"><strong>Events</strong></th>
66
67
  </tr>
@@ -77,7 +78,7 @@ DeviceEventEmitter.addListener('pushOpened', (e: Event) => {
77
78
  init(config, success, fail)
78
79
  ```
79
80
 
80
- Initializes Pushwoosh module with application id and google project number.
81
+ Initializes Pushwoosh module with application id.
81
82
 
82
83
  <table width=100% style='background-color:#0EA7ED;'>
83
84
  <colgroup>
@@ -91,8 +92,6 @@ Initializes Pushwoosh module with application id and google project number.
91
92
  </tr>
92
93
  <tr class="even"><td>object</td><td><b>config</b></td><td>Pushwoosh initialization config.</td></tr>
93
94
  <tr class="even"><td>string</td><td><b>config.pw_appid</b></td><td>Pushwoosh application id.</td></tr>
94
- <tr class="even"><td>string</td><td><b>config.project_number</b></td><td>GCM project number (for Android push notifications).</td></tr>
95
- <tr class="even"><td>string</td><td><b>config.reverse_proxy_url</b></td><td>(optional) Url to your reverse proxy.</td></tr>
96
95
  <tr class="even"><td>string</td><td><b>config.pw_notification_handling</b></td><td>(optional) To use custom notification handling on iOS specify the parameter "pw_notification_handling" to "CUSTOM".</td></tr>
97
96
  <tr class="even"><td>function</td><td><b>success</b></td><td>(optional) initialization success callback.</td></tr>
98
97
  <tr class="even"><td>function</td><td><b>fail</b></td><td>(optional) initialization failure callback.</td></tr>
@@ -484,6 +483,40 @@ registerWhatsappNumber(phoneNumber)
484
483
  Registers WhatsApp number associated to the current user.
485
484
  WhatsApp numbers must be in E.164 format (e.g., "+1234567890") and be valid.
486
485
 
486
+ ### setReverseProxy
487
+
488
+ ```js
489
+ setReverseProxy(url, headers)
490
+ ```
491
+ **[android, ios]**
492
+ Routes all SDK network requests through a reverse proxy server. Must be called before `init()`.
493
+
494
+ <table width=100% style='background-color:#0EA7ED;'>
495
+ <colgroup>
496
+ <col width="10%" />
497
+ <col width="20%" />
498
+ <col width="70%" />
499
+ </colgroup>
500
+ <tbody>
501
+ <tr>
502
+ <th align="left" colspan="3"><strong>Parameters</strong></th>
503
+ </tr>
504
+ <tr class="even"><td>string</td><td><b>url</b></td><td>Reverse proxy URL.</td></tr>
505
+ <tr class="even"><td>object</td><td><b>headers</b></td><td>(optional) Custom HTTP headers for all requests.</td></tr>
506
+ </tbody>
507
+ </table>
508
+
509
+ **Prerequisites:**
510
+ - **Android:** add `<meta-data android:name="com.pushwoosh.allow_reverse_proxy" android:value="true" />` to AndroidManifest.xml
511
+ - **iOS:** add `Pushwoosh_ALLOW_REVERSE_PROXY = YES` to Info.plist
512
+
513
+ Example:
514
+
515
+ ```js
516
+ Pushwoosh.setReverseProxy("https://your-proxy.example.com/", { "X-Proxy-Auth": "my-token" });
517
+ Pushwoosh.init({ "pw_appid": "XXXXX-XXXXX" });
518
+ ```
519
+
487
520
  ### pushReceived
488
521
 
489
522
  ```js
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  declare module 'pushwoosh-react-native-plugin' {
2
2
  interface PushwooshConfig {
3
3
  pw_appid: string;
4
- project_number: string;
4
+ /** @deprecated FCM Sender ID is no longer required. Firebase Cloud Messaging configuration is handled automatically via google-services.json. */
5
+ project_number?: string;
5
6
  pw_notification_handling?: string;
6
7
  }
7
8
  type LocalNotification = {
@@ -28,6 +29,7 @@ declare module 'pushwoosh-react-native-plugin' {
28
29
 
29
30
  interface Pushwoosh {
30
31
  //general interaction with Pushwoosh
32
+ setReverseProxy(url: string, headers?: Record<string, string>): void;
31
33
  init(config: PushwooshConfig, success?: () => void, fail?: () => void): void;
32
34
  createLocalNotification(notification: LocalNotification): void;
33
35
  clearLocalNotification(): void;
package/index.js CHANGED
@@ -15,6 +15,29 @@
15
15
  * cd ios && pod install
16
16
  * ```
17
17
  *
18
+ * @section Android Setup (Firebase Cloud Messaging)
19
+ *
20
+ * Push notifications on Android require Firebase Cloud Messaging (FCM).
21
+ * Add Firebase to your Android project using one of the following methods:
22
+ *
23
+ * Option A — Android Studio (recommended):
24
+ * Open the `android/` folder in Android Studio, then go to
25
+ * Tools → Firebase → Cloud Messaging → Set up Firebase Cloud Messaging.
26
+ * The wizard will automatically add all required configuration.
27
+ *
28
+ * Option B — Manual setup:
29
+ * 1. Create a project in the Firebase Console (https://console.firebase.google.com)
30
+ * 2. Download `google-services.json` and place it in `android/app/`
31
+ * 3. Add the Google Services classpath to `android/build.gradle`:
32
+ * `classpath("com.google.gms:google-services:4.3.15")`
33
+ * 4. Apply the plugin in `android/app/build.gradle`:
34
+ * `apply plugin: "com.google.gms.google-services"`
35
+ *
36
+ * The Pushwoosh plugin already includes the `firebase-messaging` dependency,
37
+ * so you do not need to add it manually.
38
+ *
39
+ * For more details, see: https://firebase.google.com/docs/android/setup
40
+ *
18
41
  * @section Quick Start
19
42
  *
20
43
  * Step 1: Initialize the plugin and register for push notifications
@@ -30,8 +53,7 @@
30
53
  *
31
54
  * // Initialize Pushwoosh
32
55
  * Pushwoosh.init({
33
- * pw_appid: "XXXXX-XXXXX",
34
- * project_number: "YOUR_FCM_SENDER_ID"
56
+ * pw_appid: "XXXXX-XXXXX"
35
57
  * });
36
58
  *
37
59
  * // Register for push notifications
@@ -162,7 +184,6 @@
162
184
  *
163
185
  * Pushwoosh.init({
164
186
  * pw_appid: "XXXXX-XXXXX",
165
- * project_number: "YOUR_FCM_SENDER_ID",
166
187
  * pw_notification_handling: "CUSTOM"
167
188
  * });
168
189
  * ```
@@ -170,9 +191,7 @@
170
191
  * @section Configuration Parameters
171
192
  *
172
193
  * - pw_appid (required) - Pushwoosh Application ID from Control Panel
173
- * - project_number (required for Android) - FCM Sender ID
174
194
  * - pw_notification_handling (optional, iOS) - Set to "CUSTOM" for custom notification handling
175
- * - reverse_proxy_url (optional) - URL to reverse proxy for Pushwoosh server communication
176
195
  *
177
196
  * @section Events (DeviceEventEmitter)
178
197
  *
@@ -210,13 +229,55 @@ const RichMediaStyle = {
210
229
  */
211
230
  class PushNotification {
212
231
 
232
+ //Function: setReverseProxy
233
+ //Routes all SDK network requests through a reverse proxy server instead of Pushwoosh servers directly.
234
+ //The proxy server must be configured to forward requests to Pushwoosh APIs.
235
+ //
236
+ //Settings are not persisted and must be set on every app start.
237
+ //Must be called before init() to ensure no SDK requests are sent without the proxy.
238
+ //
239
+ //When the reverse proxy flag is enabled, the SDK blocks all network requests until
240
+ //setReverseProxy() is called. This guarantees that no traffic goes directly to Pushwoosh servers.
241
+ //
242
+ //Prerequisites:
243
+ // Android: add the following meta-data to AndroidManifest.xml:
244
+ // <meta-data android:name="com.pushwoosh.allow_reverse_proxy" android:value="true" />
245
+ //
246
+ // iOS: add the following key to Info.plist (main app target):
247
+ // Pushwoosh_ALLOW_REVERSE_PROXY = YES
248
+ //
249
+ // iOS Notification Service Extension (required for delivery tracking via proxy):
250
+ // If your app uses a Notification Service Extension (NSE), you must configure App Groups
251
+ // so the main app can share the proxy URL with the extension process:
252
+ // 1. In Xcode, enable the "App Groups" capability for both the main app target
253
+ // and the NSE target with the same group identifier (e.g. "group.com.yourcompany.app").
254
+ // 2. Add the following keys to Info.plist of BOTH the main app and the NSE target:
255
+ // PW_APP_GROUPS_NAME = group.com.yourcompany.app
256
+ // Pushwoosh_ALLOW_REVERSE_PROXY = YES
257
+ // Pushwoosh_APPID = XXXXX-XXXXX
258
+ // Without App Groups, the NSE cannot access the proxy URL and delivery event
259
+ // requests will either be sent directly to Pushwoosh servers or be silently dropped.
260
+ //
261
+ //Parameters:
262
+ // "url" - reverse proxy URL (must be a valid https:// or http:// URL)
263
+ // "headers" - optional map of custom HTTP headers to include in all requests (e.g. authorization headers)
264
+ //
265
+ //Example:
266
+ //(start code)
267
+ // Pushwoosh.setReverseProxy("https://your-proxy.example.com/", { "X-Proxy-Auth": "my-token" });
268
+ // Pushwoosh.init({ pw_appid: "XXXXX-XXXXX" });
269
+ // Pushwoosh.register();
270
+ //(end)
271
+ setReverseProxy(url: string, headers: ?Object) {
272
+ PushwooshModule.setReverseProxy(url, headers || null);
273
+ }
274
+
213
275
  //Function: init
214
- //Call this first thing with your Pushwoosh App ID (pw_appid parameter) and Google Project ID for Android (projectid parameter)
276
+ //Call this first thing with your Pushwoosh App ID (pw_appid parameter).
215
277
  //
216
278
  //Example:
217
279
  //(start code)
218
- // //initialize Pushwoosh with projectid: "GOOGLE_PROJECT_ID", appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start.
219
- // Pushwoosh.init({ projectid: "XXXXXXXXXXXXXXX", pw_appid : "XXXXX-XXXXX" });
280
+ // Pushwoosh.init({ pw_appid: "XXXXX-XXXXX" });
220
281
  //(end)
221
282
  init(config: Object, success: ?Function, fail: ?Function) {
222
283
  if (!success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwoosh-react-native-plugin",
3
- "version": "6.1.55",
3
+ "version": "6.1.56",
4
4
  "description": "This plugin allows you to send and receive push notifications. Powered by Pushwoosh (www.pushwoosh.com).",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "pushwoosh-react-native-plugin"
3
- s.version = "6.1.55"
3
+ s.version = "6.1.56"
4
4
  s.summary = "React Native Pushwoosh Push Notifications module"
5
5
  s.requires_arc = true
6
6
  s.author = 'Pushwoosh'
@@ -15,6 +15,6 @@ Pod::Spec.new do |s|
15
15
  s.static_framework = true
16
16
 
17
17
  s.dependency 'React'
18
- s.dependency 'PushwooshXCFramework', '7.0.29'
18
+ s.dependency 'PushwooshXCFramework', '7.0.32'
19
19
  s.dependency 'PushwooshInboxUIXCFramework'
20
20
  end
@@ -34,7 +34,6 @@ import com.pushwoosh.inbox.PushwooshInbox;
34
34
  import com.pushwoosh.inbox.data.InboxMessage;
35
35
  import com.pushwoosh.inbox.exception.InboxMessagesException;
36
36
  import com.pushwoosh.inbox.ui.presentation.view.activity.InboxActivity;
37
- import com.pushwoosh.internal.network.NetworkModule;
38
37
  import com.pushwoosh.internal.platform.AndroidPlatformModule;
39
38
  import com.pushwoosh.internal.utils.PWLog;
40
39
  import com.pushwoosh.notification.PushwooshNotificationSettings;
@@ -50,6 +49,8 @@ import org.json.JSONObject;
50
49
 
51
50
  import java.util.ArrayList;
52
51
  import java.util.Collection;
52
+ import java.util.HashMap;
53
+ import java.util.Map;
53
54
 
54
55
  public class PushwooshPlugin extends ReactContextBaseJavaModule implements LifecycleEventListener {
55
56
 
@@ -95,25 +96,30 @@ public class PushwooshPlugin extends ReactContextBaseJavaModule implements Lifec
95
96
  return "Pushwoosh";
96
97
  }
97
98
 
99
+ @ReactMethod
100
+ public void setReverseProxy(String url, ReadableMap headers) {
101
+ Map<String, String> headersMap = null;
102
+ if (headers != null) {
103
+ headersMap = new HashMap<>();
104
+ for (Map.Entry<String, Object> entry : headers.toHashMap().entrySet()) {
105
+ headersMap.put(entry.getKey(), String.valueOf(entry.getValue()));
106
+ }
107
+ }
108
+ Pushwoosh.getInstance().setReverseProxy(url, headersMap);
109
+ }
110
+
98
111
  @ReactMethod
99
112
  public void init(ReadableMap config, Callback success, Callback error) {
100
- String appId = config.getString("pw_appid");
101
- String projectId = config.getString("project_number");
113
+ String appId = config.hasKey("pw_appid") ? config.getString("pw_appid") : null;
114
+ String projectId = config.hasKey("project_number") ? config.getString("project_number") : null;
102
115
 
103
- if (appId == null || projectId == null) {
116
+ if (appId == null) {
104
117
  if (error != null) {
105
- error.invoke("Pushwoosh Application id and GCM project number not specified");
118
+ error.invoke("Pushwoosh Application id not specified");
106
119
  }
107
120
  return;
108
121
  }
109
122
 
110
- if (config.hasKey("reverse_proxy_url")) {
111
- String proxyUrl = config.getString("reverse_proxy_url");
112
- if (!TextUtils.isEmpty(proxyUrl) && NetworkModule.getRequestManager() != null) {
113
- NetworkModule.getRequestManager().setReverseProxyUrl(proxyUrl, null);
114
- }
115
- }
116
-
117
123
  Pushwoosh.getInstance().setAppId(appId);
118
124
 
119
125
  if (!TextUtils.isEmpty(projectId)) {
@@ -15,6 +15,7 @@
15
15
 
16
16
  #import <UserNotifications/UserNotifications.h>
17
17
  #import <PushwooshFramework/PushNotificationManager.h>
18
+ #import <PushwooshCore/PushwooshConfig.h>
18
19
 
19
20
  #import <objc/runtime.h>
20
21
  #import <objc/message.h>
@@ -127,11 +128,6 @@ RCT_EXPORT_METHOD(init:(NSDictionary*)config success:(RCTResponseSenderBlock)suc
127
128
  return;
128
129
  }
129
130
 
130
- NSString *proxyUrl = config[@"reverse_proxy_url"];
131
- if (proxyUrl && ![proxyUrl isEqualToString:@""]) {
132
- [[Pushwoosh sharedInstance] setReverseProxy:proxyUrl];
133
- }
134
-
135
131
  [PushNotificationManager initializeWithAppCode:appCode appName:nil];
136
132
  [[PushNotificationManager pushManager] sendAppOpen];
137
133
  [PushNotificationManager pushManager].delegate = self;
@@ -896,6 +892,10 @@ RCT_EXPORT_METHOD(clearNotificationCenter){
896
892
  }
897
893
 
898
894
 
895
+ RCT_EXPORT_METHOD(setReverseProxy:(NSString *)url headers:(NSDictionary *)headers) {
896
+ [PushwooshConfig setReverseProxy:url headers:headers];
897
+ }
898
+
899
899
  RCT_EXPORT_METHOD(enableHuaweiPushNotifications) {
900
900
  // available in Android only
901
901
  }