mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
add notificatoncenter and track page
This commit is contained in:
+74
-2
@@ -1,4 +1,4 @@
|
||||
|
||||
cordova.define("cn.jpush.phonegap.JPushPlugin.JPushPlugin", function(require, exports, module) {
|
||||
var JPushPlugin = function(){
|
||||
|
||||
};
|
||||
@@ -11,6 +11,67 @@ JPushPlugin.prototype.call_native = function ( name, args) {
|
||||
args);
|
||||
return ret;
|
||||
}
|
||||
JPushPlugin.prototype.getRegistrationID = function () {
|
||||
|
||||
this.call_native( "getRegistrationID", null);
|
||||
|
||||
}
|
||||
JPushPlugin.prototype.startLogPageView = function (data) {
|
||||
if (data==null || typeof(data)=="undefined" || data==""){
|
||||
console.log("argument is null");
|
||||
|
||||
}
|
||||
else{
|
||||
this.call_native( "startLogPageView", [data]);
|
||||
|
||||
}
|
||||
}
|
||||
JPushPlugin.prototype.stopLogPageView = function (data) {
|
||||
if (data==null || typeof(data)=="undefined" || data==""){
|
||||
console.log("argument is null");
|
||||
|
||||
}
|
||||
else{
|
||||
this.call_native( "stopLogPageView", [data]);
|
||||
|
||||
}
|
||||
}
|
||||
JPushPlugin.prototype.initNotificationCenter = function () {
|
||||
|
||||
this.call_native( "initNotifacationCenter", null);
|
||||
|
||||
}
|
||||
JPushPlugin.prototype.parseEvent = function (data) {
|
||||
try{
|
||||
var parament=""
|
||||
var count=1;
|
||||
var start=false;
|
||||
for(var i in data){
|
||||
|
||||
if(data[i]=='['){
|
||||
if (count==1&&start==false) {
|
||||
start=true;
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
if (data[i]==']') {
|
||||
if(count==1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
count--;
|
||||
}
|
||||
|
||||
parament+=data[i]
|
||||
|
||||
}
|
||||
return parament;
|
||||
}
|
||||
catch(exception){
|
||||
alert(exception);
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.setTagsWithAlias = function (tags,alias) {
|
||||
|
||||
@@ -52,12 +113,21 @@ JPushPlugin.prototype.pushCallback = function (data) {
|
||||
var code = bToObj.resultCode;
|
||||
var tags = bToObj.resultTags;
|
||||
var alias = bToObj.resultAlias;
|
||||
|
||||
console.log("JPushPlugin:callBack--code is "+code+" tags is "+tags + " alias is "+alias);
|
||||
}
|
||||
catch(exception){
|
||||
|
||||
alert(exception);
|
||||
}
|
||||
}
|
||||
JPushPlugin.prototype.registrationCallback = function (data) {
|
||||
try{
|
||||
console.log("registrationCallback--registraionID is "+data);
|
||||
}
|
||||
catch(exception){
|
||||
alert(exception);
|
||||
}
|
||||
}
|
||||
if(!window.plugins) {
|
||||
window.plugins = {};
|
||||
}
|
||||
@@ -65,3 +135,5 @@ if(!window.plugins.jPushPlugin){
|
||||
window.plugins.jPushPlugin = new JPushPlugin();
|
||||
}
|
||||
module.exports = new JPushPlugin();
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user