pushwoosh-cordova-plugin 8.3.39 → 8.3.41

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.
@@ -13,8 +13,8 @@
13
13
  "author": "Apache Cordova Team",
14
14
  "license": "Apache-2.0",
15
15
  "devDependencies": {
16
- "cordova-android": "^12.0.1",
17
- "cordova-ios": "^7.1.0",
16
+ "cordova-android": "^14.0.1",
17
+ "cordova-ios": "^7.1.1",
18
18
  "pushwoosh-cordova-plugin": "file:../.."
19
19
  },
20
20
  "cordova": {
@@ -26,7 +26,8 @@
26
26
  "pushwoosh-cordova-plugin": {
27
27
  "LOG_LEVEL": "DEBUG",
28
28
  "IOS_FOREGROUND_ALERT_TYPE": "NONE",
29
- "ANDROID_FOREGROUND_PUSH": "false"
29
+ "ANDROID_FOREGROUND_PUSH": "false",
30
+ "PW_VOIP_IOS_ENABLED": "true"
30
31
  }
31
32
  }
32
33
  }
@@ -54,6 +54,12 @@
54
54
 
55
55
  <div class="gap"></div>
56
56
 
57
+ <div class="container_btns">
58
+ <button class="btn_get" id="endCall">END CALL</button>
59
+ </div>
60
+
61
+ <div class="gap"></div>
62
+
57
63
  <div class="container_lang">
58
64
  <button class="btn" id="setLangBtn">SET LANGUAGE</button>
59
65
  <div class="input-container">
@@ -29,9 +29,59 @@ function onDeviceReady() {
29
29
 
30
30
  pushwooshInitialize(pushwoosh);
31
31
 
32
+ pushwoosh.setVoipAppCode("7BCDB-76CBE");
33
+ pushwoosh.initializeVoIPParameters(true, "ring.caf", 2, function(success) {
34
+ console.log("Success:", success);
35
+ }, function(error) {
36
+ console.error("Error:", error);
37
+ });
38
+
39
+
40
+ pushwoosh.requestCallPermission();
41
+ pushwoosh.registerEvent("answer",
42
+ function(payload){
43
+ console.log("Answer call from " + payload.callerName);
44
+ },
45
+ function(error) {
46
+ console.log("ERROR");
47
+
48
+ }
49
+ );
50
+
51
+ pushwoosh.registerEvent("reject",
52
+ function(payload){
53
+ console.log("Reject call from " + payload.callerName);
54
+ },
55
+ function(error) {
56
+ console.log("ERROR");
57
+
58
+ }
59
+ );
60
+
61
+ pushwoosh.registerEvent("hangup",
62
+ function(payload){
63
+ console.log("Reject call from " + payload.callerName);
64
+ },
65
+ function(error) {
66
+ console.log("ERROR");
67
+
68
+ }
69
+ );
70
+
71
+ pushwoosh.registerEvent("voipPushPayload",
72
+ function(payload){
73
+ console.log("Received call with " + JSON.stringify(payload));
74
+ },
75
+ function(error) {
76
+ console.log("ERROR");
77
+
78
+ }
79
+ );
80
+
32
81
  registerForPushNotificationAction(pushwoosh);
33
82
 
34
83
  setTagsAction(pushwoosh);
84
+ endCallAction(pushwoosh);
35
85
  setLanguageAction(pushwoosh);
36
86
  setUserIdAction(pushwoosh);
37
87
  sendPostEventAction(pushwoosh);
@@ -44,6 +94,18 @@ function onDeviceReady() {
44
94
  clearNotificationCenterAction(pushwoosh);
45
95
  }
46
96
 
97
+ function endCallAction(pushwoosh) {
98
+ document.getElementById('endCall').addEventListener('click', function() {
99
+ pushwoosh.endCall(
100
+ function() {
101
+ console.warn('setTags success');
102
+ },
103
+ function(error) {
104
+ console.warn('setTags failed');
105
+ });
106
+ });
107
+ }
108
+
47
109
  function setTagsAction(pushwoosh) {
48
110
  document.getElementById('setTags').addEventListener('click', function() {
49
111
  var key = document.getElementById("textField1").value;
@@ -392,8 +454,7 @@ function pushwooshInitialize(pushwoosh) {
392
454
  * \__/
393
455
  */
394
456
  pushwoosh.onDeviceReady({
395
- appid: "XXXXX-XXXXX",
396
- projectid: "XXXXXXXXXXXXXXX",
397
- serviceName: "XXXX"
457
+ appid: "11C10-EF18D",
458
+ projectid: "245850018966"
398
459
  });
399
460
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwoosh-cordova-plugin",
3
- "version": "8.3.39",
3
+ "version": "8.3.41",
4
4
  "description": "\n This plugin allows you to send and receive push notifications. Powered by Pushwoosh (www.pushwoosh.com).\n ",
5
5
  "main":"www/PushNotification.js",
6
6
  "typings":"types/index.d.ts",
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.3.39">
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.41">
3
3
 
4
4
  <name>Pushwoosh</name>
5
5
 
@@ -19,6 +19,7 @@
19
19
  <preference name="LOG_LEVEL" default="DEBUG" />
20
20
  <preference name="IOS_FOREGROUND_ALERT_TYPE" default="ALERT" />
21
21
  <preference name="ANDROID_FOREGROUND_PUSH" default="true" />
22
+ <preference name="PW_VOIP_IOS_ENABLED" default="false" />
22
23
 
23
24
  <js-module src="www/PushNotification.js" name="PushNotification">
24
25
  <clobbers target="plugins.pushNotification" />
@@ -38,7 +39,9 @@
38
39
  <meta-data android:name="com.pushwoosh.notification_service_extension" android:value="com.pushwoosh.plugin.pushnotifications.PushwooshNotificationServiceExtension" />
39
40
 
40
41
  <meta-data android:name="com.pushwoosh.internal.plugin_provider" android:value="com.pushwoosh.plugin.internal.PhonegapPluginProvider" />
41
-
42
+
43
+ <meta-data android:name="com.pushwoosh.CALL_EVENT_LISTENER" android:value="com.pushwoosh.plugin.pushnotifications.PWCordovaCallEventListener" />
44
+
42
45
  <service android:name="com.pushwoosh.plugin.pushnotifications.CustomFirebaseMessagingService" android:exported="false">
43
46
  <intent-filter>
44
47
  <action android:name="com.google.firebase.MESSAGING_EVENT"/>
@@ -66,16 +69,19 @@
66
69
 
67
70
  <source-file src="src/android/src/com/pushwoosh/plugin/internal/PhonegapPluginProvider.java"
68
71
  target-dir="src/com/pushwoosh/plugin/internal" />
72
+ <source-file src="src/android/src/com/pushwoosh/plugin/pushnotifications/PWCordovaCallEventListener.java" target-dir="src/com/pushwoosh/plugin/pushnotifications" />
69
73
 
70
74
  <framework src="build-extras-pushwoosh.gradle" custom="true" type="gradleReference" />
71
75
 
72
76
  <framework src="androidx.work:work-runtime:2.7.1" />
73
77
  <framework src="androidx.annotation:annotation:1.4.0" />
74
- <framework src="androidx.appcompat:appcompat:1.4.0" />
78
+ <framework src="androidx.appcompat:appcompat:1.6.1" />
79
+ <framework src="androidx.core:core-ktx:1.10.1"/>
75
80
  <framework src="androidx.recyclerview:recyclerview:1.2.1" />
76
81
  <framework src="androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" />
77
82
  <framework src="com.github.bumptech.glide:glide:4.10.0" />
78
- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60" />
83
+ <framework src="org.jetbrains.kotlin:kotlin-stdlib:1.1.60" />
84
+ <framework src="com.google.android.material:material:1.12.0"/>
79
85
 
80
86
  <framework src="com.pushwoosh:pushwoosh:6.7.30"/>
81
87
  <framework src="com.pushwoosh:pushwoosh-amazon:6.7.30"/>
@@ -84,7 +90,8 @@
84
90
  <framework src="com.pushwoosh:pushwoosh-inbox:6.7.30"/>
85
91
  <framework src="com.pushwoosh:pushwoosh-inbox-ui:6.7.30"/>
86
92
  <framework src="com.pushwoosh:pushwoosh-huawei:6.7.30"/>
87
- </platform>
93
+ <framework src="com.pushwoosh:pushwoosh-calls:6.7.30"/>
94
+ </platform>
88
95
 
89
96
  <!-- ios -->
90
97
  <platform name="ios">
@@ -125,11 +132,13 @@
125
132
  <source url="https://github.com/CocoaPods/Specs.git"/>
126
133
  </config>
127
134
  <pods use-frameworks="true">
128
- <pod name="PushwooshXCFramework" spec="6.9.3" />
135
+ <pod name="PushwooshXCFramework" spec="6.9.4" />
129
136
  <pod name="PushwooshInboxUIXCFramework" spec="6.1.2" />
130
137
  </pods>
131
138
  </podspec>
132
139
 
140
+ <hook type="after_plugin_install" src="spec/add-voip-pod.js" />
141
+
133
142
  <header-file src="src/ios/PushNotification.h" />
134
143
  <source-file src="src/ios/PushNotification.m" />
135
144
  <header-file src="src/ios/PWBackward.h" />
@@ -0,0 +1,49 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { execSync } = require('child_process');
4
+
5
+ module.exports = function (context) {
6
+ let pwVoipEnabled = context.opts?.cli_variables?.PW_VOIP_IOS_ENABLED;
7
+
8
+ if (typeof pwVoipEnabled === 'undefined') {
9
+ try {
10
+ const packageJsonPath = path.join(context.opts.projectRoot, 'package.json');
11
+ if (fs.existsSync(packageJsonPath)) {
12
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
13
+ pwVoipEnabled =
14
+ packageJson?.cordova?.plugins?.['pushwoosh-cordova-plugin']?.PW_VOIP_IOS_ENABLED;
15
+ }
16
+ } catch (_) {}
17
+ }
18
+
19
+ if (pwVoipEnabled !== 'true') {
20
+ return;
21
+ }
22
+
23
+ const iosPlatformPath = path.join(context.opts.projectRoot, 'platforms', 'ios');
24
+ const podfilePath = path.join(iosPlatformPath, 'Podfile');
25
+
26
+ if (!fs.existsSync(podfilePath)) {
27
+ return;
28
+ }
29
+
30
+ let podfileContent = fs.readFileSync(podfilePath, 'utf8');
31
+ const voipPodLine = `pod 'PushwooshXCFramework/PushwooshVoIP'`;
32
+
33
+ if (!podfileContent.includes(voipPodLine)) {
34
+ const lines = podfileContent.split('\n');
35
+ const index = lines.findIndex(line =>
36
+ line.trim().startsWith(`pod 'PushwooshXCFramework'`) &&
37
+ !line.includes(`/`)
38
+ );
39
+
40
+ if (index !== -1) {
41
+ lines.splice(index + 1, 0, voipPodLine);
42
+ fs.writeFileSync(podfilePath, lines.join('\n'));
43
+
44
+ try {
45
+ execSync('pod install', { cwd: iosPlatformPath, stdio: 'inherit' });
46
+ } catch (_) {}
47
+ }
48
+ }
49
+ };
@@ -0,0 +1,63 @@
1
+ package com.pushwoosh.plugin.pushnotifications;
2
+
3
+ import android.os.Bundle;
4
+
5
+ import androidx.annotation.NonNull;
6
+ import androidx.annotation.Nullable;
7
+
8
+ import com.pushwoosh.calls.PushwooshVoIPMessage;
9
+ import com.pushwoosh.calls.listener.CallEventListener;
10
+
11
+ public class PWCordovaCallEventListener implements CallEventListener {
12
+ private static final Object sCurrentCallLock = new Object();
13
+ private static Bundle currentCallInfo = null;
14
+
15
+
16
+ @Override
17
+ public void onAnswer(@NonNull PushwooshVoIPMessage pushwooshVoIPMessage, int i) {
18
+ synchronized (sCurrentCallLock) {
19
+ currentCallInfo = pushwooshVoIPMessage.getRawPayload();
20
+ }
21
+ PushNotifications.onAnswer(pushwooshVoIPMessage);
22
+ }
23
+
24
+ @Override
25
+ public void onReject(@NonNull PushwooshVoIPMessage pushwooshVoIPMessage) {
26
+ PushNotifications.onReject(pushwooshVoIPMessage);
27
+ synchronized (sCurrentCallLock) {
28
+ currentCallInfo = null;
29
+ }
30
+ }
31
+
32
+ @Override
33
+ public void onDisconnect(@NonNull PushwooshVoIPMessage pushwooshVoIPMessage) {
34
+ PushNotifications.onDisconnect(pushwooshVoIPMessage);
35
+ synchronized (sCurrentCallLock) {
36
+ currentCallInfo = null;
37
+ }
38
+ }
39
+
40
+ @Override
41
+ public void onCreateIncomingConnection(@Nullable Bundle bundle) {
42
+ synchronized (sCurrentCallLock) {
43
+ currentCallInfo = bundle;
44
+ }
45
+ PushNotifications.onCreateIncomingConnection(bundle);
46
+ }
47
+
48
+ @Override
49
+ public void onCallAdded(@NonNull PushwooshVoIPMessage pushwooshVoIPMessage) {
50
+ //stub
51
+ }
52
+
53
+ @Override
54
+ public void onCallRemoved(@NonNull PushwooshVoIPMessage pushwooshVoIPMessage) {
55
+ //stub
56
+ }
57
+
58
+ public static Bundle getCurrentCallInfo() {
59
+ synchronized (sCurrentCallLock) {
60
+ return currentCallInfo;
61
+ }
62
+ }
63
+ }