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.
- package/.github/ISSUE_TEMPLATE/bug_report.yml +2 -0
- package/README.md +2 -2
- package/example/newdemo/config.xml +1 -0
- package/example/newdemo/google-services.json +891 -0
- package/example/newdemo/package.json +4 -3
- package/example/newdemo/www/index.html +6 -0
- package/example/newdemo/www/js/index.js +64 -3
- package/package.json +1 -1
- package/plugin.xml +15 -6
- package/spec/add-voip-pod.js +49 -0
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/PWCordovaCallEventListener.java +63 -0
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java +244 -59
- package/src/ios/PushNotification.m +397 -39
- package/types/PushNotification.d.ts +10 -6
- package/www/PushNotification.js +139 -24
package/www/PushNotification.js
CHANGED
|
@@ -486,6 +486,141 @@ PushNotification.prototype.notificationCallback = function(notification) {
|
|
|
486
486
|
document.dispatchEvent(ev);
|
|
487
487
|
};
|
|
488
488
|
|
|
489
|
+
// CallKit, PushKit
|
|
490
|
+
/**
|
|
491
|
+
* Registers a callback for a specific VoIP-related event.
|
|
492
|
+
*
|
|
493
|
+
* This method allows you to subscribe to a predefined set of VoIP events.
|
|
494
|
+
* When the specified event occurs, the provided success callback will be invoked.
|
|
495
|
+
*
|
|
496
|
+
* @param {string} eventName - The name of the event to register for.
|
|
497
|
+
* Supported event names include:
|
|
498
|
+
* - "answer": Triggered when the call is answered.
|
|
499
|
+
* - "hangup": Triggered when the call is hung up.
|
|
500
|
+
* - "reject": Triggered when the call is rejected.
|
|
501
|
+
* - "muted": Triggered when the call is muted or unmuted.
|
|
502
|
+
* - "held": Triggered when the call is put on or off hold.
|
|
503
|
+
* - "voipPushPayload": Triggered when a VoIP push notification is received.
|
|
504
|
+
* - "incomingCallSuccess": Triggered when an incoming call is successfully displayed.
|
|
505
|
+
* - "incomingCallFailure": Triggered when displaying the incoming call fails.
|
|
506
|
+
* - "playDTMF": Triggered when a DTMF tone is played.
|
|
507
|
+
*
|
|
508
|
+
* @param {Function} success - Callback function to be invoked when the event occurs.
|
|
509
|
+
* @param {Function} fail - Callback function to be invoked if the registration fails.
|
|
510
|
+
*/
|
|
511
|
+
PushNotification.prototype.registerEvent = function(eventName, success, fail) {
|
|
512
|
+
exec(success, fail, "PushNotification", "registerEvent", [eventName]);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Initializes VoIP call parameters for the native calling system.
|
|
517
|
+
*
|
|
518
|
+
* This method configures options related to VoIP calls such as video support,
|
|
519
|
+
* custom ringtone, and handle type used for identifying the caller.
|
|
520
|
+
* These parameters affect how the call will be displayed and handled by the system (e.g., CallKit on iOS).
|
|
521
|
+
*
|
|
522
|
+
* If no parameters are provided, defaults will be used.
|
|
523
|
+
* Handles optional argument shifting when called with fewer parameters.
|
|
524
|
+
*
|
|
525
|
+
* @param {boolean} [supportsVideo] - Indicates whether video calls are supported. Defaults to `false`.
|
|
526
|
+
* @param {string} [ringtoneSound] - The name of the custom ringtone sound file (e.g., `"mySound.caf"`). Defaults to an empty string.
|
|
527
|
+
* @param {number} [handleTypes] - Type of call handle to use (iOS-only, Android does not require this setting):
|
|
528
|
+
* - `1` – Generic
|
|
529
|
+
* - `2` – Phone number
|
|
530
|
+
* - `3` – Email address
|
|
531
|
+
* Defaults to `1` if not provided.
|
|
532
|
+
* @param {Function} success - Callback invoked when the parameters are successfully initialized.
|
|
533
|
+
* @param {Function} error - Callback invoked if initialization fails.
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* PushNotification.initializeVoIPParameters(true, "ringtone.caf", 2, onSuccess, onError);
|
|
537
|
+
* PushNotification.initializeVoIPParameters(onSuccess, onError); // Use default values
|
|
538
|
+
*/
|
|
539
|
+
PushNotification.prototype.initializeVoIPParameters = function(supportsVideo, ringtoneSound, handleTypes, success, error) {
|
|
540
|
+
if (typeof handleTypes === "function") {
|
|
541
|
+
error = ringtoneSound;
|
|
542
|
+
success = supportsVideo;
|
|
543
|
+
handleTypes = undefined;
|
|
544
|
+
ringtoneSound = undefined;
|
|
545
|
+
supportsVideo = undefined;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
exec(success, error, "PushNotification", "initializeVoIPParameters", [
|
|
549
|
+
!!supportsVideo,
|
|
550
|
+
ringtoneSound || "",
|
|
551
|
+
handleTypes != null ? Number(handleTypes) : 1
|
|
552
|
+
]);
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Enables the device speaker during an active call.
|
|
557
|
+
*
|
|
558
|
+
* This method routes the call audio output through the device’s loudspeaker
|
|
559
|
+
* instead of the earpiece. Useful for hands-free or speakerphone mode.
|
|
560
|
+
*
|
|
561
|
+
* @param {Function} success - Callback invoked when the speaker is successfully enabled.
|
|
562
|
+
* @param {Function} error - Callback invoked if the operation fails.
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* PushNotification.speakerOn(onSuccess, onError);
|
|
566
|
+
*/
|
|
567
|
+
PushNotification.prototype.speakerOn = function(success, error) {
|
|
568
|
+
exec(success, error, "PushNotification", "speakerOn", []);
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Disables the device speaker and routes audio back to the earpiece.
|
|
573
|
+
*
|
|
574
|
+
* This method returns the audio output to the default mode (typically the earpiece),
|
|
575
|
+
* which is used for private voice conversations.
|
|
576
|
+
*
|
|
577
|
+
* @param {Function} success - Callback invoked when the speaker is successfully disabled.
|
|
578
|
+
* @param {Function} error - Callback invoked if the operation fails.
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* PushNotification.speakerOff(onSuccess, onError);
|
|
582
|
+
*/
|
|
583
|
+
PushNotification.prototype.speakerOff = function(success, error) {
|
|
584
|
+
exec(success, error, "PushNotification", "speakerOff", []);
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Mute device microphone
|
|
589
|
+
* @param {Function} success - Callback invoked when the microphone is successfully disabled.
|
|
590
|
+
* @param {Function} error - Callback invoked if the operation fails.
|
|
591
|
+
*/
|
|
592
|
+
PushNotification.prototype.mute = function(success, error) {
|
|
593
|
+
exec(success, error, "PushNotification", "speakerOff", []);
|
|
594
|
+
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Unmute device microphone
|
|
599
|
+
* @param {Function} success - Callback invoked when the microphone is successfully enable.
|
|
600
|
+
* @param {Function} error - Callback invoked if the operation fails.
|
|
601
|
+
*/
|
|
602
|
+
PushNotification.prototype.unmute = function(success, error) {
|
|
603
|
+
exec(success, error, "PushNotification", "unmute", []);
|
|
604
|
+
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Android calls
|
|
608
|
+
/**
|
|
609
|
+
* Request call permission and register phone account
|
|
610
|
+
*/
|
|
611
|
+
PushNotification.prototype.requestCallPermission = function() {
|
|
612
|
+
exec(null, null, "PushNotification", "requestCallPermission", []);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Notifies Pushwoosh that the call has ended
|
|
617
|
+
* @param {Function} success - Callback invoked when the call ends.
|
|
618
|
+
* @param {Function} error - Callback invoked if the operation fails.
|
|
619
|
+
*/
|
|
620
|
+
PushNotification.prototype.endCall = function(success, error) {
|
|
621
|
+
exec(success, error, "PushNotification", "endCall", []);
|
|
622
|
+
}
|
|
623
|
+
|
|
489
624
|
// Opens Inbox screen.
|
|
490
625
|
//
|
|
491
626
|
// Supported style keys:
|
|
@@ -599,16 +734,6 @@ PushNotification.prototype.performAction = function(number) {
|
|
|
599
734
|
exec(null, null, "PushNotification", "performAction", [number]);
|
|
600
735
|
}
|
|
601
736
|
|
|
602
|
-
// Show inApp for change setting Enable/disable all communication with Pushwoosh
|
|
603
|
-
PushNotification.prototype.showGDPRConsentUI = function() {
|
|
604
|
-
exec(null, null, "PushNotification", "showGDPRConsentUI", []);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// Show inApp for all device data from Pushwoosh and stops all interactions and communication permanently.
|
|
608
|
-
PushNotification.prototype.showGDPRDeletionUI = function() {
|
|
609
|
-
exec(null, null, "PushNotification", "showGDPRDeletionUI", []);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
737
|
// Enable/disable all communication with Pushwoosh. Enabled by default.
|
|
613
738
|
PushNotification.prototype.setCommunicationEnabled = function(enable, success, fail) {
|
|
614
739
|
exec(success, fail, "PushNotification", "setCommunicationEnabled", [enable]);
|
|
@@ -644,24 +769,10 @@ PushNotification.prototype.registerWhatsappNumber = function(phoneNumber, succes
|
|
|
644
769
|
exec(success, fail, "PushNotification", "registerWhatsappNumber", [phoneNumber]);
|
|
645
770
|
};
|
|
646
771
|
|
|
647
|
-
// Removes all device data from Pushwoosh and stops all interactions and communication permanently.
|
|
648
|
-
PushNotification.prototype.removeAllDeviceData = function(success, fail) {
|
|
649
|
-
exec(success, fail, "PushNotification", "removeAllDeviceData", []);
|
|
650
|
-
};
|
|
651
|
-
|
|
652
772
|
PushNotification.prototype.isCommunicationEnabled = function(success) {
|
|
653
773
|
return exec(success, null, "PushNotification", "isCommunicationEnabled", []);
|
|
654
774
|
};
|
|
655
775
|
|
|
656
|
-
PushNotification.prototype.isDeviceDataRemoved = function(success) {
|
|
657
|
-
return exec(success, null, "PushNotification", "isDeviceDataRemoved", []);
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
// Indicates availability of the GDPR compliance solution.
|
|
661
|
-
PushNotification.prototype.isAvailableGDPR = function(success) {
|
|
662
|
-
return exec(success, null, "PushNotification", "isAvailableGDPR", []);
|
|
663
|
-
};
|
|
664
|
-
|
|
665
776
|
// Enable Huawei push notifications in Android
|
|
666
777
|
PushNotification.prototype.enableHuaweiPushNotifications = function() {
|
|
667
778
|
exec(null, null, "PushNotification", "enableHuaweiPushNotifications", []);
|
|
@@ -671,4 +782,8 @@ PushNotification.prototype.setApiToken = function(token) {
|
|
|
671
782
|
exec(null, null, "PushNotification", "setApiToken", [token]);
|
|
672
783
|
}
|
|
673
784
|
|
|
785
|
+
PushNotification.prototype.setVoipAppCode = function(appCode) {
|
|
786
|
+
exec(null, null, "PushNotification", "setVoipAppCode", [appCode]);
|
|
787
|
+
}
|
|
788
|
+
|
|
674
789
|
module.exports = new PushNotification();
|