pushwoosh-cordova-plugin 8.3.41 → 8.3.43

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.
Files changed (27) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/plugin.xml +22 -11
  4. package/spec/set-voip-gradle-prop.js +35 -0
  5. package/src/android/add-android-voip.gradle +35 -0
  6. package/src/android/src/com/pushwoosh/plugin/pushnotifications/CallsAdapter.java +16 -0
  7. package/src/android/src/com/pushwoosh/plugin/pushnotifications/CallsAdapterFactory.java +16 -0
  8. package/src/android/src/com/pushwoosh/plugin/pushnotifications/NoopCallsAdapter.java +63 -0
  9. package/src/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java +33 -176
  10. package/src/android/src/com/pushwoosh/plugin/pushnotifications/{PWCordovaCallEventListener.java → calls/PWCordovaCallEventListener.java} +6 -5
  11. package/src/android/src/com/pushwoosh/plugin/pushnotifications/calls/PushwooshCallsAdapter.java +167 -0
  12. package/src/ios/PushNotification.m +1 -2
  13. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -145
  14. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -31
  15. package/.github/ISSUE_TEMPLATE/question.yml +0 -28
  16. package/example/LICENSE +0 -21
  17. package/example/README.md +0 -77
  18. package/example/Screenshots/Android.png +0 -0
  19. package/example/Screenshots/iOS.png +0 -0
  20. package/example/Screenshots/xcode_1.png +0 -0
  21. package/example/newdemo/config.xml +0 -20
  22. package/example/newdemo/google-services.json +0 -891
  23. package/example/newdemo/package.json +0 -34
  24. package/example/newdemo/www/css/index.css +0 -156
  25. package/example/newdemo/www/img/logo.png +0 -0
  26. package/example/newdemo/www/index.html +0 -132
  27. package/example/newdemo/www/js/index.js +0 -460
@@ -0,0 +1,167 @@
1
+ package com.pushwoosh.plugin.pushnotifications.calls;
2
+
3
+ import static com.pushwoosh.plugin.pushnotifications.PushNotifications.getCallbackContextMap;
4
+ import static com.pushwoosh.plugin.pushnotifications.PushNotifications.getCordovaInterface;
5
+
6
+ import android.content.Context;
7
+ import android.content.Intent;
8
+ import android.media.AudioManager;
9
+ import android.os.Bundle;
10
+
11
+ import com.pushwoosh.Pushwoosh;
12
+ import com.pushwoosh.calls.PushwooshCallReceiver;
13
+ import com.pushwoosh.calls.PushwooshCallSettings;
14
+ import com.pushwoosh.calls.PushwooshVoIPMessage;
15
+ import com.pushwoosh.internal.platform.AndroidPlatformModule;
16
+ import com.pushwoosh.internal.utils.JsonUtils;
17
+ import com.pushwoosh.internal.utils.PWLog;
18
+ import com.pushwoosh.plugin.pushnotifications.CallsAdapter;
19
+ import com.pushwoosh.plugin.pushnotifications.PushNotifications;
20
+
21
+ import org.apache.cordova.CallbackContext;
22
+ import org.json.JSONArray;
23
+ import org.json.JSONException;
24
+
25
+ import java.util.ArrayList;
26
+
27
+ public class PushwooshCallsAdapter implements CallsAdapter {
28
+ public static final String TAG = "PushwooshCallsAdapter";
29
+
30
+ @Override
31
+ public boolean setVoipAppCode(JSONArray data, CallbackContext callbackContext) {
32
+ try {
33
+ String appCode = data.getString(0);
34
+ Pushwoosh.getInstance().addAlternativeAppCode(appCode);
35
+ } catch (JSONException e) {
36
+ PWLog.error(TAG, "No parameters passed (missing parameters)", e);
37
+ return false;
38
+ }
39
+ return true;
40
+ }
41
+
42
+ @Override
43
+ public boolean requestCallPermission(JSONArray data, CallbackContext callbackContext) {
44
+ try {
45
+ PushwooshCallSettings.requestCallPermissions();
46
+ } catch (Exception e) {
47
+ PWLog.error(TAG, "Failed to request call permissions: " + e.getMessage());
48
+ return false;
49
+ }
50
+ return true;
51
+ }
52
+
53
+ @Override
54
+ public boolean registerEvent(JSONArray data, CallbackContext callbackContext) {
55
+ try {
56
+
57
+ String eventType = data.getString(0);
58
+ ArrayList<CallbackContext> callbackContextList = getCallbackContextMap().get(eventType);
59
+ if (callbackContextList != null) {
60
+ callbackContextList.add(callbackContext);
61
+ }
62
+ return true;
63
+ } catch (Exception e) {
64
+
65
+ return false;
66
+ }
67
+ }
68
+
69
+ @Override
70
+ public boolean endCall(JSONArray data, CallbackContext callbackContext) {
71
+ Context context = AndroidPlatformModule.getApplicationContext();
72
+ Intent endCallIntent = new Intent(context, PushwooshCallReceiver.class);
73
+ endCallIntent.putExtras(PWCordovaCallEventListener.getCurrentCallInfo());
74
+ endCallIntent.setAction("ACTION_END_CALL");
75
+ getCordovaInterface().getActivity().getApplicationContext().sendBroadcast(endCallIntent);
76
+
77
+ return true;
78
+ }
79
+
80
+ @Override
81
+ public boolean initializeVoIPParameters(JSONArray data, CallbackContext callbackContext) {
82
+ try {
83
+ String callSound = data.getString(1);
84
+ if (callSound!= null && !callSound.isEmpty()){
85
+ PushwooshCallSettings.setCallSound(callSound);
86
+ }
87
+ return true;
88
+ } catch (Exception e) {
89
+ PWLog.error("Failed to fetch custom sound name");
90
+ return false;
91
+ }
92
+ }
93
+
94
+ @Override
95
+ public boolean mute() {
96
+ try {
97
+ AudioManager audioManager = (AudioManager) getCordovaInterface().getActivity().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
98
+ audioManager.setMicrophoneMute(true);
99
+ return true;
100
+ } catch (Exception e) {
101
+ PWLog.error("Failed to mute audio channel");
102
+ return false;
103
+ }
104
+ }
105
+
106
+ @Override
107
+ public boolean unmute() {
108
+ try {
109
+ AudioManager audioManager = (AudioManager) getCordovaInterface().getActivity().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
110
+ audioManager.setMicrophoneMute(false);
111
+ return true;
112
+ } catch (Exception e) {
113
+ PWLog.error("Failed to unmute audio channel");
114
+ return false;
115
+ }
116
+ }
117
+
118
+ @Override
119
+ public boolean speakerOn() {
120
+ try {
121
+ AudioManager audioManager = (AudioManager) getCordovaInterface().getActivity().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
122
+ audioManager.setSpeakerphoneOn(true);
123
+ return true;
124
+ } catch (Exception e) {
125
+ PWLog.error("Failed to turn speaker on");
126
+ return false;
127
+ }
128
+ }
129
+
130
+ @Override
131
+ public boolean speakerOff() {
132
+ try {
133
+ AudioManager audioManager = (AudioManager) getCordovaInterface().getActivity().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
134
+ audioManager.setSpeakerphoneOn(false);
135
+ return true;
136
+ } catch (Exception e) {
137
+ PWLog.error("Failed to turn speaker off");
138
+ return false;
139
+ }
140
+ }
141
+
142
+ public static void onAnswer(PushwooshVoIPMessage voIPMessage) {
143
+ PushNotifications.emitVoipEvent("answer", parseVoIPMessage(voIPMessage));
144
+ }
145
+
146
+ public static void onReject(PushwooshVoIPMessage voIPMessage) {
147
+ PushNotifications.emitVoipEvent("reject", parseVoIPMessage(voIPMessage));
148
+ }
149
+
150
+ public static void onDisconnect(PushwooshVoIPMessage voIPMessage) {
151
+ PushNotifications.emitVoipEvent("hangup", parseVoIPMessage(voIPMessage));
152
+ }
153
+
154
+ public static void onCreateIncomingConnection(Bundle bundle) {
155
+ PushNotifications.emitVoipEvent("voipPushPayload", JsonUtils.bundleToJson(bundle));
156
+ }
157
+
158
+ private static org.json.JSONObject parseVoIPMessage(PushwooshVoIPMessage message) {
159
+ org.json.JSONObject payload = new org.json.JSONObject();
160
+ try {
161
+ payload.put("callerName", message.getCallerName())
162
+ .put("rawPayload", message.getRawPayload())
163
+ .put("hasVideo", message.getHasVideo());
164
+ } catch (org.json.JSONException ignored) {}
165
+ return payload;
166
+ }
167
+ }
@@ -693,7 +693,6 @@ API_AVAILABLE(ios(10.0)) {
693
693
  NSNumber *handleTypesNumber = [command.arguments objectAtIndex:2];
694
694
 
695
695
  if ([supportsVideoNumber isKindOfClass:[NSNumber class]] &&
696
- [ringtoneSound isKindOfClass:[NSString class]] && ringtoneSound.length > 0 &&
697
696
  [handleTypesNumber isKindOfClass:[NSNumber class]]) {
698
697
 
699
698
  BOOL supportsVideo = [supportsVideoNumber boolValue];
@@ -706,7 +705,7 @@ API_AVAILABLE(ios(10.0)) {
706
705
 
707
706
  pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"VoIP Parameters Initialized"];
708
707
  } else {
709
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid Parameters"];
708
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid initialization parameters"];
710
709
  }
711
710
 
712
711
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
@@ -1,145 +0,0 @@
1
- name: "🐞 Bug Report"
2
- description: "Report us a bug"
3
- title: "[Bug]: "
4
- labels: ["bug"]
5
- body:
6
- - type: markdown
7
- attributes:
8
- value: |
9
- Thank you for taking the time to create this issue.
10
-
11
- The more detailed information filled below will help us to investigate the root cause of the issue faster and fix it.
12
- This form is for Cordova (PhoneGap) plugin only. If this is a bug for another platform or framework — please create the issue in the corresponded [repository](https://github.com/orgs/Pushwoosh/repositories). We appreciate your cooperation!
13
- - type: checkboxes
14
- id: rtfm
15
- attributes:
16
- label: Documentation
17
- description: "Have you checked the relevant integration guide: [Integrating Cordova plugin](https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/cordova/integrating-cordova-plugin) which describes implementation process of the Pushwoosh SDK to your app and follow all the necessary steps?"
18
- options:
19
- - label: I've checked the guide, but it doesn't help me to resolve the issue.
20
- required: true
21
- - type: textarea
22
- id: description
23
- attributes:
24
- label: Description
25
- description: Short description of the issue. You can add screenshots and screencast to illustrate it.
26
- placeholder: "Example: When receiving a push with Rich Media in a closed app, Rich Media is not shown."
27
- validations:
28
- required: true
29
- - type: dropdown
30
- id: severity
31
- attributes:
32
- label: Bug severity
33
- description: |
34
- How do you rate the severity of this bug?
35
- For an objective assessment, please take into account how often this bug occurs in everyday app interaction, how serious the consequences of its occurrence (crash, warning, etc.), number of affected users, enviroment where it occurs (stage, production. etc.).
36
- options:
37
- - Low
38
- - Normal
39
- - High
40
- - Urgent
41
- validations:
42
- required: true
43
- - type: textarea
44
- id: repro-steps
45
- attributes:
46
- label: Steps to Reproduce
47
- description: Describe all the steps needed to reproduce the issue. If an issue is only reproducible under particular circumstances, put all required details here. E.g., if a push is not shown only for a specific API request, provide the full request body. Or, if an issue is reproducible with a particular Rich Media, deep link, etc. — specify it.
48
- placeholder: |
49
- 1. Open the app;
50
- 2. Switch it to the background;
51
- 3. Received notification with "root_params" causes the app to crash.
52
- This happens only if dependency XYZ v.1.2.3 is installed
53
- validations:
54
- required: true
55
- - type: dropdown
56
- id: affected-version
57
- attributes:
58
- label: Your Pushwoosh Cordova plugin version
59
- description: Your version of the Cordova plugin integrated into the application. You may find it on the [releases page](https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/releases)
60
- options:
61
- - 8.3.41
62
- - 8.3.40
63
- - 8.3.39
64
- - 8.3.38
65
- - 8.3.37
66
- - 8.3.36
67
- - 8.3.35
68
- - 8.3.34
69
- - 8.3.33
70
- - 8.3.28
71
- - 8.3.27
72
- - 8.3.26
73
- - 8.3.25
74
- - 8.3.24
75
- - 8.3.23
76
- - 8.3.22
77
- - 8.3.21
78
- - 8.3.20
79
- - 8.3.19
80
- - 8.3.18
81
- - 8.3.17
82
- - 8.3.16
83
- - 8.3.15
84
- - 8.3.14
85
- - 8.3.13
86
- - 8.3.12
87
- - 8.3.11
88
- - 8.3.10
89
- - 8.3.9
90
- - 8.3.8
91
- - 8.3.7
92
- - 8.3.6
93
- - 8.3.5
94
- - 8.3.4
95
- - 8.3.3
96
- - 8.3.2
97
- - 8.3.1
98
- - 8.3.0
99
- - Other — specify it in the description
100
- validations:
101
- required: true
102
- - type: input
103
- id: framework-version
104
- attributes:
105
- label: cordova package version
106
- description: Your cordova framework version
107
- validations:
108
- required: true
109
- - type: input
110
- id: last-worked
111
- attributes:
112
- label: Last worked Pushwoosh Cordova plugin version (if any)
113
- description: Is there a version that worked well? If so, please specify.
114
- - type: checkboxes
115
- id: platforms-affected
116
- attributes:
117
- label: Affected platforms
118
- description: Select the platforms on which the issue occurs. This helps us determine whether the root cause is core plugin or platform specific.
119
- options:
120
- - label: Android
121
- - label: iOS
122
- validations:
123
- required: true
124
- - type: textarea
125
- id: platform-versions
126
- attributes:
127
- label: Affected OS versions and/or devices
128
- description: Please specify device models and custom distributions (if any) on which this issue occurs. If the issue occurs when building, then specify the target platform.
129
- placeholder: |
130
- E.g. Android 13 on a Google Pixel 3a XL,
131
- iOS 17.0.3 on an iPhone 14
132
- MIUI 14.0.8.0 on Xiaomi 13 Ultra, etc.
133
- validations:
134
- required: true
135
- - type: textarea
136
- id: workaround
137
- attributes:
138
- label: Workaround
139
- description: Have you found a workaround for this issue? Please tell us — this may help other people to continue their work while waiting for this issue to be resolved.
140
- - type: textarea
141
- id: logs
142
- attributes:
143
- label: Relevant log output
144
- description: After reproducing the issue, copy device console logs and paste them here "as is". This code block will be formatted automatically, so no additional formatting is needed. If the issue occurs when building, then provide us building logs here.
145
- render: shell
@@ -1,31 +0,0 @@
1
- name: "💡 Feature request"
2
- description: "Suggest us a good idea or improvement"
3
- title: "[Feature]: "
4
- labels: ["feature"]
5
- body:
6
- - type: markdown
7
- attributes:
8
- value: |
9
- Thank you for taking the time to create this request.
10
-
11
- This form is for Cordova (PhoneGap) Plugin only. If this is a feature for another platform or framework — please create it in the corresponded [repository](https://github.com/orgs/Pushwoosh/repositories). We appreciate your cooperation!
12
-
13
- - type: textarea
14
- id: description
15
- attributes:
16
- label: Description
17
- description: Please tell us what's on your mind. You can add screenshots and screencast to illustrate your request.
18
- validations:
19
- required: true
20
-
21
- - type: textarea
22
- id: suggestions
23
- attributes:
24
- label: Sugeestions
25
- description: |
26
- If you know how you can achieve what you want or you have any information that may help us to achieve this, you can add it here.
27
- For example, links to repositories, discussion threads, documentation, code samples, etc.
28
-
29
- - type: markdown
30
- attributes:
31
- value: Thank you for your feedback!
@@ -1,28 +0,0 @@
1
- name: "❓ Question"
2
- description: "Ask us a question"
3
- title: "[Question]: "
4
- labels: ["question"]
5
- body:
6
- - type: markdown
7
- attributes:
8
- value: |
9
- Thank you for your question!
10
-
11
- This form is for Cordova (PhoneGap) Plugin only. If this is a question for another platform or framework — please create it in the corresponded [repository](https://github.com/orgs/Pushwoosh/repositories). We appreciate your cooperation!
12
-
13
- - type: checkboxes
14
- id: rtfm
15
- attributes:
16
- label: Documentation
17
- description: "Have you checked the relevant integration guide: [Integrating Cordova Plugin](https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/cordova/integrating-cordova-plugin) which describes implementation process of the Pushwoosh SDK to your app and follow all the necessary steps?"
18
- options:
19
- - label: I've checked the guide, but I didn't find the information I needed there.
20
- required: true
21
-
22
- - type: textarea
23
- id: question
24
- attributes:
25
- label: Question
26
- description: How can we help you? Do you have any questions about the integration of the SDK or how it works? You can add screenshots and screencast to illustrate your request.
27
- validations:
28
- required: true
package/example/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Pushwoosh
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/example/README.md DELETED
@@ -1,77 +0,0 @@
1
- # CORDOVA SAMPLE
2
-
3
- ## To launch and utilize a sample with Pushwoosh SDK integration, clone or download the repository archive.
4
-
5
- ### iOS, Android
6
- <img src="https://github.com/Pushwoosh/pushwoosh-cordova-sample/blob/main/Screenshots/iOS.png" alt="Alt text" width="300"> <img src="https://github.com/Pushwoosh/pushwoosh-cordova-sample/blob/main/Screenshots/Android.png" alt="Alt text" width="350">
7
-
8
- ### 1. Go to 'newdemo' folder and install the package from the command line:
9
-
10
- ```
11
- cordova plugin add pushwoosh-cordova-plugin
12
- ```
13
-
14
- ### 2. Navigate to the js folder within the www directory and open the file named index.js. Add your App ID and FCM Sender ID
15
-
16
- ```
17
- /**
18
- * Function: onDeviceReady
19
- * [android, ios, wp8, windows] Initialize Pushwoosh plugin and trigger a start push message
20
- * Should be called on every app launch
21
- * Parameters:
22
- * "config.appid" - Pushwoosh application code
23
- * "config.projectid" - GCM project number for android platform
24
- * "config.serviceName" - MPNS service name for wp8 platform
25
- */
26
-
27
- function initPushwoosh() {
28
- var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
29
-
30
- //Should be called before pushwoosh.onDeviceReady
31
- document.addEventListener('push-notification', function(event) {
32
- var notification = event.notification;
33
- // handle push open here
34
- });
35
-
36
- pushwoosh.onDeviceReady({
37
- appid: "XXXXX-XXXXX",
38
- projectid: "XXXXXXXXXXXXXXX",
39
- serviceName: "XXXX"
40
- });
41
- }
42
- ```
43
-
44
- ### 3. [Android] Add the 'google-services.json' file to the app folder in Android
45
-
46
- ### 4. [Android] Add the following section to your config.xml:
47
-
48
- ```
49
- <platform name="android">
50
- <resource-file src="google-services.json" target="app/google-services.json" />
51
- ...
52
- </platform>
53
-
54
- ```
55
-
56
- ### 5. [iOS] Badges
57
-
58
- ### a. Open the Xcode project, navigate to the TARGETS tab, and add your App Group name in the App Group section for both targets (newdemo and NotificationService).
59
-
60
- <img src="https://github.com/Pushwoosh/pushwoosh-cordova-sample/blob/main/Screenshots/xcode_1.png" alt="Alt text" width="500">
61
-
62
- ### b. Add the App Groups ID to your info.plist for each target of your application:
63
-
64
- ```
65
- <key>PW_APP_GROUPS_NAME</key>
66
- <string>group.com.example.demo</string>
67
-
68
- ```
69
-
70
- ## The guide for SDK integration is available on the Pushwoosh [website](https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/cordova/integrating-cordova-plugin)
71
-
72
- Documentation:
73
- https://github.com/Pushwoosh/pushwoosh-ios-sdk/tree/master/Documentation
74
-
75
- Pushwoosh team
76
- http://www.pushwoosh.com
77
-
Binary file
Binary file
Binary file
@@ -1,20 +0,0 @@
1
- <?xml version='1.0' encoding='utf-8'?>
2
- <widget id="com.pushwoosh.newdemo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3
- <name>newdemo</name>
4
- <description>Sample Apache Cordova App</description>
5
- <author email="dev@cordova.apache.org" href="https://cordova.apache.org">
6
- Apache Cordova Team
7
- </author>
8
- <content src="index.html" />
9
- <allow-intent href="http://*/*" />
10
- <allow-intent href="https://*/*" />
11
-
12
- <!-- Local Pushwoosh Cordova Plugin -->
13
- <plugin name="pushwoosh-cordova-plugin" spec="../../">
14
- <variable name="LOG_LEVEL" value="DEBUG" />
15
- <variable name="IOS_FOREGROUND_ALERT_TYPE" value="NONE" />
16
- <variable name="ANDROID_FOREGROUND_PUSH" value="false" />
17
- <variable name="PW_VOIP_IOS_ENABLED" value="true" />
18
- </plugin>
19
- </widget>
20
-