pushwoosh-cordova-plugin 8.3.43 → 8.3.45
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/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/CallsAdapter.java +2 -0
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/NoopCallsAdapter.java +12 -0
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java +10 -0
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/PushwooshNotificationServiceExtension.java +2 -2
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/calls/PushwooshCallsAdapter.java +29 -0
- package/src/ios/PushNotification.m +91 -18
- package/types/PushNotification.d.ts +1 -0
- package/www/PushNotification.js +43 -0
package/README.md
CHANGED
|
@@ -14,13 +14,13 @@ Cross-Platform push notifications by Pushwoosh for Cordova / PhoneGap
|
|
|
14
14
|
Using npm:
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
cordova plugin add pushwoosh-cordova-plugin@8.3.
|
|
17
|
+
cordova plugin add pushwoosh-cordova-plugin@8.3.45
|
|
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.3.
|
|
23
|
+
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.45
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Guide
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pushwoosh-cordova-plugin",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.45",
|
|
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.
|
|
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.45">
|
|
3
3
|
|
|
4
4
|
<name>Pushwoosh</name>
|
|
5
5
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
<meta-data android:name="com.pushwoosh.internal.plugin_provider" android:value="com.pushwoosh.plugin.internal.PhonegapPluginProvider" />
|
|
44
44
|
|
|
45
|
-
<meta-data android:name="com.pushwoosh.CALL_EVENT_LISTENER" android:value="com.pushwoosh.plugin.pushnotifications.PWCordovaCallEventListener" />
|
|
45
|
+
<meta-data android:name="com.pushwoosh.CALL_EVENT_LISTENER" android:value="com.pushwoosh.plugin.pushnotifications.calls.PWCordovaCallEventListener" />
|
|
46
46
|
|
|
47
47
|
<service android:name="com.pushwoosh.plugin.pushnotifications.CustomFirebaseMessagingService" android:exported="false">
|
|
48
48
|
<intent-filter>
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
<framework src="org.jetbrains.kotlin:kotlin-stdlib:1.1.60" />
|
|
96
96
|
<framework src="com.google.android.material:material:1.12.0"/>
|
|
97
97
|
|
|
98
|
-
<framework src="com.pushwoosh:pushwoosh:6.7.
|
|
99
|
-
<framework src="com.pushwoosh:pushwoosh-amazon:6.7.
|
|
100
|
-
<framework src="com.pushwoosh:pushwoosh-firebase:6.7.
|
|
101
|
-
<framework src="com.pushwoosh:pushwoosh-badge:6.7.
|
|
102
|
-
<framework src="com.pushwoosh:pushwoosh-inbox:6.7.
|
|
103
|
-
<framework src="com.pushwoosh:pushwoosh-inbox-ui:6.7.
|
|
104
|
-
<framework src="com.pushwoosh:pushwoosh-huawei:6.7.
|
|
98
|
+
<framework src="com.pushwoosh:pushwoosh:6.7.35"/>
|
|
99
|
+
<framework src="com.pushwoosh:pushwoosh-amazon:6.7.35"/>
|
|
100
|
+
<framework src="com.pushwoosh:pushwoosh-firebase:6.7.35"/>
|
|
101
|
+
<framework src="com.pushwoosh:pushwoosh-badge:6.7.35"/>
|
|
102
|
+
<framework src="com.pushwoosh:pushwoosh-inbox:6.7.35"/>
|
|
103
|
+
<framework src="com.pushwoosh:pushwoosh-inbox-ui:6.7.35"/>
|
|
104
|
+
<framework src="com.pushwoosh:pushwoosh-huawei:6.7.35"/>
|
|
105
105
|
</platform>
|
|
106
106
|
|
|
107
107
|
<!-- ios -->
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
144
144
|
</config>
|
|
145
145
|
<pods use-frameworks="true">
|
|
146
|
-
<pod name="PushwooshXCFramework" spec="6.10.
|
|
146
|
+
<pod name="PushwooshXCFramework" spec="6.10.5" />
|
|
147
147
|
<pod name="PushwooshInboxUIXCFramework" spec="6.1.2" />
|
|
148
148
|
</pods>
|
|
149
149
|
</podspec>
|
|
@@ -16,7 +16,7 @@ def callsSrc = pluginDir ? new File(pluginDir, 'src/android/src/com/pushwoosh/pl
|
|
|
16
16
|
def applyVoip = {
|
|
17
17
|
if (voipEnabled) {
|
|
18
18
|
println "[${pluginId}] PW_VOIP_ANDROID_ENABLED=true — enabling VoIP (dependency + sources)"
|
|
19
|
-
dependencies { implementation "com.pushwoosh:pushwoosh-calls:6.7.
|
|
19
|
+
dependencies { implementation "com.pushwoosh:pushwoosh-calls:6.7.35" }
|
|
20
20
|
if (callsSrc?.exists()) {
|
|
21
21
|
android.sourceSets.main.java.srcDirs += callsSrc
|
|
22
22
|
println "[${pluginId}] Added optional sources: ${callsSrc}"
|
|
@@ -6,7 +6,9 @@ import org.json.JSONArray;
|
|
|
6
6
|
public interface CallsAdapter {
|
|
7
7
|
public boolean setVoipAppCode(JSONArray data, CallbackContext callbackContext);
|
|
8
8
|
public boolean requestCallPermission(JSONArray data, final CallbackContext callbackContext);
|
|
9
|
+
public boolean getCallPermissionStatus(JSONArray data, final CallbackContext callbackContext);
|
|
9
10
|
public boolean registerEvent(JSONArray data, final CallbackContext callbackContext);
|
|
11
|
+
public boolean unregisterEvent(JSONArray data, final CallbackContext callbackContext);
|
|
10
12
|
public boolean endCall(JSONArray data, final CallbackContext callbackContext);
|
|
11
13
|
public boolean initializeVoIPParameters(JSONArray data, final CallbackContext callbackContext);
|
|
12
14
|
public boolean mute();
|
|
@@ -19,12 +19,24 @@ public class NoopCallsAdapter implements CallsAdapter{
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
@Override
|
|
23
|
+
public boolean getCallPermissionStatus(JSONArray data, CallbackContext callbackContext) {
|
|
24
|
+
PWLog.error(TAG,"Method not implemented");
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
@Override
|
|
23
29
|
public boolean registerEvent(JSONArray data, CallbackContext callbackContext) {
|
|
24
30
|
PWLog.error(TAG,"Method not implemented");
|
|
25
31
|
return false;
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
@Override
|
|
35
|
+
public boolean unregisterEvent(JSONArray data, CallbackContext callbackContext) {
|
|
36
|
+
PWLog.error(TAG,"Method not implemented");
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
@Override
|
|
29
41
|
public boolean endCall(JSONArray data, CallbackContext callbackContext) {
|
|
30
42
|
PWLog.error(TAG,"Method not implemented");
|
|
@@ -1076,11 +1076,21 @@ public class PushNotifications extends CordovaPlugin {
|
|
|
1076
1076
|
return callsAdapter.requestCallPermission(data, callbackContext);
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
|
+
@CordovaMethod
|
|
1080
|
+
private boolean getCallPermissionStatus(JSONArray data, final CallbackContext callbackContext) {
|
|
1081
|
+
return callsAdapter.getCallPermissionStatus(data, callbackContext);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1079
1084
|
@CordovaMethod
|
|
1080
1085
|
private boolean registerEvent(JSONArray data, final CallbackContext callbackContext) {
|
|
1081
1086
|
return callsAdapter.registerEvent(data, callbackContext);
|
|
1082
1087
|
}
|
|
1083
1088
|
|
|
1089
|
+
@CordovaMethod
|
|
1090
|
+
private boolean unregisterEvent(JSONArray data, final CallbackContext callbackContext) {
|
|
1091
|
+
return callsAdapter.unregisterEvent(data, callbackContext);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1084
1094
|
@CordovaMethod
|
|
1085
1095
|
private boolean endCall(JSONArray data, final CallbackContext callbackContext) {
|
|
1086
1096
|
return callsAdapter.endCall(data,callbackContext);
|
|
@@ -26,13 +26,13 @@ public class PushwooshNotificationServiceExtension extends NotificationServiceEx
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
@Override
|
|
29
|
-
|
|
29
|
+
public boolean onMessageReceived(final PushMessage pushMessage) {
|
|
30
30
|
PushNotifications.messageReceived(pushMessage.toJson().toString());
|
|
31
31
|
return (!showForegroundPush && !super.onMessageReceived(pushMessage) && isAppOnForeground());
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
@Override
|
|
35
|
-
|
|
35
|
+
public void onMessageOpened(PushMessage pushMessage) {
|
|
36
36
|
PushNotifications.openPush(pushMessage.toJson().toString());
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/android/src/com/pushwoosh/plugin/pushnotifications/calls/PushwooshCallsAdapter.java
CHANGED
|
@@ -50,6 +50,18 @@ public class PushwooshCallsAdapter implements CallsAdapter {
|
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
@Override
|
|
54
|
+
public boolean getCallPermissionStatus(JSONArray data, CallbackContext callbackContext) {
|
|
55
|
+
try {
|
|
56
|
+
int status = PushwooshCallSettings.getCallPermissionStatus();
|
|
57
|
+
callbackContext.success(status);
|
|
58
|
+
return true;
|
|
59
|
+
} catch (Exception e) {
|
|
60
|
+
PWLog.error(TAG, "Failed to get call permission status: " + e.getMessage());
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
@Override
|
|
54
66
|
public boolean registerEvent(JSONArray data, CallbackContext callbackContext) {
|
|
55
67
|
try {
|
|
@@ -61,7 +73,24 @@ public class PushwooshCallsAdapter implements CallsAdapter {
|
|
|
61
73
|
}
|
|
62
74
|
return true;
|
|
63
75
|
} catch (Exception e) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
64
79
|
|
|
80
|
+
@Override
|
|
81
|
+
public boolean unregisterEvent(JSONArray data, CallbackContext callbackContext) {
|
|
82
|
+
try {
|
|
83
|
+
String eventType = data.getString(0);
|
|
84
|
+
ArrayList<CallbackContext> callbackContextList = getCallbackContextMap().get(eventType);
|
|
85
|
+
if (callbackContextList != null) {
|
|
86
|
+
callbackContextList.clear();
|
|
87
|
+
callbackContext.success("Successfully unregistered from " + eventType + " event");
|
|
88
|
+
} else {
|
|
89
|
+
callbackContext.error("Event " + eventType + " not found or not supported");
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
} catch (Exception e) {
|
|
93
|
+
PWLog.error(TAG, "Failed to unregister event: " + e.getMessage());
|
|
65
94
|
return false;
|
|
66
95
|
}
|
|
67
96
|
}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
#import "PushNotification.h"
|
|
14
14
|
#import "PWLog.h"
|
|
15
15
|
#import <PushwooshInboxUI/PushwooshInboxUI.h>
|
|
16
|
-
#import <PushwooshFramework/PWGDPRManager.h>
|
|
17
16
|
#import <PushwooshFramework/PWInAppManager.h>
|
|
18
17
|
#import <PushwooshFramework/PushNotificationManager.h>
|
|
19
18
|
#import <PushwooshFramework/PWInbox.h>
|
|
@@ -37,6 +36,8 @@
|
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
#define WRITEJS(VAL) [NSString stringWithFormat:@"setTimeout(function() { %@; }, 0);", VAL]
|
|
39
|
+
#define PW_COMMUNICATION_ENABLED_KEY @"PushwooshCommunicationEnabled"
|
|
40
|
+
#define PW_COMMUNICATION_ENABLED_PLIST_KEY @"Pushwoosh_ALLOW_SERVER_COMMUNICATION"
|
|
40
41
|
|
|
41
42
|
NSMutableDictionary *callbackIds;
|
|
42
43
|
NSDictionary* pendingCallFromRecents;
|
|
@@ -120,6 +121,7 @@ API_AVAILABLE(ios(10))
|
|
|
120
121
|
- (void)pluginInitialize {
|
|
121
122
|
[super pluginInitialize];
|
|
122
123
|
pw_PushNotificationPlugin = self;
|
|
124
|
+
|
|
123
125
|
#if PW_VOIP_ENABLED
|
|
124
126
|
callbackIds = [[NSMutableDictionary alloc] initWithCapacity:5];
|
|
125
127
|
[callbackIds setObject:[NSMutableArray array] forKey:@"initializeVoIPParameters"];
|
|
@@ -135,6 +137,8 @@ API_AVAILABLE(ios(10))
|
|
|
135
137
|
[callbackIds setObject:[NSMutableArray array] forKey:@"speakerOn"];
|
|
136
138
|
[callbackIds setObject:[NSMutableArray array] forKey:@"speakerOff"];
|
|
137
139
|
[callbackIds setObject:[NSMutableArray array] forKey:@"playDTMF"];
|
|
140
|
+
[callbackIds setObject:[NSMutableArray array] forKey:@"voipDidFailToRegisterTokenWithError"];
|
|
141
|
+
[callbackIds setObject:[NSMutableArray array] forKey:@"voipDidRegisterTokenSuccessfully"];
|
|
138
142
|
|
|
139
143
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveCallFromRecents:) name:@"RecentsCallNotification" object:nil];
|
|
140
144
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioRouteChange:) name:AVAudioSessionRouteChangeNotification object:nil];
|
|
@@ -627,6 +631,10 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
627
631
|
//stub, android only
|
|
628
632
|
}
|
|
629
633
|
|
|
634
|
+
- (void)getCallPermissionStatus:(CDVInvokedUrlCommand *)command {
|
|
635
|
+
//stub, android only
|
|
636
|
+
}
|
|
637
|
+
|
|
630
638
|
- (void)setVoipAppCode:(CDVInvokedUrlCommand *)command {
|
|
631
639
|
NSString *voipAppCode = command.arguments[0];
|
|
632
640
|
[PushwooshVoIPImplementation setPushwooshVoIPAppId:voipAppCode];
|
|
@@ -758,6 +766,21 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
758
766
|
}
|
|
759
767
|
}
|
|
760
768
|
|
|
769
|
+
// MARK: - Unregister event func
|
|
770
|
+
- (void)unregisterEvent:(CDVInvokedUrlCommand*)command {
|
|
771
|
+
NSString* eventName = [command.arguments objectAtIndex:0];
|
|
772
|
+
|
|
773
|
+
if(callbackIds[eventName] != nil) {
|
|
774
|
+
[callbackIds[eventName] removeAllObjects];
|
|
775
|
+
|
|
776
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[NSString stringWithFormat:@"Successfully unregistered from %@ event", eventName]];
|
|
777
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
778
|
+
} else {
|
|
779
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[NSString stringWithFormat:@"Event %@ not found or not supported", eventName]];
|
|
780
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
761
784
|
// MARK: - Send Call
|
|
762
785
|
- (void)sendCall:(CDVInvokedUrlCommand*)command {
|
|
763
786
|
BOOL hasId = ![[command.arguments objectAtIndex:1] isEqual:[NSNull null]];
|
|
@@ -849,6 +872,34 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
849
872
|
}
|
|
850
873
|
}
|
|
851
874
|
|
|
875
|
+
// MARK: - voipDidFailToRegisterTokenWithError callback
|
|
876
|
+
- (void)voipDidFailToRegisterTokenWithError:(NSError *)error {
|
|
877
|
+
for (id callbackId in callbackIds[@"voipDidFailToRegisterTokenWithError"]) {
|
|
878
|
+
CDVPluginResult* pluginResult = nil;
|
|
879
|
+
NSDictionary *errorData = @{
|
|
880
|
+
@"error": error.localizedDescription ?: @"Unknown error",
|
|
881
|
+
@"code": @(error.code),
|
|
882
|
+
@"domain": error.domain ?: @"Unknown domain"
|
|
883
|
+
};
|
|
884
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:errorData];
|
|
885
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
886
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// MARK: - voipDidRegisterTokenSuccessfully callback
|
|
891
|
+
- (void)voipDidRegisterTokenSuccessfully {
|
|
892
|
+
for (id callbackId in callbackIds[@"voipDidRegisterTokenSuccessfully"]) {
|
|
893
|
+
CDVPluginResult* pluginResult = nil;
|
|
894
|
+
NSDictionary *successData = @{
|
|
895
|
+
@"message": @"VoIP token registered successfully"
|
|
896
|
+
};
|
|
897
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:successData];
|
|
898
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
899
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
852
903
|
// MARK: - Answer Call
|
|
853
904
|
- (void)answerCall:(CXProvider *)provider perform:(CXAnswerCallAction *)action voipMessage:(PWVoIPMessage *)voipMessage {
|
|
854
905
|
[self setupAudioSession];
|
|
@@ -1042,22 +1093,49 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
1042
1093
|
[[PWInAppManager sharedManager] addJavascriptInterface:bridge withName:name];
|
|
1043
1094
|
}
|
|
1044
1095
|
|
|
1045
|
-
- (
|
|
1046
|
-
|
|
1096
|
+
- (BOOL)getCommunicationEnabledState {
|
|
1097
|
+
NSBundle *bundle = [NSBundle mainBundle];
|
|
1098
|
+
NSObject *plistValue = [bundle objectForInfoDictionaryKey:PW_COMMUNICATION_ENABLED_PLIST_KEY];
|
|
1047
1099
|
|
|
1048
|
-
|
|
1100
|
+
if (plistValue != nil) {
|
|
1101
|
+
if ([plistValue isKindOfClass:[NSNumber class]]) {
|
|
1102
|
+
return [(NSNumber *)plistValue boolValue];
|
|
1103
|
+
} else if ([plistValue isKindOfClass:[NSString class]]) {
|
|
1104
|
+
NSString *stringValue = [(NSString *)plistValue lowercaseString];
|
|
1105
|
+
return [stringValue isEqualToString:@"true"] || [stringValue isEqualToString:@"yes"] || [stringValue isEqualToString:@"1"];
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
if ([[NSUserDefaults standardUserDefaults] objectForKey:PW_COMMUNICATION_ENABLED_KEY] != nil) {
|
|
1110
|
+
return [[NSUserDefaults standardUserDefaults] boolForKey:PW_COMMUNICATION_ENABLED_KEY];
|
|
1111
|
+
}
|
|
1049
1112
|
|
|
1113
|
+
return YES;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
- (void)setCommunicationEnabled:(CDVInvokedUrlCommand *)command {
|
|
1117
|
+
NSNumber *enabledObject = [command.arguments firstObject];
|
|
1050
1118
|
BOOL enabled = [enabledObject boolValue];
|
|
1051
1119
|
|
|
1052
|
-
[[
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
}
|
|
1120
|
+
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:PW_COMMUNICATION_ENABLED_KEY];
|
|
1121
|
+
|
|
1122
|
+
CDVPluginResult *pluginResult = nil;
|
|
1123
|
+
|
|
1124
|
+
if (enabled) {
|
|
1125
|
+
[[Pushwoosh sharedInstance] startServerCommunication];
|
|
1126
|
+
} else {
|
|
1127
|
+
[[Pushwoosh sharedInstance] stopServerCommunication];
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
1131
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
- (void)isCommunicationEnabled:(CDVInvokedUrlCommand *)command {
|
|
1135
|
+
BOOL isEnabled = [self getCommunicationEnabledState];
|
|
1136
|
+
|
|
1137
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:(isEnabled ? 1 : 0)];
|
|
1138
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
1061
1139
|
}
|
|
1062
1140
|
|
|
1063
1141
|
- (void)setEmail:(CDVInvokedUrlCommand *)command {
|
|
@@ -1118,11 +1196,6 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
1118
1196
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
1119
1197
|
}
|
|
1120
1198
|
|
|
1121
|
-
- (void)isCommunicationEnabled:(CDVInvokedUrlCommand *)command {
|
|
1122
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:[[PWGDPRManager sharedManager] isCommunicationEnabled]];
|
|
1123
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
1199
|
- (void)enableHuaweiPushNotifications:(CDVInvokedUrlCommand *)command {
|
|
1127
1200
|
// Stub
|
|
1128
1201
|
|
|
@@ -96,5 +96,6 @@ export interface PushNotification {
|
|
|
96
96
|
mute(success?: () => void, error?: (err: Error | string) => void): void;
|
|
97
97
|
unmute(success?: () => void, error?: (err: Error | string) => void): void;
|
|
98
98
|
requestCallPermission(): void;
|
|
99
|
+
getCallPermissionStatus(success?: (status: number) => void, error?: (err: Error | string) => void): void;
|
|
99
100
|
endCall(success?: () => void, error?: (err: Error | string) => void): void;
|
|
100
101
|
}
|
package/www/PushNotification.js
CHANGED
|
@@ -504,6 +504,8 @@ PushNotification.prototype.notificationCallback = function(notification) {
|
|
|
504
504
|
* - "incomingCallSuccess": Triggered when an incoming call is successfully displayed.
|
|
505
505
|
* - "incomingCallFailure": Triggered when displaying the incoming call fails.
|
|
506
506
|
* - "playDTMF": Triggered when a DTMF tone is played.
|
|
507
|
+
* - "voipDidFailToRegisterTokenWithError": Triggered when VoIP token registration fails (iOS only).
|
|
508
|
+
* - "voipDidRegisterTokenSuccessfully": Triggered when VoIP token registration succeeds (iOS only).
|
|
507
509
|
*
|
|
508
510
|
* @param {Function} success - Callback function to be invoked when the event occurs.
|
|
509
511
|
* @param {Function} fail - Callback function to be invoked if the registration fails.
|
|
@@ -512,6 +514,34 @@ PushNotification.prototype.registerEvent = function(eventName, success, fail) {
|
|
|
512
514
|
exec(success, fail, "PushNotification", "registerEvent", [eventName]);
|
|
513
515
|
};
|
|
514
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Unregisters a callback for a specific VoIP-related event.
|
|
519
|
+
*
|
|
520
|
+
* This method allows you to unsubscribe from a previously registered VoIP event.
|
|
521
|
+
* After unregistering, the event callback will no longer be invoked when the event occurs.
|
|
522
|
+
*
|
|
523
|
+
* @param {string} eventName - The name of the event to unregister from.
|
|
524
|
+
* This should match the event name used in registerEvent().
|
|
525
|
+
* Supported event names include:
|
|
526
|
+
* - "answer": Triggered when the call is answered.
|
|
527
|
+
* - "hangup": Triggered when the call is hung up.
|
|
528
|
+
* - "reject": Triggered when the call is rejected.
|
|
529
|
+
* - "muted": Triggered when the call is muted or unmuted.
|
|
530
|
+
* - "held": Triggered when the call is put on or off hold.
|
|
531
|
+
* - "voipPushPayload": Triggered when a VoIP push notification is received.
|
|
532
|
+
* - "incomingCallSuccess": Triggered when an incoming call is successfully displayed.
|
|
533
|
+
* - "incomingCallFailure": Triggered when displaying the incoming call fails.
|
|
534
|
+
* - "playDTMF": Triggered when a DTMF tone is played.
|
|
535
|
+
* - "voipDidFailToRegisterTokenWithError": Triggered when VoIP token registration fails (iOS only).
|
|
536
|
+
* - "voipDidRegisterTokenSuccessfully": Triggered when VoIP token registration succeeds (iOS only).
|
|
537
|
+
*
|
|
538
|
+
* @param {Function} success - Callback function to be invoked when the event is successfully unregistered.
|
|
539
|
+
* @param {Function} fail - Callback function to be invoked if the unregistration fails.
|
|
540
|
+
*/
|
|
541
|
+
PushNotification.prototype.unregisterEvent = function(eventName, success, fail) {
|
|
542
|
+
exec(success, fail, "PushNotification", "unregisterEvent", [eventName]);
|
|
543
|
+
};
|
|
544
|
+
|
|
515
545
|
/**
|
|
516
546
|
* Initializes VoIP call parameters for the native calling system.
|
|
517
547
|
*
|
|
@@ -612,6 +642,19 @@ PushNotification.prototype.requestCallPermission = function() {
|
|
|
612
642
|
exec(null, null, "PushNotification", "requestCallPermission", []);
|
|
613
643
|
}
|
|
614
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Get call permission status
|
|
647
|
+
* Returns a Promise or calls success callback with status:
|
|
648
|
+
* 0 - Permission not requested yet
|
|
649
|
+
* 1 - Permission granted by user
|
|
650
|
+
* 2 - Permission denied by user
|
|
651
|
+
* @param {Function} success - Callback invoked with permission status
|
|
652
|
+
* @param {Function} error - Callback invoked if the operation fails
|
|
653
|
+
*/
|
|
654
|
+
PushNotification.prototype.getCallPermissionStatus = function(success, error) {
|
|
655
|
+
exec(success, error, "PushNotification", "getCallPermissionStatus", []);
|
|
656
|
+
}
|
|
657
|
+
|
|
615
658
|
/**
|
|
616
659
|
* Notifies Pushwoosh that the call has ended
|
|
617
660
|
* @param {Function} success - Callback invoked when the call ends.
|