更新JPush5.0.3,删除引起自启的配置

This commit is contained in:
Lcterry 2023-05-19 15:30:00 +08:00
parent 0a53660cd9
commit f0b00a2d53
16 changed files with 415 additions and 48 deletions

View File

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

View File

@ -141,20 +141,7 @@
</intent-filter>
</activity>
<!-- Required SDK 核心功能-->
<!-- 可配置android:process参数将PushService放在其他进程中 -->
<service
android:name="cn.jpush.android.service.PushService"
android:process=":pushcore"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTER" />
<action android:name="cn.jpush.android.intent.REPORT" />
<action android:name="cn.jpush.android.intent.PushService" />
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
</intent-filter>
</service>
<!-- since 3.0.9 Required SDK 核心功能-->
<provider
@ -164,25 +151,7 @@
android:exported="false"
/>
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
<service
android:name="cn.jpush.android.service.DaemonService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="cn.jpush.android.intent.DaemonService" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</service>
<!-- since 3.1.0 Required SDK 核心功能-->
<provider
android:authorities="$PACKAGE_NAME.DownloadProvider"
android:name="cn.jpush.android.service.DownloadProvider"
android:exported="true"
/>
<!-- Required SDK核心功能-->
<receiver
@ -193,21 +162,9 @@
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!--Required 显示通知栏 -->
<category android:name="$PACKAGE_NAME" />
</intent-filter>
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<!-- Optional -->
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<!-- Required SDK核心功能-->
<receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false"/>
<!-- 3.5.0新增,用于定时展示功能 -->
<receiver android:name="cn.jpush.android.service.SchedulerReceiver" android:exported="false"/>
@ -279,10 +236,13 @@
<!-- Required . Enable it you can get statistics data with channel -->
<meta-data android:name="JPUSH_CHANNEL" android:value="$CHANNEL"/>
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" /> <!-- </>值来自开发者平台取得的AppKey-->
<provider
android:exported="false"
android:authorities="${applicationId}.jiguang.InitProvider"
android:name="cn.jpush.android.service.InitProvider"></provider>
</config-file>
<lib-file src="src/android/libs/jpush-android-4.8.5.jar" />
<lib-file src="src/android/libs/jpush-android-5.0.3.jar" />
<source-file src="src/android/PushService.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
@ -290,6 +250,21 @@
<source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JLogger.java" target-dir="src/cn/jiguang/cordova/push" />
<resource-file src="src/android/res/drawable-hdpi/jpush_btn_blue_bg.xml"
target="res/drawable/jpush_btn_blue_bg.xml" />
<resource-file src="src/android/res/drawable-hdpi/jpush_btn_grey_bg.xml"
target="res/drawable/jpush_btn_grey_bg.xml" />
<resource-file src="src/android/res/drawable-hdpi/jpush_cancel_btn_bg.xml"
target="res/drawable/jpush_cancel_btn_bg.xml" />
<resource-file src="src/android/res/drawable-hdpi/jpush_close.xml"
target="res/drawable/jpush_close.xml" />
<resource-file src="src/android/res/drawable-hdpi/jpush_contain_bg.xml"
target="res/drawable/jpush_contain_bg.xml" />
<resource-file src="src/android/res/drawable-hdpi/jpush_interstitial_bg.xml"
target="res/drawable/jpush_interstitial_bg.xml" />
<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"
@ -322,6 +297,14 @@
<resource-file src="src/android/res/layout/push_download_notification_layout.xml"
target="res/layout/push_download_notification_layout.xml" />
<resource-file src="src/android/res/layout/jpush_interstitial.xml"
target="res/layout/jpush_interstitial.xml" />
<resource-file src="src/android/res/layout/jpush_full.xml"
target="res/layout/jpush_full.xml" />
<resource-file src="src/android/res/layout/jpush_banner.xml"
target="res/layout/jpush_banner.xml" />
<resource-file src="src/android/res/layout-v21/push_notification.xml"
target="res/layout-v21/push_notification.xml" />
<resource-file src="src/android/res/layout-v21/push_notification_middle.xml"

View File

@ -121,7 +121,42 @@ public class JPushEventReceiver extends JPushMessageReceiver {
super.onMultiActionClicked(context, intent);
JLogger.d(TAG,"onMultiActionClicked:"+intent);
}
@Override
public void onInAppMessageShow(Context context,final NotificationMessage message) {
JLogger.d(TAG, "[onInAppMessageShow], " + message.toString());
try {
JSONObject jsonObject=new JSONObject();
jsonObject.put("title", message.inAppMsgTitle);
jsonObject.put("alert", message.inAppMsgContentBody);
jsonObject.put("messageId", message.msgId);
jsonObject.put("inAppShowTarget", message.inAppExtras);
jsonObject.put("inAppClickAction", message.inAppClickAction);
jsonObject.put("inAppExtras", message.inAppExtras);
cn.jiguang.cordova.push.JPushPlugin.transmitInAppMessageShow(jsonObject);
}catch (Throwable throwable){
}
}
@Override
public void onInAppMessageClick(Context context,final NotificationMessage message) {
JLogger.d(TAG, "[onInAppMessageClick], " + message.toString());
try {
JSONObject jsonObject=new JSONObject();
jsonObject.put("title", message.inAppMsgTitle);
jsonObject.put("alert", message.inAppMsgContentBody);
jsonObject.put("messageId", message.msgId);
jsonObject.put("inAppShowTarget", message.inAppExtras);
jsonObject.put("inAppClickAction", message.inAppClickAction);
jsonObject.put("inAppExtras", message.inAppExtras);
cn.jiguang.cordova.push.JPushPlugin.transmitInAppMessageClick(jsonObject);
}catch (Throwable throwable){
}
}
interface SuccessCallback{
void onSuccessCallback(JSONObject resultJson) throws JSONException;
}

View File

@ -175,6 +175,33 @@ public class JPushPlugin extends CordovaPlugin {
}
});
}
static void transmitInAppMessageClick( JSONObject data) {
if (instance == null) {
return;
}
String format = "window.plugins.jPushPlugin.receiveInAppMessageClickCallback(%s);";
final String js = String.format(format, data.toString());
cordovaActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
instance.webView.loadUrl("javascript:" + js);
}
});
}
static void transmitInAppMessageShow( JSONObject data) {
if (instance == null) {
return;
}
String format = "window.plugins.jPushPlugin.receiveInAppMessageShowCallback(%s);";
final String js = String.format(format, data.toString());
cordovaActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
instance.webView.loadUrl("javascript:" + js);
}
});
}
static void transmitNotificationOpen(String title, String alert, Map<String, Object> extras) {
if (instance == null) {

Binary file not shown.

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff2c6bff" />
<corners android:radius="25dp" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<stroke android:width="0.1dp"/>
<corners android:radius="20dp" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke android:width="1dp"
android:color="#E2E3E5"
/>
<corners android:radius="25dp" />
</shape>

View File

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M15,15m-15,0a15,15 0,1 1,30 0a15,15 0,1 1,-30 0"
android:strokeWidth="1"
android:fillColor="#253044"
android:fillAlpha="0.68"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
<path
android:pathData="M19.7356,10.2465C20.0722,10.5832 20.0722,11.129 19.7356,11.4656L16.21,14.99L19.7328,18.5129C20.0696,18.8498 20.0696,19.3959 19.7328,19.7328C19.3959,20.0696 18.8498,20.0696 18.5129,19.7328L14.99,16.21L11.4656,19.7356C11.129,20.0722 10.5832,20.0722 10.2465,19.7356C9.9099,19.3989 9.9099,18.8531 10.2465,18.5165L13.771,14.991L10.2493,11.4692C9.9125,11.1323 9.9125,10.5862 10.2493,10.2493C10.5862,9.9125 11.1323,9.9125 11.4692,10.2493L14.991,13.771L18.5165,10.2465C18.8531,9.9099 19.3989,9.9099 19.7356,10.2465Z"
android:strokeWidth="1"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<corners android:radius="15dp" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
</shape>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<RelativeLayout
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<cn.jpush.android.ui.ShadowViewCard
android:id="@+id/bg_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="@+id/banner_content"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<cn.jpush.android.ui.RoundedImageView
android:id="@+id/image_small"
android:layout_centerVertical="true"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginEnd="8dp"
android:scaleType="fitXY"
/>
<TextView
android:id="@+id/text_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/image_small"
android:layout_marginBottom="6dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#ff253044"
android:textSize="20sp" />
<TextView
android:id="@+id/text_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/text_title"
android:layout_toRightOf="@+id/image_small"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#85253044"
android:textSize="18sp" />
</RelativeLayout>
</cn.jpush.android.ui.ShadowViewCard>
<cn.jpush.android.ui.RoundedImageView
android:id="@+id/image_only"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
/>
<FrameLayout
android:id="@+id/countdown_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="20dp"
android:layout_marginRight="16dp">
<TextView
android:layout_gravity="right"
android:id="@+id/btn_countdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/jpush_btn_grey_bg"
android:paddingLeft="12dp"
android:paddingTop="5dp"
android:ellipsize="end"
android:maxLines="1"
android:paddingRight="12dp"
android:paddingBottom="5dp"
android:text=""
android:textColor="#ff2c6bff"
android:textSize="20sp" />
<ImageView
android:id="@+id/image_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/jpush_close" />
</FrameLayout>
</FrameLayout>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
android:orientation="vertical">
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<LinearLayout
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<cn.jpush.android.ui.RoundedImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="140dp"
android:scaleType="fitXY"
android:visibility="gone" />
<LinearLayout
android:id="@+id/bg_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/jpush_interstitial_bg"
android:orientation="vertical">
<LinearLayout
android:id="@+id/margeview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/text_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:text=""
android:ellipsize="end"
android:maxLines="1"
android:textColor="#ff253044"
android:textSize="22sp" />
<TextView
android:id="@+id/text_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:maxHeight="130dp"
android:scrollbars="vertical"
android:text=""
android:textColor="#ad253044"
android:textSize="18sp"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/btn_parent_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_one"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/jpush_cancel_btn_bg"
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#d6253044"
android:textSize="20sp" />
<TextView
android:ellipsize="end"
android:maxLines="1"
android:id="@+id/btn_two"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/jpush_btn_blue_bg"
android:gravity="center"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:textColor="#ffffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<cn.jpush.android.ui.RoundedImageView
android:id="@+id/image_only"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:visibility="gone" />
</FrameLayout>
<ImageView
android:id="@+id/img_top_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/frame"
android:layout_alignParentRight="true"
android:layout_marginEnd="16dp"
android:layout_marginBottom="6dp"
android:src="@drawable/jpush_close"
android:visibility="gone"
/>
<ImageView
android:id="@+id/img_bottom_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/frame"
android:layout_centerInParent="true"
android:layout_marginTop="16dp"
android:src="@drawable/jpush_close"
android:visibility="gone" />
</RelativeLayout>

View File

@ -369,6 +369,20 @@ JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data) {
this.receiveMessage = JSON.parse(data);
cordova.fireDocumentEvent("jpush.receiveMessage", this.receiveMessage);
};
JPushPlugin.prototype.receiveInAppMessageClickCallback = function(data) {
if (device.platform === "Android") {
data = JSON.stringify(data);
this.receiveMessage = JSON.parse(data);
cordova.fireDocumentEvent("jpush.receiveInAppMessageClick", this.receiveMessage);
}
};
JPushPlugin.prototype.receiveInAppMessageShowCallback = function(data) {
if (device.platform === "Android") {
data = JSON.stringify(data);
this.receiveMessage = JSON.parse(data);
cordova.fireDocumentEvent("jpush.receiveInAppMessageShow", this.receiveMessage);
}
};
JPushPlugin.prototype.openNotificationInAndroidCallback = function(data) {
data = JSON.stringify(data);