mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-01-31 14:32:51 +08:00
iOS-添加功能
1.add crash日志 接口 2.add 本地通知 相关接口 3.add 地理位置上报 接口
This commit is contained in:
parent
afe2230ed9
commit
6cee953edd
@ -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中可监听到的事件
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user