Compare commits

...

41 Commits

Author SHA1 Message Date
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 53 additions and 58 deletions
+2 -3
View File
@@ -1,7 +1,7 @@
# JPush PhoneGap / Cordova Plugin # 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) [![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.0-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) [![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) [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
@@ -11,12 +11,11 @@
- 如需要短信验证码功能插件,可关注 [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms) - 如需要短信验证码功能插件,可关注 [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms)
- 如需要统计分析功能插件,可关注 [cordova-plugin-janalytics](https://github.com/jpush/cordova-plugin-janalytics) - 如需要统计分析功能插件,可关注 [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 以下版本的 cordova-plugin-jcore,再安装插件
## Install ## Install
> 注意: > 注意:
>
> - 应用的包名一定要和 APP_KEY 对应应用的包名一致,否则极光推送服务无法注册成功。 > - 应用的包名一定要和 APP_KEY 对应应用的包名一致,否则极光推送服务无法注册成功。
> - 在使用 8 或以上版本的 Xcode 调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。 > - 在使用 8 或以上版本的 Xcode 调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "jpush-phonegap-plugin", "name": "jpush-phonegap-plugin",
"version": "3.3.2", "version": "3.4.0",
"description": "JPush for cordova plugin", "description": "JPush for cordova plugin",
"cordova": { "cordova": {
"id": "jpush-phonegap-plugin", "id": "jpush-phonegap-plugin",
@@ -23,7 +23,7 @@
], ],
"devDependencies": { "devDependencies": {
"cordova-plugin-device": "*", "cordova-plugin-device": "*",
"cordova-plugin-jcore": "*" "cordova-plugin-jcore": ">=1.2.0"
}, },
"author": "JiGuang", "author": "JiGuang",
"license": "MIT", "license": "MIT",
+29 -29
View File
@@ -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.3.2"> version="3.4.0">
<name>JPush</name> <name>JPush</name>
<description>JPush for cordova plugin</description> <description>JPush for cordova plugin</description>
@@ -57,10 +57,6 @@
<config-file target="*JPushConfig.plist" parent="Appkey"> <config-file target="*JPushConfig.plist" parent="Appkey">
<string>$APP_KEY</string> <string>$APP_KEY</string>
</config-file> </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>
<platform name="android"> <platform name="android">
@@ -70,8 +66,8 @@
</feature> </feature>
</config-file> </config-file>
<config-file target="AndroidManifest.xml" parent="/manifest"> <config-file target="AndroidManifest.xml" parent="/manifest" mode="merge">
<!-- Required 一些系统要求的权限,如访问网络等--> <!-- Required 一些系统要求的权限,如访问网络等 -->
<permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE" <permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" /> android:protectionLevel="signature" />
@@ -90,8 +86,8 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</config-file> </config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application"> <config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">
<!-- Required SDK核心功能--> <!-- Required SDK核心功能 -->
<activity android:name="cn.jpush.android.ui.PushActivity" <activity android:name="cn.jpush.android.ui.PushActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="orientation|keyboardHidden"> android:configChanges="orientation|keyboardHidden">
@@ -102,13 +98,13 @@
</intent-filter> </intent-filter>
</activity> </activity>
<!-- Rich push 核心功能 since 2.0.6--> <!-- Rich push 核心功能 since 2.0.6 -->
<activity android:name="cn.jpush.android.ui.PopWinActivity" <activity android:name="cn.jpush.android.ui.PopWinActivity"
android:theme="@style/MyDialogStyle" android:theme="@style/MyDialogStyle"
android:exported="false"> android:exported="false">
</activity> </activity>
<!-- Required SDK核心功能--> <!-- Required SDK 核心功能 -->
<service android:name="cn.jpush.android.service.DownloadService" <service android:name="cn.jpush.android.service.DownloadService"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
@@ -148,7 +144,7 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 --> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的 JPush 服务相互拉起的功能。 -->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 --> <!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
<service android:name="cn.jpush.android.service.DaemonService" <service android:name="cn.jpush.android.service.DaemonService"
android:enabled="true" android:enabled="true"
@@ -159,7 +155,7 @@
</intent-filter> </intent-filter>
</service> </service>
<!-- User defined. For test only 用户自定义的广播接收器 --> <!-- 通知广播接收器 -->
<receiver <receiver
android:name="cn.jiguang.cordova.push.JPushReceiver" android:name="cn.jiguang.cordova.push.JPushReceiver"
android:enabled="true"> android:enabled="true">
@@ -196,26 +192,30 @@
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" /> <meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
</config-file> </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/JPushReceiver.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/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="src/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" <resource-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
target-dir="res/drawable" /> target="res/drawable/jpush_richpush_btn_selector.xml" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml" <resource-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml"
target-dir="res/drawable" /> target="res/drawable/jpush_richpush_progressbar.xml" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png" <resource-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png"
target-dir="res/drawable-hdpi" /> target="res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png" <resource-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png"
target-dir="res/drawable-hdpi" /> 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" /> <resource-file src="src/android/res/layout/jpush_popwin_layout.xml"
<source-file src="src/android/res/layout/jpush_webview_layout.xml" target-dir="res/layout" /> target="res/layout/jpush_popwin_layout.xml" />
<source-file src="src/android/res/layout/test_notification_layout.xml" target-dir="res/layout" /> <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> </platform>
</plugin> </plugin>
+20 -24
View File
@@ -40,7 +40,8 @@ NSDictionary *_launchOptions;
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]]; [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) {
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
@@ -58,19 +59,19 @@ NSDictionary *_launchOptions;
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[localNotificationEvent toJsonString]]; [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{ -(void)startJPushSDK{
@@ -136,17 +137,12 @@ NSDictionary *_launchOptions;
[JPUSHService handleRemoteNotification:userInfo]; [JPUSHService handleRemoteNotification:userInfo];
NSString *eventName; NSString *eventName;
switch ([UIApplication sharedApplication].applicationState) { switch ([UIApplication sharedApplication].applicationState) {
case UIApplicationStateInactive: case UIApplicationStateBackground:
eventName = JPushDocumentEvent_OpenNotification; eventName = JPushDocumentEvent_BackgroundNotification;
break; break;
case UIApplicationStateActive: default:
eventName = JPushDocumentEvent_ReceiveNotification; eventName = JPushDocumentEvent_ReceiveNotification;
break; break;
case UIApplicationStateBackground:
eventName = JPushDocumentEvent_BackgroundNotification;
break;
default:
break;
} }
[JPushPlugin fireDocumentEvent:eventName jsString:[[self jpushFormatAPNSDic:userInfo] toJsonString]]; [JPushPlugin fireDocumentEvent:eventName jsString:[[self jpushFormatAPNSDic:userInfo] toJsonString]];