cordova-plugin-cnpush
Advanced tools
Comparing version 2.6.1 to 2.6.2
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2272999
242
876
51
3
5