chore: release jpush-phonegap-plugin v1.0

This commit is contained in:
huangshuni
2026-05-14 17:26:15 +08:00
parent ac15c5afc3
commit cf4d5de33c
5 changed files with 58 additions and 6 deletions
+6
View File
@@ -0,0 +1,6 @@
## 6.0.3 (2026-05-14)
Android 6.1.0新增setKeepLongConnInBackground和onVoipMessage回调;iOS 6.1.0修复已知问题
# Changelog
+3 -3
View File
@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
id="jpush-phonegap-plugin"
version="6.0.2">
version="6.0.3">
<name>JPush</name>
<description>JPush for cordova plugin</description>
@@ -52,7 +52,7 @@
<!-- JPush SDK 通过 CocoaPods 集成 -->
<podspec>
<pods>
<pod name="JPush" spec="6.0.0" />
<pod name="JPush" spec="6.1.0" />
</pods>
</podspec>
<resource-file src="src/ios/JPushConfig.plist" />
@@ -175,7 +175,7 @@
</config-file>
<!-- JPush SDK 通过 Maven 集成,替代本地 jar -->
<framework src="cn.jiguang.sdk:jpush:6.0.1" />
<framework src="cn.jiguang.sdk:jpush:6.1.0" />
<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" />
+15
View File
@@ -21,6 +21,7 @@ import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.api.NotificationCustomButton;
import cn.jpush.android.api.VoipDataMessage;
import cn.jpush.android.helper.Logger;
import cn.jpush.android.local.JPushConstants;
import cn.jpush.android.service.JPushMessageReceiver;
@@ -245,6 +246,20 @@ public class JPushEventReceiver extends JPushMessageReceiver {
}
@Override
public void onVoipMessage(Context context, VoipDataMessage voipDataMessage) {
cn.jiguang.cordova.push.JLogger.d(TAG, "onVoipMessage:" + voipDataMessage);
try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("messageId", voipDataMessage.getMessageId());
jsonObject.put("extraData", voipDataMessage.getExtraData());
jsonObject.put("platform", voipDataMessage.getPlatform());
cn.jiguang.cordova.push.JPushPlugin.transmitVoipMessage(jsonObject);
} catch (Throwable throwable) {
cn.jiguang.cordova.push.JLogger.d(TAG, "onVoipMessage throwable:" + throwable);
}
}
@Override
public void onNotifyButtonClick(Context context, NotificationCustomButton notificationCustomButton) {
cn.jiguang.cordova.push.JLogger.d(TAG, "[onNotifyButtonClick], " + notificationCustomButton.toString());
+24
View File
@@ -764,6 +764,30 @@ public class JPushPlugin extends CordovaPlugin {
}
}
void setBackgroundEnable(JSONArray data, CallbackContext callbackContext) {
try {
boolean keep = data.getBoolean(0);
JPushInterface.setKeepLongConnInBackground(mContext, keep);
callbackContext.success();
} catch (JSONException e) {
e.printStackTrace();
}
}
static void transmitVoipMessage(JSONObject data) {
if (instance == null) {
return;
}
String format = "window.plugins.jPushPlugin.receiveVoipMessageInAndroidCallback(%s);";
final String js = String.format(format, data.toString());
cordovaActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
instance.webView.loadUrl("javascript:" + js);
}
});
}
private boolean isValidHour(int hour) {
return !(hour < 0 || hour > 23);
}
+10 -3
View File
@@ -546,9 +546,16 @@ JPushPlugin.prototype.setAuth = function(isAuth){
* @param isEnable boolean 是否允许长连接
*/
JPushPlugin.prototype.setBackgroundEnable = function(isEnable) {
if (this.isPlatformIOS()) {
this.callNative("setBackgroundEnable", [isEnable], null);
}
this.callNative("setBackgroundEnable", [isEnable], null);
};
/**
* Android VOIP 消息回调(由 Native 调用,触发 jpush.receiveVoipMessage 事件)
*/
JPushPlugin.prototype.receiveVoipMessageInAndroidCallback = function(data) {
data = JSON.stringify(data);
this.voipMessage = JSON.parse(data);
cordova.fireDocumentEvent("jpush.receiveVoipMessage", this.voipMessage);
};
if (!window.plugins) {