5.9.0: android 5.9.0 ios:5.9.0

This commit is contained in:
huangshuni
2025-10-21 15:26:48 +08:00
parent e4b4aa1271
commit 43a4917f23
18 changed files with 142 additions and 6 deletions
+18
View File
@@ -19,6 +19,7 @@ import cn.jpush.android.api.CustomMessage;
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.helper.Logger;
import cn.jpush.android.local.JPushConstants;
import cn.jpush.android.service.JPushMessageReceiver;
@@ -231,6 +232,23 @@ public class JPushEventReceiver extends JPushMessageReceiver {
}
}
@Override
public void onNotifyButtonClick(Context context, NotificationCustomButton notificationCustomButton) {
cn.jiguang.cordova.push.JLogger.d(TAG, "[onNotifyButtonClick], " + notificationCustomButton.toString());
try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("msgId", notificationCustomButton.a);
jsonObject.put("platform", notificationCustomButton.b);
jsonObject.put("name", notificationCustomButton.c);
jsonObject.put("actionType", notificationCustomButton.d);
jsonObject.put("action", notificationCustomButton.e);
jsonObject.put("data", notificationCustomButton.f);
cn.jiguang.cordova.push.JPushPlugin.transmitNotifyButtonClick(jsonObject);
} catch (Throwable throwable) {
cn.jiguang.cordova.push.JLogger.d(TAG, "[onNotifyButtonClick] throwable:" + throwable);
}
}
interface SuccessCallback{
void onSuccessCallback(JSONObject resultJson) throws JSONException;
}
+14
View File
@@ -197,6 +197,20 @@ public class JPushPlugin extends CordovaPlugin {
}
});
}
static void transmitNotifyButtonClick( JSONObject data) {
if (instance == null) {
return;
}
String format = "window.plugins.jPushPlugin.receiveNotifyButtonClickCallback(%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(JSONObject data) {
+4
View File
@@ -76,10 +76,14 @@ static NSMutableDictionary *_jpushEventCache;
// 设置手机号
-(void)setMobileNumber:(CDVInvokedUrlCommand*)command;
// 设置进入后台是否允许长连接 (iOS 5.9.0+)
-(void)setBackgroundEnable:(CDVInvokedUrlCommand*)command;
/*
* 以下为js中可监听到的事件
* jpush.openNotification 点击推送消息启动或唤醒app
* jpush.receiveMessage 收到自定义消息
* jpush.receiveNotifyButtonClick 收到通知栏自定义按钮点击事件
* jpush.receiveNotification 前台收到推送
* jpush.backgroundNotification 后台收到推送
*/
+6
View File
@@ -533,6 +533,12 @@
}
#pragma mark - 设置进入后台是否允许长连接 (iOS 5.9.0+)
-(void)setBackgroundEnable:(CDVInvokedUrlCommand *)command {
NSNumber* isEnable = [command argumentAtIndex:0];
[JPUSHService setBackgroundEnable:[isEnable boolValue]];
}
#pragma mark - 内部方法
+(void)setupJPushSDK:(NSDictionary*)userInfo{
@@ -9,7 +9,7 @@
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
*/
#define JPUSH_VERSION_NUMBER 5.7.0
#define JPUSH_VERSION_NUMBER 5.9.0
#import <Foundation/Foundation.h>
@@ -822,6 +822,16 @@ typedef NS_ENUM(NSUInteger, JPAuthorizationStatus) {
*/
+ (void)setPushEnable:(BOOL)isEnable completion:(nullable void (^)(NSInteger iResCode))completion;
/*!
* @abstract
*
* @param isEnable YES:NO:NO,
*
* @discussion
*
*/
+ (void)setBackgroundEnable:(BOOL)isEnable;
/*!
* @abstract
*
@@ -9,7 +9,7 @@
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
*/
#define JPUSH_VERSION_NUMBER 5.7.0
#define JPUSH_VERSION_NUMBER 5.9.0
#import <Foundation/Foundation.h>
@@ -822,6 +822,16 @@ typedef NS_ENUM(NSUInteger, JPAuthorizationStatus) {
*/
+ (void)setPushEnable:(BOOL)isEnable completion:(nullable void (^)(NSInteger iResCode))completion;
/*!
* @abstract
*
* @param isEnable YES:NO:NO,
*
* @discussion
*
*/
+ (void)setBackgroundEnable:(BOOL)isEnable;
/*!
* @abstract
*