diff --git a/src/ios/Plugins/JPushPlugin.h b/src/ios/Plugins/JPushPlugin.h index dbc8d90..256b05a 100644 --- a/src/ios/Plugins/JPushPlugin.h +++ b/src/ios/Plugins/JPushPlugin.h @@ -48,6 +48,15 @@ //开关日志 -(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command; -(void)setLogOFF:(CDVInvokedUrlCommand*)command; +-(void)crashLogON:(CDVInvokedUrlCommand*)command; + +//本地推送 +-(void)setLocalNotification:(CDVInvokedUrlCommand*)command; +-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command; +-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command; + +//地理位置上报 [latitude,longitude] +-(void)setLocation:(CDVInvokedUrlCommand*)command; /* * 以下为js中可监听到的事件 diff --git a/src/ios/Plugins/JPushPlugin.m b/src/ios/Plugins/JPushPlugin.m index c8b1f63..db6d153 100644 --- a/src/ios/Plugins/JPushPlugin.m +++ b/src/ios/Plugins/JPushPlugin.m @@ -233,6 +233,32 @@ static NSDictionary *_luanchOptions = nil; [JPUSHService setLogOFF]; } +-(void)crashLogON:(CDVInvokedUrlCommand*)command{ + [JPUSHService crashLogON]; +} + +-(void)setLocalNotification:(CDVInvokedUrlCommand*)command{ + NSArray *arguments = command.arguments; + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:[((NSString*)arguments[0]) intValue]]; + NSString *alertBody = (NSString*)arguments[1]; + int badge = [(NSString*)arguments[2] intValue]; + NSString *idKey = (NSString*)arguments[3]; + NSDictionary *dict = (NSDictionary*)arguments[4]; + [JPUSHService setLocalNotification:date alertBody:alertBody badge:badge alertAction:nil identifierKey:idKey userInfo:dict soundName:nil]; +} + +-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command{ + [JPUSHService deleteLocalNotificationWithIdentifierKey:(NSString*)command.arguments[0]]; +} + +-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command{ + [JPUSHService clearAllLocalNotifications]; +} + +-(void)setLocation:(CDVInvokedUrlCommand*)command{ + [JPUSHService setLatitude:[((NSString*)command.arguments[0]) doubleValue] longitude:[((NSString*)command.arguments[1]) doubleValue]]; +} + #pragma mark- 内部方法 +(void)setLaunchOptions:(NSDictionary *)theLaunchOptions{ _luanchOptions = theLaunchOptions; diff --git a/www/JPushPlugin.js b/www/JPushPlugin.js index 61daa9f..93d834d 100644 --- a/www/JPushPlugin.js +++ b/www/JPushPlugin.js @@ -138,6 +138,36 @@ JPushPlugin.prototype.setLogOFF = function(){ this.call_native("setLogOFF",[data],null); } } +JPushPlugin.prototype.setCrashLogON = function(){ + if (this.isPlatformIOS()) { + var data=[]; + this.call_native("crashLogON",[data],null); + } +} +JPushPlugin.prototype.addLocalNotificationForIOS = function(delayTime,content,badge,notificationID,extras){ + if (this.isPlatformIOS()) { + var data = [delayTime,content,badge,notificationID,extras]; + this.call_native("setLocalNotification",data,null); + } +} +JPushPlugin.prototype.deleteLocalNotificationWithIdentifierKeyInIOS = function(identifierKey){ + if (this.isPlatformIOS()) { + var data=[identifierKey]; + this.call_native("deleteLocalNotificationWithIdentifierKey",data,null); + } +} +JPushPlugin.prototype.clearAllLocalNotifications = function(){ + if (this.isPlatformIOS()) { + var data=[]; + this.call_native("clearAllLocalNotifications",data,null); + } +} +JPushPlugin.prototype.setLocation = function(latitude,longitude){ + if (this.isPlatformIOS()) { + var data=[latitude,longitude]; + this.call_native("setLocation",data,null); + } +} JPushPlugin.prototype.receiveMessageIniOSCallback = function(data){ try{ console.log("JPushPlugin:receiveMessageIniOSCallback--data:"+data);