Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-cnpush

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-cnpush - npm Package Compare versions

Comparing version 2.6.1 to 2.6.2

hooks/apns.entitlements

2

package.json
{
"name": "cordova-plugin-cnpush",
"version": "2.6.1",
"version": "2.6.2",
"description": "Cordova huawei PushPay Plugin",

@@ -5,0 +5,0 @@ "cordova": {

``` sh
cordova plugin add cordova-plugin-cnpush --variable APPID=HUAWEI_APPID --variable PACKAGENAME=ANDROID_PACKAGENAME --variable cpid=HUAWEI_CPID
cordova plugin add cordova-plugin-cnpush --variable APPID=HUAWEI_APPID --variable PACKAGENAME=ANDROID_PACKAGENAME --variable cpid=HUAWEI_CPID --variable JPUSH_APP_KEY=JPUSH_APP_KEY
```
> 在中国大陆地区使用。
> 如果是华为安卓手机,则使用华为推送sdk。
> 如果是苹果手机,则使用苹果推送sdk。
> 其它是其它安卓手机,则使用极光推送sdk。
``` js
var pushNotification = window.plugins.pushNotification;
var pushNotification = PushNotification;
window["onNotificationAPN"] = onNotificationAPN;
pushNotification.register(

@@ -8,0 +14,0 @@ tokenHandler,

@@ -23,13 +23,41 @@

if (platform.toLowerCase() == "android") {
document.addEventListener('huaweipush.log', function (ev) {
console.log(ev);
});
document.addEventListener('huaweipush.receiveRegisterResult', function (result) {
console.log(result);
if (result.token != null) {
successCallback(result.token);
if (device.manufacturer.toLowerCase().indexOf("huawei") >= 0) {
document.addEventListener('huaweipush.log', function (ev) {
console.log(ev);
});
document.addEventListener('huaweipush.receiveRegisterResult', function (result) {
console.log(result);
if (result.token != null) {
successCallback(result.token);
}
});
document.addEventListener('huaweipush.notificationOpened', window[options.ecb]);
cordova.exec(successCallback, errorCallback, "PushPlugin", "init", [options]);
} else {
try {
function getRegistrationID() {
window["plugins"].jPushPlugin.getRegistrationID((token) => {
try {
console.log(token);
if (token.length == 0) {
window.setTimeout(getRegistrationID, 1000);
} else {
successCallback(token);
}
} catch (exception) {
console.log(exception);
}
});
}
window["plugins"].jPushPlugin.init();
document.addEventListener("jpush.openNotification", window[options.ecb], false);
window.setTimeout(getRegistrationID, 1000);
window["plugins"].jPushPlugin.setDebugMode(true);
window["plugins"].jPushPlugin.setStatisticsOpen(true);
} catch (exception) {
console.log("初始化极光推送失败");
console.log(exception);
}
});
document.addEventListener('huaweipush.notificationOpened', window[options.ecb]);
cordova.exec(successCallback, errorCallback, "PushPlugin", "init", [options]);
}
} else {

@@ -61,3 +89,8 @@ cordova.exec(successCallback, errorCallback, "PushPlugin", "register", [options]);

if (platform.toLowerCase() == "android") {
cordova.exec(successCallback, errorCallback, "PushPlugin", "stop", []);
if (device.manufacturer.toLowerCase().indexOf("huawei") >= 0) {
cordova.exec(successCallback, errorCallback, "PushPlugin", "stop", []);
} else {
}
} else {

@@ -64,0 +97,0 @@ cordova.exec(successCallback, errorCallback, "PushPlugin", "unregister", [options]);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc