mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-20 20:22:50 +08:00
iOS - update new API
1.添加检测用户通知设置的 API
This commit is contained in:
parent
c6b8a6f2f6
commit
0bb6838477
@ -58,6 +58,9 @@
|
||||
//地理位置上报 [latitude,longitude]
|
||||
-(void)setLocation:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
//检查用户的推送设置情况
|
||||
-(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
/*
|
||||
* 以下为js中可监听到的事件
|
||||
* jpush.openNotification 点击推送消息启动或唤醒app
|
||||
|
@ -259,6 +259,19 @@ static NSDictionary *_launchOptions = nil;
|
||||
[JPUSHService setLatitude:[((NSString*)command.arguments[0]) doubleValue] longitude:[((NSString*)command.arguments[1]) doubleValue]];
|
||||
}
|
||||
|
||||
-(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command{
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
|
||||
UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];
|
||||
NSString *description = [settings description];
|
||||
[self handleResultWithValue:description command:command];
|
||||
}else{
|
||||
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
|
||||
NSNumber *number = [NSNumber numberWithInteger:type];
|
||||
[self handleResultWithValue:number command:command];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark- 内部方法
|
||||
+(void)setLaunchOptions:(NSDictionary *)theLaunchOptions{
|
||||
_launchOptions = theLaunchOptions;
|
||||
|
@ -210,6 +210,12 @@ JPushPlugin.prototype.getApplicationIconBadgeNumber = function(callback) {
|
||||
}
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.getUserNotificationSettings = function(callback) {
|
||||
if(this.isPlatformIOS()) {
|
||||
this.call_native("getUserNotificationSettings", [], callback);
|
||||
}
|
||||
}
|
||||
|
||||
// Android methods
|
||||
JPushPlugin.prototype.setDebugMode = function(mode) {
|
||||
if(device.platform == "Android") {
|
||||
|
Loading…
Reference in New Issue
Block a user