mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edf29bbc8d | |||
| ae54960da4 | |||
| ea6011635f | |||
| 0829104534 | |||
| 592d5a5fb9 | |||
| 4753174bda | |||
| 3f077e32fd | |||
| 5c569d00da | |||
| c5f7963425 | |||
| a4eaf51455 | |||
| 04fae7d538 | |||
| 8e087e102a | |||
| 35c09c0c92 | |||
| f0a87962e7 |
@@ -1,7 +1,7 @@
|
|||||||
# JPush PhoneGap / Cordova Plugin
|
# JPush PhoneGap / Cordova Plugin
|
||||||
|
|
||||||
[](https://travis-ci.org/jpush/jpush-phonegap-plugin)
|
[](https://travis-ci.org/jpush/jpush-phonegap-plugin)
|
||||||
[](https://github.com/jpush/jpush-phonegap-plugin/releases)
|
[](https://github.com/jpush/jpush-phonegap-plugin/releases)
|
||||||
[](https://github.com/jpush/jpush-phonegap-plugin)
|
[](https://github.com/jpush/jpush-phonegap-plugin)
|
||||||
[](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
|
[](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
|
||||||
|
|
||||||
|
|||||||
@@ -437,7 +437,9 @@ window.JPush.clearAllLocalNotifications()
|
|||||||
|
|
||||||
监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
|
监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
|
||||||
|
|
||||||
|
### 点击本地通知横幅启动 App
|
||||||
|
|
||||||
|
监听 `jpush.startLocalNotification` 事件。
|
||||||
|
|
||||||
## 页面的统计
|
## 页面的统计
|
||||||
|
|
||||||
@@ -724,6 +726,10 @@ window.JPush.getUserNotificationSettings(callback)
|
|||||||
|
|
||||||
[获取自定义消息内容](#获取自定义消息内容)
|
[获取自定义消息内容](#获取自定义消息内容)
|
||||||
|
|
||||||
|
### jpush.startLocalNotification
|
||||||
|
|
||||||
|
[点击本地通知横幅启动 App](#点击本地通知横幅启动-app)
|
||||||
|
|
||||||
### jpush.receiveLocalNotification
|
### jpush.receiveLocalNotification
|
||||||
|
|
||||||
[iOS 10 before 收到本地通知](#ios-10-before-收到本地通知)
|
[iOS 10 before 收到本地通知](#ios-10-before-收到本地通知)
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jpush-phonegap-plugin",
|
"name": "jpush-phonegap-plugin",
|
||||||
"version": "3.2.7",
|
"version": "3.2.6",
|
||||||
"description": "JPush for cordova plugin",
|
"description": "JPush for cordova plugin",
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"id": "jpush-phonegap-plugin",
|
"id": "jpush-phonegap-plugin",
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
id="jpush-phonegap-plugin"
|
id="jpush-phonegap-plugin"
|
||||||
version="3.2.7">
|
version="3.2.6">
|
||||||
|
|
||||||
<name>JPush</name>
|
<name>JPush</name>
|
||||||
<description>JPush for cordova plugin</description>
|
<description>JPush for cordova plugin</description>
|
||||||
|
|||||||
@@ -38,28 +38,19 @@
|
|||||||
NSDictionary *_launchOptions;
|
NSDictionary *_launchOptions;
|
||||||
-(void)applicationDidLaunch:(NSNotification *)notification{
|
-(void)applicationDidLaunch:(NSNotification *)notification{
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jpushSDKDidLoginNotification) name:kJPFNetworkDidLoginNotification object:nil];
|
|
||||||
|
|
||||||
if (notification) {
|
if (notification) {
|
||||||
if (notification.userInfo) {
|
if (notification.userInfo) {
|
||||||
|
NSDictionary *userInfo1 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
||||||
|
if (userInfo1.count > 0) {
|
||||||
|
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo1 repeats:YES];
|
||||||
|
}
|
||||||
|
|
||||||
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
|
NSDictionary *userInfo2 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
|
||||||
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:)
|
if (userInfo2.count > 0) {
|
||||||
userInfo:[notification.userInfo
|
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo2 repeats:YES];
|
||||||
valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey] repeats:YES];
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) {
|
|
||||||
UILocalNotification *localNotification = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
|
|
||||||
|
|
||||||
NSDictionary* localNotificationEvent = @{@"content":localNotification.alertBody,
|
|
||||||
@"badge": @(localNotification.applicationIconBadgeNumber),
|
|
||||||
@"extras":localNotification.userInfo,
|
|
||||||
};
|
|
||||||
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:localNotificationEvent repeats:YES];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JPUSHService setDebugMode];
|
[JPUSHService setDebugMode];
|
||||||
|
|
||||||
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
|
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
|
||||||
@@ -79,11 +70,6 @@ NSDictionary *_launchOptions;
|
|||||||
[JPushPlugin setupJPushSDK:_launchOptions];
|
[JPushPlugin setupJPushSDK:_launchOptions];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)jpushSDKDidLoginNotification {
|
|
||||||
NSDictionary *event = @{@"registrationId": JPUSHService.registrationID};
|
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)registerForRemoteNotification{
|
-(void)registerForRemoteNotification{
|
||||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
|
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
|
||||||
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
|
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ static NSString *const JPushDocumentEvent_OpenNotification = @"openNoti
|
|||||||
static NSString *const JPushDocumentEvent_BackgroundNotification = @"backgroundNotification";
|
static NSString *const JPushDocumentEvent_BackgroundNotification = @"backgroundNotification";
|
||||||
static NSString *const JPushDocumentEvent_SetTagsWithAlias = @"setTagsWithAlias";
|
static NSString *const JPushDocumentEvent_SetTagsWithAlias = @"setTagsWithAlias";
|
||||||
static NSString *const JPushDocumentEvent_ReceiveMessage = @"receiveMessage";
|
static NSString *const JPushDocumentEvent_ReceiveMessage = @"receiveMessage";
|
||||||
|
static NSString *const JPushDocumentEvent_StartLocalNotification = @"startLocalNotification";
|
||||||
static NSString *const JPushDocumentEvent_ReceiveLocalNotification = @"receiveLocalNotification";
|
static NSString *const JPushDocumentEvent_ReceiveLocalNotification = @"receiveLocalNotification";
|
||||||
|
|
||||||
static NSString *const JPushDocumentEvent_receiveRegistrationId = @"receiveRegistrationId";
|
|
||||||
|
|||||||
Reference in New Issue
Block a user