iOS-添加功能

1.add crash日志      接口
2.add 本地通知        相关接口
3.add 地理位置上报 接口
This commit is contained in:
E.B 2016-03-09 13:18:09 +08:00
parent afe2230ed9
commit 6cee953edd
3 changed files with 65 additions and 0 deletions

View File

@ -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中可监听到的事件

View File

@ -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;

View File

@ -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);