pushwoosh-cordova-plugin 8.2.3 → 8.3.2

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
@@ -14,13 +14,13 @@ Cross-Platform push notifications by Pushwoosh for Cordova / PhoneGap
14
14
  Using npm (requires cordova 7.0+):
15
15
 
16
16
  ```
17
- cordova plugin add pushwoosh-cordova-plugin@8.2.3
17
+ cordova plugin add pushwoosh-cordova-plugin@8.3.2
18
18
  ```
19
19
 
20
20
  Using git:
21
21
 
22
22
  ```
23
- cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.2.3
23
+ cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.2
24
24
  ```
25
25
 
26
26
  #### Phonegap
@@ -28,7 +28,7 @@ cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.
28
28
  Using npm (requires phonegap 7.1+):
29
29
 
30
30
  ```
31
- cordova plugin add pushwoosh-cordova-plugin@8.2.3
31
+ cordova plugin add pushwoosh-cordova-plugin@8.3.2
32
32
  ```
33
33
 
34
34
  ### Guide
package/README_PGB.md CHANGED
@@ -14,7 +14,7 @@ Cross-Platform push notifications by Pushwoosh for PhoneGap
14
14
  Using npm (requires cordova 5.0+):
15
15
 
16
16
  ```
17
- cordova plugin add pushwoosh-pgb-plugin@8.2.3
17
+ cordova plugin add pushwoosh-pgb-plugin@8.3.2
18
18
  ```
19
19
 
20
20
  ### Guide
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwoosh-cordova-plugin",
3
- "version": "8.2.3",
3
+ "version": "8.3.2",
4
4
  "description": "\n This plugin allows you to send and receive push notifications. Powered by Pushwoosh (www.pushwoosh.com).\n ",
5
5
  "cordova": {
6
6
  "id": "pushwoosh-cordova-plugin",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="pushwoosh-cordova-plugin" version="8.2.3">
2
+ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="pushwoosh-cordova-plugin" version="8.3.2">
3
3
 
4
4
  <name>Pushwoosh</name>
5
5
 
@@ -26,7 +26,10 @@
26
26
 
27
27
  <!-- android -->
28
28
  <platform name="android">
29
- <framework src="build.gradle" custom="true" type="gradleReference" />
29
+ <config-file target="config.xml" parent="/*">
30
+ <preference name="GradlePluginGoogleServicesEnabled" value="true" />
31
+ <preference name="GradlePluginGoogleServicesVersion" value="4.3.10" />
32
+ </config-file>
30
33
 
31
34
  <config-file target="AndroidManifest.xml" parent="/manifest/application">
32
35
  <meta-data android:name="com.pushwoosh.log_level" android:value="$LOG_LEVEL" />
@@ -35,6 +38,12 @@
35
38
  <meta-data android:name="com.pushwoosh.notification_service_extension" android:value="com.pushwoosh.plugin.pushnotifications.PushwooshNotificationServiceExtension" />
36
39
 
37
40
  <meta-data android:name="com.pushwoosh.internal.plugin_provider" android:value="com.pushwoosh.plugin.internal.PhonegapPluginProvider" />
41
+
42
+ <!-- <service android:name="com.pushwoosh.plugin.pushnotifications.CustomFirebaseMessagingService" android:exported="false">-->
43
+ <!-- <intent-filter>-->
44
+ <!-- <action android:name="com.google.firebase.MESSAGING_EVENT"/>-->
45
+ <!-- </intent-filter>-->
46
+ <!-- </service>-->
38
47
  </config-file>
39
48
 
40
49
  <config-file target="res/xml/config.xml" parent="/*">
@@ -51,6 +60,9 @@
51
60
 
52
61
  <source-file src="src/android/src/com/pushwoosh/plugin/pushnotifications/PushwooshNotificationServiceExtension.java"
53
62
  target-dir="src/com/pushwoosh/plugin/pushnotifications" />
63
+
64
+ <source-file src="src/android/src/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java"
65
+ target-dir="src/com/pushwoosh/plugin/pushnotifications"/>
54
66
 
55
67
  <source-file src="src/android/src/com/pushwoosh/plugin/internal/PhonegapPluginProvider.java"
56
68
  target-dir="src/com/pushwoosh/plugin/internal" />
@@ -65,13 +77,13 @@
65
77
  <framework src="com.android.support.constraint:constraint-layout:1.0.2" />
66
78
  <framework src="com.github.bumptech.glide:glide:4.7.1" />
67
79
  <framework src="org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60" />
68
- <framework src="com.pushwoosh:pushwoosh:6.3.6"/>
69
- <framework src="com.pushwoosh:pushwoosh-amazon:6.3.6"/>
70
- <framework src="com.pushwoosh:pushwoosh-firebase:6.3.6"/>
71
- <framework src="com.pushwoosh:pushwoosh-badge:6.3.6"/>
72
- <framework src="com.pushwoosh:pushwoosh-inbox:6.3.6"/>
73
- <framework src="com.pushwoosh:pushwoosh-inbox-ui:6.3.6"/>
74
- <framework src="com.pushwoosh:pushwoosh-huawei:6.3.6"/>
80
+ <framework src="com.pushwoosh:pushwoosh:6.4.4"/>
81
+ <framework src="com.pushwoosh:pushwoosh-amazon:6.4.4"/>
82
+ <framework src="com.pushwoosh:pushwoosh-firebase:6.4.4"/>
83
+ <framework src="com.pushwoosh:pushwoosh-badge:6.4.4"/>
84
+ <framework src="com.pushwoosh:pushwoosh-inbox:6.4.4"/>
85
+ <framework src="com.pushwoosh:pushwoosh-inbox-ui:6.4.4"/>
86
+ <framework src="com.pushwoosh:pushwoosh-huawei:6.4.4"/>
75
87
  </platform>
76
88
 
77
89
  <!-- ios -->
@@ -0,0 +1,29 @@
1
+ package com.pushwoosh.plugin.pushnotifications;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.google.firebase.messaging.FirebaseMessagingService;
6
+ import com.google.firebase.messaging.RemoteMessage;
7
+ import com.pushwoosh.firebase.PushwooshFcmHelper;
8
+
9
+ public class CustomFirebaseMessagingService extends FirebaseMessagingService {
10
+ @Override
11
+ public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
12
+ if (PushwooshFcmHelper.isPushwooshMessage(remoteMessage)){
13
+ PushwooshFcmHelper.onMessageReceived(this, remoteMessage);
14
+ } else {
15
+ //handle push from a different service here
16
+ }
17
+ }
18
+
19
+ @Override
20
+ public void onNewToken(@NonNull String s) {
21
+ super.onNewToken(s);
22
+ PushwooshFcmHelper.onTokenRefresh(s);
23
+ sendTokenToAnotherService();
24
+ }
25
+
26
+ public void sendTokenToAnotherService() {
27
+ //handle push registration of another service here
28
+ }
29
+ }
@@ -165,6 +165,11 @@ public class PushNotifications extends CordovaPlugin {
165
165
  return true;
166
166
  }
167
167
 
168
+ @CordovaMethod
169
+ private boolean additionalAuthorizationOptions(JSONArray data, CallbackContext callbackContext) {
170
+ // Stub, this is iOS only method
171
+ }
172
+
168
173
  @CordovaMethod
169
174
  private boolean registerDevice(JSONArray data, CallbackContext callbackContext) {
170
175
  try {
@@ -300,14 +305,12 @@ public class PushNotifications extends CordovaPlugin {
300
305
  if (message == null) {
301
306
  return false;
302
307
  }
303
-
304
- String userData = params.getString("userData");
305
-
308
+
306
309
  Bundle extras = new Bundle();
307
- if (userData != null) {
308
- extras.putString("u", userData);
310
+ if (params.has("userData")) {
311
+ extras.putString("u", params.getString("userData"));
309
312
  }
310
-
313
+
311
314
  LocalNotification notification = new LocalNotification.Builder()
312
315
  .setMessage(message)
313
316
  .setDelay(seconds)
@@ -160,6 +160,28 @@ static PushNotification *pw_PushNotificationPlugin;
160
160
  [[NSUserDefaults standardUserDefaults] synchronize];
161
161
  }
162
162
 
163
+ // Authorization options in addition to UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay. Should be called before registering for pushes
164
+ - (void)additionalAuthorizationOptions:(CDVInvokedUrlCommand *)command {
165
+ NSDictionary *options = [command.arguments firstObject];
166
+ NSString* critical = options[@"UNAuthorizationOptionCriticalAlert"];
167
+ NSString* provisional = options[@"UNAuthorizationOptionProvisional"];
168
+ NSString* providesSettings = options[@"UNAuthorizationOptionProvidesAppNotificationSettings"];
169
+
170
+ UNAuthorizationOptions authOptions = 0;
171
+ if (@available(iOS 12.0, *)) {
172
+ if (critical) {
173
+ authOptions |= UNAuthorizationOptionCriticalAlert;
174
+ }
175
+ if (provisional) {
176
+ authOptions |= UNAuthorizationOptionProvisional;
177
+ }
178
+ if (providesSettings) {
179
+ authOptions |= UNAuthorizationOptionProvidesAppNotificationSettings;
180
+ }
181
+ [Pushwoosh sharedInstance].additionalAuthorizationOptions = authOptions;
182
+ }
183
+ }
184
+
163
185
  - (void)dispatchPushReceive:(NSDictionary *)pushData {
164
186
  NSData *json = [NSJSONSerialization dataWithJSONObject:pushData options:NSJSONWritingPrettyPrinted error:nil];
165
187
  NSString *jsonString = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
@@ -18,7 +18,7 @@
18
18
 
19
19
  #endif
20
20
 
21
- #define PUSHWOOSH_VERSION @"6.3.1"
21
+ #define PUSHWOOSH_VERSION @"6.3.5"
22
22
 
23
23
 
24
24
  @class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
@@ -79,6 +79,26 @@ PushNotification.prototype.registerDevice = function(success, fail) {
79
79
  exec(success, fail, "PushNotification", "registerDevice", []);
80
80
  };
81
81
 
82
+ //Function: additionalAuthorizationOptions
83
+ //[ios] Authorization options in addition to UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay.
84
+ //Should be called before registering for pushes
85
+ //
86
+ //Parameters:
87
+ // "options.UNAuthorizationOptionCriticalAlert" - adds UNAuthorizationOptionCriticalAlert option
88
+ // "options.UNAuthorizationOptionProvisional" - adds UNAuthorizationOptionProvisional option
89
+ // "options.UNAuthorizationOptionProvidesAppNotificationSettings" - adds UNAuthorizationOptionProvidesAppNotificationSettings option
90
+ //
91
+ //Example:
92
+ //(start code)
93
+ // pushwoosh.additionalAuthorizationOptions({
94
+ // "UNAuthorizationOptionCriticalAlert" : 1,
95
+ // "UNAuthorizationOptionProvisional": 0 // set 0 or don't specify the option if you don't want to add it to your app.
96
+ // });
97
+ //(end)
98
+ PushNotification.prototype.additionalAuthorizationOptions = function(options) {
99
+ exec(null, null, "PushNotification", "additionalAuthorizationOptions", options ? [options] : []);
100
+ }
101
+
82
102
  //Function: unregisterDevice
83
103
  //[android, ios, wp8, windows] Unregister device form receiving push notifications
84
104
  //
package/build.gradle DELETED
@@ -1,25 +0,0 @@
1
- buildscript {
2
- repositories {
3
- jcenter()
4
- maven {
5
- url "https://maven.google.com"
6
- }
7
- }
8
-
9
- dependencies {
10
- classpath 'com.android.tools.build:gradle:3.+'
11
- classpath 'com.google.gms:google-services:4.3.3'
12
- }
13
- }
14
-
15
- cdvPluginPostBuildExtras.add({
16
- rootProject.subprojects {
17
- if (name == "app") {
18
- if (!plugins.hasPlugin('com.google.gms.google-services')) {
19
- apply {
20
- plugin com.google.gms.googleservices.GoogleServicesPlugin
21
- }
22
- }
23
- }
24
- }
25
- })