diff --git a/README.md b/README.md index 5dfdf8e..1aacdc4 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git 1.使用PhoneGap/Cordova CLI命令安装 ``` cordova plugin add https://github.com/zhangqinghe/test.phonegap.git +cordova platforms add ios cordova build ios ``` diff --git a/example/.DS_Store b/example/.DS_Store index 5f44e0d..c8de8ac 100644 Binary files a/example/.DS_Store and b/example/.DS_Store differ diff --git a/example/index.html b/example/index.html index 2d763c4..9888c7f 100644 --- a/example/index.html +++ b/example/index.html @@ -20,22 +20,18 @@ initiateUI(); } var initiateUI = function() { - $("#setAliasButton").click(function(ev) { - console.log("setAliasButton"); - try{window.plugins.jPushPlugin.setAlias("myAlias");} - catch(exception){console.log(exception);} - - }) - $("#setTagButton").click(function(ev) { - console.log("setTagButton"); - try{window.plugins.jPushPlugin.setTags("myAlias");} - catch(exception){console.log(exception);} - - }) $("#setTagWithAliasButton").click(function(ev) { - console.log("setTagWithAliasButton"); - try{window.plugins.jPushPlugin.setTagsWithAlias("myTags","myTags1","myTags2","myAlias");} - catch(exception){console.log(exception);} + console.log("tap set tag/alias button!"); + + try{ + var tag1 = $("#tagText1").attr("value"); + console.log("tag1:"+tag1); + + window.plugins.jPushPlugin.setTagsWithAlias("myTags","myTags1","myTags2","myAlias"); + } + catch(exception){ + console.log(exception); + } }) } @@ -57,18 +53,37 @@

JPushPlugin Example


- -
- -
+ + + + + + + + + + +
+ +
+ +
+ +
+ + + + + +
+ +
- -
diff --git a/src/ios/Plugins/JPushPlugin.h b/src/ios/Plugins/JPushPlugin.h index ad9b2c6..b26f354 100644 --- a/src/ios/Plugins/JPushPlugin.h +++ b/src/ios/Plugins/JPushPlugin.h @@ -15,4 +15,5 @@ -(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command; -(void)setTags:(CDVInvokedUrlCommand*)command; -(void)setAlias:(CDVInvokedUrlCommand*)command; +-(void)getRegistrationID:(CDVInvokedUrlCommand*)command; @end diff --git a/src/ios/Plugins/JPushPlugin.m b/src/ios/Plugins/JPushPlugin.m index df41e24..b5424a0 100644 --- a/src/ios/Plugins/JPushPlugin.m +++ b/src/ios/Plugins/JPushPlugin.m @@ -59,7 +59,7 @@ -(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias{ - NSLog(@"recode is %d tags is %@ alias %@",resultCode,tags,alias); + //NSLog(@"recode is %d tags is %@ alias %@",resultCode,tags,alias); NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:resultCode],@"resultCode", tags==nil?[NSNull null]:[tags allObjects],@"resultTags", @@ -72,6 +72,9 @@ [self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",jsonString]]; }); } - +-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{ + +} + @end diff --git a/src/ios/lib/APService.h b/src/ios/lib/APService.h index 51d36e7..f7ebc99 100644 --- a/src/ios/lib/APService.h +++ b/src/ios/lib/APService.h @@ -4,36 +4,65 @@ // // Created by JPush on 12-8-15. // Copyright (c) 2012年 HXHG. All rights reserved. -// Version: 1.6.2 +// Version: 1.7.1 #import -extern NSString * const kAPNetworkDidSetupNotification; // 建立连接 -extern NSString * const kAPNetworkDidCloseNotification; // 关闭连接 -extern NSString * const kAPNetworkDidRegisterNotification; // 注册成功 -extern NSString * const kAPNetworkDidLoginNotification; // 登录成功 -extern NSString * const kAPNetworkDidReceiveMessageNotification; // 收到消息(非APNS) -extern NSString * const kAPServiceErrorNotification; // 错误提示 - +extern NSString *const kAPNetworkDidSetupNotification; // 建立连接 +extern NSString *const kAPNetworkDidCloseNotification; // 关闭连接 +extern NSString *const kAPNetworkDidRegisterNotification; // 注册成功 +extern NSString *const kAPNetworkDidLoginNotification; // 登录成功 +extern NSString *const + kAPNetworkDidReceiveMessageNotification; // 收到消息(非APNS) +extern NSString *const kAPServiceErrorNotification; // 错误提示 @interface APService : NSObject // 以下四个接口是必须调用的 -+ (void)setupWithOption:(NSDictionary *)launchingOption; // 初始化 -+ (void)registerForRemoteNotificationTypes:(int)types; // 注册APNS类型 -+ (void)registerDeviceToken:(NSData *)deviceToken; // 向服务器上报Device Token -+ (void)handleRemoteNotification:(NSDictionary *)remoteInfo; // 处理收到的APNS消息,向服务器上报收到APNS消息 ++ (void)setupWithOption:(NSDictionary *)launchingOption; // 初始化 ++ (void)registerForRemoteNotificationTypes:(int)types; // 注册APNS类型 ++ (void)registerDeviceToken:(NSData *)deviceToken; // 向服务器上报Device Token ++ (void)handleRemoteNotification:(NSDictionary *) + remoteInfo; // 处理收到的APNS消息,向服务器上报收到APNS消息 // 下面的接口是可选的 // 设置标签和(或)别名(若参数为nil,则忽略;若是空对象,则清空;详情请参考文档:http://docs.jpush.cn/pages/viewpage.action?pageId=3309913) -+ (void)setTags:(NSSet *)tags alias:(NSString *)alias DEPRECATED_ATTRIBUTE; -+ (void)setTags:(NSSet *)tags alias:(NSString *)alias callbackSelector:(SEL)cbSelector target:(id)theTarget; -+ (void)setTags:(NSSet *)tags alias:(NSString *)alias callbackSelector:(SEL)cbSelector object:(id)theTarget; -+ (void)setTags:(NSSet *)tags callbackSelector:(SEL)cbSelector object:(id)theTarget; -+ (void)setAlias:(NSString *)alias callbackSelector:(SEL)cbSelector object:(id)theTarget; ++ (void)setTags:(NSSet *)tags + alias:(NSString *)alias + callbackSelector:(SEL)cbSelector + target:(id)theTarget; ++ (void)setTags:(NSSet *)tags + alias:(NSString *)alias + callbackSelector:(SEL)cbSelector + object:(id)theTarget; ++ (void)setTags:(NSSet *)tags + callbackSelector:(SEL)cbSelector + object:(id)theTarget; ++ (void)setAlias:(NSString *)alias + callbackSelector:(SEL)cbSelector + object:(id)theTarget; // 用于过滤出正确可用的tags,如果总数量超出最大限制则返回最大数量的靠前的可用tags -+ (NSSet*)filterValidTags:(NSSet*)tags; ++ (NSSet *)filterValidTags:(NSSet *)tags; -+ (NSString *)openUDID; // UDID +/** + * 记录页面停留时间功能。 + * startLogPageView和stopLogPageView为自动计算停留时间 + * beginLogPageView为手动自己输入停留时间 + * + * @param pageName 页面名称 + * @param seconds 页面停留时间 + */ ++ (void)startLogPageView:(NSString *)pageName; ++ (void)stopLogPageView:(NSString *)pageName; ++ (void)beginLogPageView:(NSString *)pageName duration:(int)seconds; +/** + * get the UDID + */ ++ (NSString *)openUDID DEPRECATED_ATTRIBUTE; // UDID + +/** + * get RegistionID + */ ++ (NSString *)registrionID; @end diff --git a/src/ios/lib/libPushSDK.a b/src/ios/lib/libPushSDK.a index 51fe738..3319c07 100644 Binary files a/src/ios/lib/libPushSDK.a and b/src/ios/lib/libPushSDK.a differ diff --git a/www/JPushPlugin.js b/www/JPushPlugin.js index b45f73f..4da3492 100644 --- a/www/JPushPlugin.js +++ b/www/JPushPlugin.js @@ -3,7 +3,7 @@ var JPushPlugin = function(){ }; JPushPlugin.prototype.call_native = function ( name, args) { - console.log("JPushPlugin.call_native:"+name); + ret = cordova.exec(null, null, 'JPushPlugin', @@ -11,9 +11,9 @@ JPushPlugin.prototype.call_native = function ( name, args) { args); return ret; } + JPushPlugin.prototype.setTagsWithAlias = function (tags,alias) { - console.log("JPushPlugin:setTagsWithAlias"); if(tags==null){ this.setAlias(alias); return; @@ -28,7 +28,6 @@ JPushPlugin.prototype.setTagsWithAlias = function (tags,alias) { } JPushPlugin.prototype.setTags = function (data) { - console.log("JPushPlugin:setTags"); try{ this.call_native("setTags", [data]); } @@ -38,7 +37,6 @@ JPushPlugin.prototype.setTags = function (data) { } JPushPlugin.prototype.setAlias = function (data) { - console.log("JPushPlugin:setAlias"); try{ this.call_native("setAlias", [data]); @@ -54,7 +52,7 @@ 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);