Compare commits

...

48 Commits

Author SHA1 Message Date
Hevin
5e85c6b5b0 Merge branch 'dev' 2018-03-01 17:05:08 +08:00
Hevin
c526a26231 Update comment about cordova android 7.0.0 2018-03-01 17:03:09 +08:00
Hevin
0380fbdc60 Merge branch 'dev' 2018-03-01 16:56:45 +08:00
Hevin
9c888aa964 Update comments about cordova-android 7.0.0 2018-03-01 16:56:33 +08:00
Hevin
14f03abce6 Merge branch 'dev' 2018-03-01 16:54:49 +08:00
Hevin
4b554fa2ca Add comments about cordova-android 7.0.0 2018-03-01 16:54:22 +08:00
Hevin
4085787f95 build: v3.4.1 2018-03-01 14:19:11 +08:00
Hevin
1eaf73a8d3 Merge branch 'dev' 2018-02-26 15:42:43 +08:00
Hevin
6c2bc206e3 Format the style 2018-02-26 15:42:29 +08:00
Hevin
10b457d489 Add comments of cordova-android 7.0.0 2018-02-26 15:29:36 +08:00
Hevin
5b0613628b Merge cordova_android_7.0.0 to dev 2018-02-26 14:59:36 +08:00
Hevin
6f77da5f41 build: v3.4.0
Support cordova-android 7.0.0
2018-02-26 14:50:53 +08:00
huangminlinux
24328f2ac9 update to 3.3.3 2018-02-06 15:38:47 +08:00
huangminlinux
8ccdbd525b fix app not launch open notification will fire twice bug 2018-02-06 14:32:12 +08:00
Hevin
54b653e442 Merge branch 'dev' 2018-01-27 10:27:49 +08:00
Hevin
8487d9c823 Merge branch 'dev' 2018-01-17 15:18:36 +08:00
huangminlinux
7549e347b7 Merge pull request #309 from jpush/dev
add issue template
2017-12-26 10:37:36 +08:00
Hevin
a6fc0bc7a1 Merge branch 'dev' 2017-12-20 13:23:13 +08:00
Hevin
7a4943e820 Merge branch 'dev' 2017-12-15 16:27:39 +08:00
Hevin
05b3fb1b82 Merge branch 'dev' 2017-12-15 16:04:25 +08:00
Hevin
f6ece7dd1e Merge branch 'dev' 2017-12-04 13:32:54 +08:00
huangminlinux
b282d70b2f Merge pull request #287 from jpush/dev
change arrow syntax to function
2017-11-08 03:05:43 -06:00
huangminlinux
82c6532d12 Merge pull request #286 from jpush/dev
update to 3.2.12
2017-11-07 23:58:22 -06:00
Hevin
b8f79dd130 Merge branch 'dev' 2017-11-03 17:38:08 +08:00
huangminlinux
1e2a4ce0e4 Merge pull request #284 from jpush/dev
update docs
2017-11-03 04:14:25 -05:00
Hevin
c708f396bd Merge branch 'dev' 2017-10-27 14:29:56 +08:00
Hevin
8b2a0daecc Merge branch 'dev' 2017-10-25 11:19:39 +08:00
Hevin
469af4fcd3 Merge branch 'dev' 2017-10-23 17:23:10 +08:00
Hevin
494df2e527 Merge branch 'dev' 2017-10-20 13:10:03 +08:00
Hevin
031acb9631 Merge branch 'dev' 2017-10-13 13:11:12 +08:00
Hevin
8d098d29b1 Merge branch 'dev' 2017-10-11 14:49:23 +08:00
huangminlinux
a9343ac776 Merge pull request #278 from jpush/dev
fix open local notification to launch app event bug
2017-10-11 01:43:19 -05:00
huangminlinux
de58071773 Merge pull request #277 from jpush/dev
remove jpush.startLocalNotification event in iOS docs
2017-10-10 22:30:56 -05:00
huangminlinux
13341fd68a Merge pull request #276 from jpush/dev
Dev
2017-10-10 22:28:05 -05:00
Hevin
edf29bbc8d Merge branch 'dev' 2017-09-28 10:25:03 +08:00
Hevin
ae54960da4 Merge branch 'dev' 2017-09-26 18:28:44 +08:00
Hevin
ea6011635f Merge branch 'dev' 2017-09-25 12:32:36 +08:00
Hevin
0829104534 Merge branch 'dev' 2017-09-23 09:11:34 +08:00
Hevin
592d5a5fb9 Merge branch 'dev' 2017-09-22 21:16:11 +08:00
Hevin
4753174bda Merge branch 'dev' 2017-09-22 20:24:21 +08:00
Hevin
3f077e32fd Merge branch 'dev' 2017-09-19 14:33:24 +08:00
Hevin
5c569d00da Merge branch 'dev' 2017-09-08 14:32:18 +08:00
Hevin
c5f7963425 Merge branch 'dev' 2017-07-21 14:15:57 +08:00
Hevin
a4eaf51455 Merge branch 'dev' 2017-07-21 14:00:30 +08:00
Hevin
04fae7d538 Merge branch 'dev' 2017-07-12 10:16:49 +08:00
Hevin
8e087e102a Merge branch 'dev' 2017-07-07 11:26:20 +08:00
Hevin
35c09c0c92 Merge branch 'dev' 2017-07-04 17:51:51 +08:00
Hevin
f0a87962e7 Merge branch 'dev' 2017-06-30 15:44:35 +08:00
4 changed files with 55 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
# JPush PhoneGap / Cordova Plugin
[![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin)
[![release](https://img.shields.io/badge/release-3.3.0-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![release](https://img.shields.io/badge/release-3.4.1-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin)
[![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
@@ -11,12 +11,13 @@
- 如需要短信验证码功能插件,可关注 [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms)
- 如需要统计分析功能插件,可关注 [cordova-plugin-janalytics](https://github.com/jpush/cordova-plugin-janalytics)
注意:目前插件暂未支持 cordova-android 7.0.0,因此在添加 android platform 时,请指定 7.0.0 以下版本,例如 6.4.0
>注意:插件从 v3.4.0 开始支持 cordova-android 7.0.0,因 cordova-android 7.0.0 修改了 Android 项目结构,因此不兼容之前的版本,升级前请务必注意
>
>如果需要安装之前版本的插件,请先安装 v1.2.0 以下版本(建议安装 v1.1.12)的 cordova-plugin-jcore再安装插件否则运行会报错。
## Install
> 注意:
>
> - 应用的包名一定要和 APP_KEY 对应应用的包名一致,否则极光推送服务无法注册成功。
> - 在使用 8 或以上版本的 Xcode 调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。

View File

@@ -1,6 +1,6 @@
{
"name": "jpush-phonegap-plugin",
"version": "3.3.2",
"version": "3.4.1",
"description": "JPush for cordova plugin",
"cordova": {
"id": "jpush-phonegap-plugin",
@@ -23,7 +23,7 @@
],
"devDependencies": {
"cordova-plugin-device": "*",
"cordova-plugin-jcore": "*"
"cordova-plugin-jcore": ">=1.2.0"
},
"author": "JiGuang",
"license": "MIT",

View File

@@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="jpush-phonegap-plugin"
version="3.3.2">
version="3.4.1">
<name>JPush</name>
<description>JPush for cordova plugin</description>
@@ -57,10 +57,6 @@
<config-file target="*JPushConfig.plist" parent="Appkey">
<string>$APP_KEY</string>
</config-file>
<!-- <hook type="after_platform_add" src="hooks/iosEnablePush.js" />
<hook type="after_plugin_install" src="hooks/iosEnablePush.js" />
<hook type="before_plugin_uninstall" src="hooks/iosDisablePush.js" /> -->
</platform>
<platform name="android">
@@ -70,8 +66,8 @@
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<!-- Required 一些系统要求的权限,如访问网络等-->
<config-file target="AndroidManifest.xml" parent="/manifest" mode="merge">
<!-- Required 一些系统要求的权限,如访问网络等 -->
<permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" />
@@ -90,8 +86,8 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<!-- Required SDK核心功能-->
<config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">
<!-- Required SDK核心功能 -->
<activity android:name="cn.jpush.android.ui.PushActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="orientation|keyboardHidden">
@@ -102,13 +98,13 @@
</intent-filter>
</activity>
<!-- Rich push 核心功能 since 2.0.6-->
<!-- Rich push 核心功能 since 2.0.6 -->
<activity android:name="cn.jpush.android.ui.PopWinActivity"
android:theme="@style/MyDialogStyle"
android:exported="false">
</activity>
<!-- Required SDK核心功能-->
<!-- Required SDK 核心功能 -->
<service android:name="cn.jpush.android.service.DownloadService"
android:enabled="true"
android:exported="false">
@@ -148,7 +144,7 @@
</intent-filter>
</receiver>
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的 JPush 服务相互拉起的功能。 -->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
<service android:name="cn.jpush.android.service.DaemonService"
android:enabled="true"
@@ -159,7 +155,7 @@
</intent-filter>
</service>
<!-- User defined. For test only 用户自定义的广播接收器 -->
<!-- 通知广播接收器 -->
<receiver
android:name="cn.jiguang.cordova.push.JPushReceiver"
android:enabled="true">
@@ -196,26 +192,30 @@
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
</config-file>
<source-file src="src/android/libs/jpush-android-3.1.1.jar" target-dir="libs" />
<lib-file src="src/android/libs/jpush-android-3.1.1.jar" />
<source-file src="src/android/JPushReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushReceiver.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushEventReceiver.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
target-dir="res/drawable" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml"
target-dir="res/drawable" />
<resource-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
target="res/drawable/jpush_richpush_btn_selector.xml" />
<resource-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml"
target="res/drawable/jpush_richpush_progressbar.xml" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png"
target-dir="res/drawable-hdpi" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png"
target-dir="res/drawable-hdpi" />
<resource-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png"
target="res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png" />
<resource-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png"
target="res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png" />
<source-file src="src/android/res/layout/jpush_popwin_layout.xml" target-dir="res/layout" />
<source-file src="src/android/res/layout/jpush_webview_layout.xml" target-dir="res/layout" />
<source-file src="src/android/res/layout/test_notification_layout.xml" target-dir="res/layout" />
<resource-file src="src/android/res/layout/jpush_popwin_layout.xml"
target="res/layout/jpush_popwin_layout.xml" />
<resource-file src="src/android/res/layout/jpush_webview_layout.xml"
target="res/layout/jpush_webview_layout.xml" />
<resource-file src="src/android/res/layout/test_notification_layout.xml"
target="res/layout/test_notification_layout.xml" />
<source-file src="src/android/res/values/jpush_style.xml" target-dir="res/values" />
<resource-file src="src/android/res/values/jpush_style.xml"
target="res/values/jpush_style.xml" />
</platform>
</plugin>

View File

@@ -40,7 +40,8 @@ NSDictionary *_launchOptions;
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
}];
if (notification) {
if (notification != nil &&
[[UIDevice currentDevice].systemVersion floatValue] < 10.0) {// iOS 10 openNotification
if (notification.userInfo) {
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
@@ -58,19 +59,19 @@ NSDictionary *_launchOptions;
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[localNotificationEvent toJsonString]];
}
}
[JPUSHService setDebugMode];
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
NSNumber *delay = [plistData valueForKey:JPushConfig_Delay];
_launchOptions = notification.userInfo;
if (![delay boolValue]) {
[self startJPushSDK];
}
}
[JPUSHService setDebugMode];
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
NSNumber *delay = [plistData valueForKey:JPushConfig_Delay];
_launchOptions = notification.userInfo;
if (![delay boolValue]) {
[self startJPushSDK];
}
}
-(void)startJPushSDK{
@@ -136,17 +137,12 @@ NSDictionary *_launchOptions;
[JPUSHService handleRemoteNotification:userInfo];
NSString *eventName;
switch ([UIApplication sharedApplication].applicationState) {
case UIApplicationStateInactive:
eventName = JPushDocumentEvent_OpenNotification;
break;
case UIApplicationStateActive:
eventName = JPushDocumentEvent_ReceiveNotification;
break;
case UIApplicationStateBackground:
eventName = JPushDocumentEvent_BackgroundNotification;
break;
default:
break;
case UIApplicationStateBackground:
eventName = JPushDocumentEvent_BackgroundNotification;
break;
default:
eventName = JPushDocumentEvent_ReceiveNotification;
break;
}
[JPushPlugin fireDocumentEvent:eventName jsString:[[self jpushFormatAPNSDic:userInfo] toJsonString]];