Skip to content

Commit

Permalink
Merge pull request #951 from LcTerry/master
Browse files Browse the repository at this point in the history
更新版JPush 540 版本号3.1.0
  • Loading branch information
LcTerry authored Jul 9, 2024
2 parents 9273903 + ef98578 commit 9a32604
Show file tree
Hide file tree
Showing 9 changed files with 629 additions and 8 deletions.
Binary file removed android/libs/jpush-android-5.2.0.jar
Binary file not shown.
Binary file added android/libs/jpush-android-5.4.0.jar
Binary file not shown.
12 changes: 7 additions & 5 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
<category android:name="${applicationId}" />
</intent-filter>
</activity>
<service
<receiver
android:name=".receiver.JPushModuleReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="cn.jpush.android.intent.SERVICE_MESSAGE" />
<action android:name="cn.jpush.android.intent.RECEIVER_MESSAGE" />
<category android:name="${applicationId}" />
</intent-filter>
</service>
</receiver>

<receiver
android:name=".receiver.JPushBroadcastReceiver"
Expand Down Expand Up @@ -107,9 +107,11 @@
</intent-filter>
</activity>
<provider
android:exported="false"
android:name="cn.jpush.android.service.InitProvider"
android:authorities="${applicationId}.jiguang.InitProvider"
android:name="cn.jpush.android.service.InitProvider"></provider>
android:exported="false"
android:readPermission="${applicationId}.permission.JPUSH_MESSAGE"
android:writePermission="${applicationId}.permission.JPUSH_MESSAGE" />
</application>

</manifest>
56 changes: 56 additions & 0 deletions android/src/main/java/cn/jiguang/plugins/push/JPushModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import cn.jiguang.plugins.push.receiver.JPushBroadcastReceiver;
import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.data.JPushCollectControl;
import cn.jpush.android.data.JPushLocalNotification;

public class JPushModule extends ReactContextBaseJavaModule {
Expand Down Expand Up @@ -127,6 +128,61 @@ public void setChannelAndSound(ReadableMap readableMap) {
}
}
@ReactMethod
public void setLinkMergeEnable(boolean enable) {
JPushInterface.setLinkMergeEnable(reactContext, enable);
}

@ReactMethod
public void setSmartPushEnable(boolean enable) {
JPushInterface.setSmartPushEnable(reactContext, enable);
}

@ReactMethod
public void setGeofenceEnable(boolean enable) {
JPushInterface.setGeofenceEnable(reactContext, enable);
}

@ReactMethod
public void setCollectControl(ReadableMap readableMap) {
if (readableMap == null) {
JLogger.w(JConstants.PARAMS_NULL);
return;
}
boolean hadValue = false;
JPushCollectControl.Builder builder = new JPushCollectControl.Builder();
if (readableMap.hasKey(JConstants.IMEI)) {
hadValue = true;
builder.imei(readableMap.getBoolean(JConstants.IMEI));
}
if (readableMap.hasKey(JConstants.IMSI)) {
hadValue = true;
builder.imsi(readableMap.getBoolean(JConstants.IMSI));
}
if (readableMap.hasKey(JConstants.MAC)) {
hadValue = true;
builder.mac(readableMap.getBoolean(JConstants.MAC));
}
if (readableMap.hasKey(JConstants.WIFI)) {
hadValue = true;
builder.wifi(readableMap.getBoolean(JConstants.WIFI));
}
if (readableMap.hasKey(JConstants.BSSID)) {
hadValue = true;
builder.bssid(readableMap.getBoolean(JConstants.BSSID));
}
if (readableMap.hasKey(JConstants.SSID)) {
hadValue = true;
builder.ssid(readableMap.getBoolean(JConstants.SSID));
}
if (readableMap.hasKey(JConstants.CELL)) {
hadValue = true;
builder.cell(readableMap.getBoolean(JConstants.CELL));
}
if (hadValue) {
JPushInterface.setCollectControl(reactContext, builder.build());
}
}
@ReactMethod
public void setBadgeNumber(ReadableMap readableMap) {
if (readableMap == null) {
JLogger.w(JConstants.PARAMS_NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,12 @@ public class JConstants {
public static final String PROPERTIES = "pros";
public static final String IN_APP_MESSAGE_CLICK = "inappClick";
public static final String IN_APP_MESSAGE_SHOW = "inappShow";

public static final String IMEI = "imei";
public static final String IMSI = "imsi";
public static final String MAC = "mac";
public static final String WIFI = "wifi";
public static final String BSSID = "bssid";
public static final String SSID = "ssid";
public static final String CELL = "cell";
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import cn.jpush.android.api.CustomMessage;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.service.JPushMessageService;
import cn.jpush.android.service.JPushMessageReceiver;

public class JPushModuleReceiver extends JPushMessageService {
public class JPushModuleReceiver extends JPushMessageReceiver {

@Override
public void onMessage(Context context, CustomMessage customMessage) {
Expand Down
529 changes: 529 additions & 0 deletions example/android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,4 +717,30 @@ export default class JPush {
}
}

static setLinkMergeEnable(enable) {
if (Platform.OS == "ios") {
}else if (Platform.OS == "android") {
JPushModule.setLinkMergeEnable(enable)
}
}
static setSmartPushEnable(enable) {
if (Platform.OS == "ios") {
}else if (Platform.OS == "android") {
JPushModule.setSmartPushEnable(enable)
}
}
static setGeofenceEnable(enable) {
if (Platform.OS == "ios") {
}else if (Platform.OS == "android") {
JPushModule.setGeofenceEnable(enable)
}
}

static setCollectControl(params) {
if (Platform.OS == "ios") {
}else if (Platform.OS == "android") {
JPushModule.setCollectControl(params)
}
}

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "index.d.ts",
"license": "ISC",
"author": "wicked.tc130",
"version": "3.0.9",
"version": "3.1.0",
"repository": {
"type": "git",
"url": "https://github.com/jpush/jpush-react-native"
Expand Down

0 comments on commit 9a32604

Please sign in to comment.