mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-21 04:32:59 +08:00
iOS - new feature
1. 增加 jpush.backgroundNotification 事件 2. 重新区分原有事件的触发条件 3. 更新 文档接口说明
This commit is contained in:
parent
d1e4f70188
commit
95c9b12124
@ -60,10 +60,11 @@
|
||||
|
||||
/*
|
||||
* 以下为js中可监听到的事件
|
||||
* jpush.openNotification 点击推送消息唤醒或启动app
|
||||
* jpush.openNotification 点击推送消息启动或唤醒app
|
||||
* jpush.setTagsWithAlias 设置标签、别名完成
|
||||
* jpush.receiveMessage 收到自定义消息
|
||||
* jpush.receiveNotification 前台收到推送消息
|
||||
* jpush.receiveNotification 前台收到推送
|
||||
* jpush.backgoundNotification 后台收到推送
|
||||
*/
|
||||
|
||||
@end
|
||||
|
@ -356,29 +356,33 @@ static NSDictionary *_luanchOptions = nil;
|
||||
|
||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
||||
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
NSLog(@"%ld",(long)[UIApplication sharedApplication].applicationState);
|
||||
switch ([UIApplication sharedApplication].applicationState) {
|
||||
case UIApplicationStateActive:
|
||||
{
|
||||
case UIApplicationStateActive:{
|
||||
//前台收到
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.receiveNotification',%@)",jsonString]];
|
||||
});
|
||||
}
|
||||
break;
|
||||
case UIApplicationStateInactive:
|
||||
case UIApplicationStateBackground:
|
||||
{
|
||||
}
|
||||
case UIApplicationStateInactive:{
|
||||
//后台点击
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.openNotification',%@)",jsonString]];
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
case UIApplicationStateBackground:{
|
||||
//后台收到
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.backgoundNotification',%@)",jsonString]];
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//do nothing
|
||||
break;
|
||||
//do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user