pushwoosh-cordova-plugin 8.3.49 → 8.3.51
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 +2 -2
- package/example_voip/LICENSE +21 -0
- package/example_voip/README.md +157 -0
- package/example_voip/Screenshots/Android.png +0 -0
- package/example_voip/Screenshots/iOS.png +0 -0
- package/example_voip/Screenshots/xcode_appgroups.png +0 -0
- package/example_voip/demovoip/README.md +182 -0
- package/example_voip/demovoip/config.xml +22 -0
- package/example_voip/demovoip/google-services.json +86 -0
- package/example_voip/demovoip/hooks/after_platform_add/010_install_plugin.js +46 -0
- package/example_voip/demovoip/hooks/after_prepare/010_setup_gradle_wrapper.js +34 -0
- package/example_voip/demovoip/hooks/after_prepare/015_fix_agp_version.js +36 -0
- package/example_voip/demovoip/hooks/after_prepare/020_copy_google_services.js +23 -0
- package/example_voip/demovoip/hooks/after_prepare/025_add_voip_pod.js +43 -0
- package/example_voip/demovoip/hooks/after_prepare.js +28 -0
- package/example_voip/demovoip/package-lock.json +1324 -0
- package/example_voip/demovoip/package.json +34 -0
- package/example_voip/demovoip/www/css/index.css +605 -0
- package/example_voip/demovoip/www/img/logo.png +0 -0
- package/example_voip/demovoip/www/index.html +159 -0
- package/example_voip/demovoip/www/js/index.js +309 -0
- package/package.json +1 -1
- package/plugin.xml +10 -10
- package/src/android/add-android-voip.gradle +1 -1
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java +2 -0
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/calls/PWCordovaCallEventListener.java +31 -1
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/calls/PushwooshCallsAdapter.java +20 -2
- package/src/ios/PWLog.h +11 -17
- package/src/ios/PushNotification.m +36 -5
- package/www/PushNotification.js +4 -0
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#import "PushNotification.h"
|
|
14
14
|
#import "PWLog.h"
|
|
15
15
|
#import <PushwooshInboxUI/PushwooshInboxUI.h>
|
|
16
|
-
#import <
|
|
16
|
+
#import <PushwooshCore/PWInAppManager.h>
|
|
17
17
|
#import <PushwooshFramework/PushNotificationManager.h>
|
|
18
18
|
#import <PushwooshFramework/PWInbox.h>
|
|
19
19
|
#import "PWBackward.h"
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
|
|
35
35
|
#import <objc/runtime.h>
|
|
36
36
|
|
|
37
|
-
|
|
38
37
|
#define WRITEJS(VAL) [NSString stringWithFormat:@"setTimeout(function() { %@; }, 0);", VAL]
|
|
39
38
|
#define PW_COMMUNICATION_ENABLED_KEY @"PushwooshCommunicationEnabled"
|
|
40
39
|
#define PW_COMMUNICATION_ENABLED_PLIST_KEY @"Pushwoosh_ALLOW_SERVER_COMMUNICATION"
|
|
@@ -121,7 +120,7 @@ API_AVAILABLE(ios(10))
|
|
|
121
120
|
- (void)pluginInitialize {
|
|
122
121
|
[super pluginInitialize];
|
|
123
122
|
pw_PushNotificationPlugin = self;
|
|
124
|
-
|
|
123
|
+
|
|
125
124
|
#if PW_VOIP_ENABLED
|
|
126
125
|
callbackIds = [[NSMutableDictionary alloc] initWithCapacity:5];
|
|
127
126
|
[callbackIds setObject:[NSMutableArray array] forKey:@"initializeVoIPParameters"];
|
|
@@ -139,6 +138,13 @@ API_AVAILABLE(ios(10))
|
|
|
139
138
|
[callbackIds setObject:[NSMutableArray array] forKey:@"playDTMF"];
|
|
140
139
|
[callbackIds setObject:[NSMutableArray array] forKey:@"voipDidFailToRegisterTokenWithError"];
|
|
141
140
|
[callbackIds setObject:[NSMutableArray array] forKey:@"voipDidRegisterTokenSuccessfully"];
|
|
141
|
+
[callbackIds setObject:[NSMutableArray array] forKey:@"voipDidCancelCall"];
|
|
142
|
+
[callbackIds setObject:[NSMutableArray array] forKey:@"voipDidFailToCancelCall"];
|
|
143
|
+
|
|
144
|
+
// Set delegate early so VoIP events work even before initializeVoIPParameters is called
|
|
145
|
+
if (@available(iOS 14.0, *)) {
|
|
146
|
+
PushwooshVoIPImplementation.delegate = self;
|
|
147
|
+
}
|
|
142
148
|
|
|
143
149
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveCallFromRecents:) name:@"RecentsCallNotification" object:nil];
|
|
144
150
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioRouteChange:) name:AVAudioSessionRouteChangeNotification object:nil];
|
|
@@ -182,7 +188,7 @@ API_AVAILABLE(ios(10))
|
|
|
182
188
|
|
|
183
189
|
- (void)setApiToken:(CDVInvokedUrlCommand *)command {
|
|
184
190
|
NSString *token = command.arguments[0];
|
|
185
|
-
[[
|
|
191
|
+
[[PWPreferences preferences] setApiToken:token];
|
|
186
192
|
}
|
|
187
193
|
|
|
188
194
|
- (void)onDeviceReady:(CDVInvokedUrlCommand *)command {
|
|
@@ -756,7 +762,7 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
756
762
|
if(callbackIds[eventName] != nil) {
|
|
757
763
|
[callbackIds[eventName] addObject:command.callbackId];
|
|
758
764
|
}
|
|
759
|
-
|
|
765
|
+
|
|
760
766
|
if (pendingCallFromRecents && [eventName isEqual:@"sendCall"]) {
|
|
761
767
|
NSDictionary *callData = pendingCallFromRecents;
|
|
762
768
|
CDVPluginResult* pluginResult = nil;
|
|
@@ -900,6 +906,29 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
900
906
|
}
|
|
901
907
|
}
|
|
902
908
|
|
|
909
|
+
// MARK: - voipDidCancelCall callback
|
|
910
|
+
- (void)voipDidCancelCallWithVoipMessage:(PWVoIPMessage *)voipMessage {
|
|
911
|
+
for (id callbackId in callbackIds[@"voipDidCancelCall"]) {
|
|
912
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self handleVoIPMessage:voipMessage]];
|
|
913
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
914
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// MARK: - voipDidFailToCancelCall callback
|
|
919
|
+
- (void)voipDidFailToCancelCallWithCallId:(NSString *)callId reason:(NSString *)reason {
|
|
920
|
+
for (id callbackId in callbackIds[@"voipDidFailToCancelCall"]) {
|
|
921
|
+
CDVPluginResult* pluginResult = nil;
|
|
922
|
+
NSDictionary *failureData = @{
|
|
923
|
+
@"callId": callId ?: @"",
|
|
924
|
+
@"reason": reason ?: @"Unknown reason"
|
|
925
|
+
};
|
|
926
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:failureData];
|
|
927
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
928
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
903
932
|
// MARK: - Answer Call
|
|
904
933
|
- (void)answerCall:(CXProvider *)provider perform:(CXAnswerCallAction *)action voipMessage:(PWVoIPMessage *)voipMessage {
|
|
905
934
|
[self setupAudioSession];
|
|
@@ -1020,6 +1049,8 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
1020
1049
|
[payload addEntriesFromDictionary:@{@"callerName": voipMessage.callerName}];
|
|
1021
1050
|
[payload addEntriesFromDictionary:@{@"handleType": @(voipMessage.handleType)}];
|
|
1022
1051
|
[payload addEntriesFromDictionary:@{@"hasVideo": @(voipMessage.hasVideo)}];
|
|
1052
|
+
[payload addEntriesFromDictionary:@{@"callId": voipMessage.callId ?: @""}];
|
|
1053
|
+
[payload addEntriesFromDictionary:@{@"cancelCall": @(voipMessage.cancelCall)}];
|
|
1023
1054
|
return payload;
|
|
1024
1055
|
}
|
|
1025
1056
|
#endif
|
package/www/PushNotification.js
CHANGED
|
@@ -506,6 +506,8 @@ PushNotification.prototype.notificationCallback = function(notification) {
|
|
|
506
506
|
* - "playDTMF": Triggered when a DTMF tone is played.
|
|
507
507
|
* - "voipDidFailToRegisterTokenWithError": Triggered when VoIP token registration fails (iOS only).
|
|
508
508
|
* - "voipDidRegisterTokenSuccessfully": Triggered when VoIP token registration succeeds (iOS only).
|
|
509
|
+
* - "voipDidCancelCall": Triggered when a call is remotely cancelled via VoIP push.
|
|
510
|
+
* - "voipDidFailToCancelCall": Triggered when a call cancellation attempt fails.
|
|
509
511
|
*
|
|
510
512
|
* @param {Function} success - Callback function to be invoked when the event occurs.
|
|
511
513
|
* @param {Function} fail - Callback function to be invoked if the registration fails.
|
|
@@ -534,6 +536,8 @@ PushNotification.prototype.registerEvent = function(eventName, success, fail) {
|
|
|
534
536
|
* - "playDTMF": Triggered when a DTMF tone is played.
|
|
535
537
|
* - "voipDidFailToRegisterTokenWithError": Triggered when VoIP token registration fails (iOS only).
|
|
536
538
|
* - "voipDidRegisterTokenSuccessfully": Triggered when VoIP token registration succeeds (iOS only).
|
|
539
|
+
* - "voipDidCancelCall": Triggered when a call is remotely cancelled via VoIP push.
|
|
540
|
+
* - "voipDidFailToCancelCall": Triggered when a call cancellation attempt fails.
|
|
537
541
|
*
|
|
538
542
|
* @param {Function} success - Callback function to be invoked when the event is successfully unregistered.
|
|
539
543
|
* @param {Function} fail - Callback function to be invoked if the unregistration fails.
|