mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-05-27 00:00:12 +08:00
chore: release jpush-phonegap-plugin v1.0
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
## 6.0.3 (2026-05-14)
|
||||||
|
|
||||||
|
Android 6.1.0新增setKeepLongConnInBackground和onVoipMessage回调;iOS 6.1.0修复已知问题
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|
||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
id="jpush-phonegap-plugin"
|
id="jpush-phonegap-plugin"
|
||||||
version="6.0.2">
|
version="6.0.3">
|
||||||
|
|
||||||
<name>JPush</name>
|
<name>JPush</name>
|
||||||
<description>JPush for cordova plugin</description>
|
<description>JPush for cordova plugin</description>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<!-- JPush SDK 通过 CocoaPods 集成 -->
|
<!-- JPush SDK 通过 CocoaPods 集成 -->
|
||||||
<podspec>
|
<podspec>
|
||||||
<pods>
|
<pods>
|
||||||
<pod name="JPush" spec="6.0.0" />
|
<pod name="JPush" spec="6.1.0" />
|
||||||
</pods>
|
</pods>
|
||||||
</podspec>
|
</podspec>
|
||||||
<resource-file src="src/ios/JPushConfig.plist" />
|
<resource-file src="src/ios/JPushConfig.plist" />
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<!-- JPush SDK 通过 Maven 集成,替代本地 jar -->
|
<!-- 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/PushService.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/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import cn.jpush.android.api.JPushInterface;
|
|||||||
import cn.jpush.android.api.JPushMessage;
|
import cn.jpush.android.api.JPushMessage;
|
||||||
import cn.jpush.android.api.NotificationMessage;
|
import cn.jpush.android.api.NotificationMessage;
|
||||||
import cn.jpush.android.api.NotificationCustomButton;
|
import cn.jpush.android.api.NotificationCustomButton;
|
||||||
|
import cn.jpush.android.api.VoipDataMessage;
|
||||||
import cn.jpush.android.helper.Logger;
|
import cn.jpush.android.helper.Logger;
|
||||||
import cn.jpush.android.local.JPushConstants;
|
import cn.jpush.android.local.JPushConstants;
|
||||||
import cn.jpush.android.service.JPushMessageReceiver;
|
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
|
@Override
|
||||||
public void onNotifyButtonClick(Context context, NotificationCustomButton notificationCustomButton) {
|
public void onNotifyButtonClick(Context context, NotificationCustomButton notificationCustomButton) {
|
||||||
cn.jiguang.cordova.push.JLogger.d(TAG, "[onNotifyButtonClick], " + notificationCustomButton.toString());
|
cn.jiguang.cordova.push.JLogger.d(TAG, "[onNotifyButtonClick], " + notificationCustomButton.toString());
|
||||||
|
|||||||
@@ -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) {
|
private boolean isValidHour(int hour) {
|
||||||
return !(hour < 0 || hour > 23);
|
return !(hour < 0 || hour > 23);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -546,9 +546,16 @@ JPushPlugin.prototype.setAuth = function(isAuth){
|
|||||||
* @param isEnable boolean 是否允许长连接
|
* @param isEnable boolean 是否允许长连接
|
||||||
*/
|
*/
|
||||||
JPushPlugin.prototype.setBackgroundEnable = function(isEnable) {
|
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) {
|
if (!window.plugins) {
|
||||||
|
|||||||
Reference in New Issue
Block a user