Skip to content

Commit 0a3f279

Browse files
author
lcTerry
committed
更新版JPush 540 版本号3.1.0
1 parent ec29ce7 commit 0a3f279

File tree

10 files changed

+631
-9
lines changed

10 files changed

+631
-9
lines changed
-361 KB
Binary file not shown.
385 KB
Binary file not shown.

android/src/main/AndroidManifest.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@
6363
<category android:name="${applicationId}" />
6464
</intent-filter>
6565
</activity>
66-
<service
66+
<receiver
6767
android:name=".receiver.JPushModuleReceiver"
6868
android:enabled="true"
6969
android:exported="false">
7070
<intent-filter>
71-
<action android:name="cn.jpush.android.intent.SERVICE_MESSAGE" />
71+
<action android:name="cn.jpush.android.intent.RECEIVER_MESSAGE" />
7272
<category android:name="${applicationId}" />
7373
</intent-filter>
74-
</service>
74+
</receiver>
7575

7676
<receiver
7777
android:name=".receiver.JPushBroadcastReceiver"
@@ -107,9 +107,11 @@
107107
</intent-filter>
108108
</activity>
109109
<provider
110-
android:exported="false"
110+
android:name="cn.jpush.android.service.InitProvider"
111111
android:authorities="${applicationId}.jiguang.InitProvider"
112-
android:name="cn.jpush.android.service.InitProvider"></provider>
112+
android:exported="false"
113+
android:readPermission="${applicationId}.permission.JPUSH_MESSAGE"
114+
android:writePermission="${applicationId}.permission.JPUSH_MESSAGE" />
113115
</application>
114116

115117
</manifest>

android/src/main/java/cn/jiguang/plugins/push/JPushModule.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import cn.jiguang.plugins.push.receiver.JPushBroadcastReceiver;
3434
import cn.jpush.android.api.BasicPushNotificationBuilder;
3535
import cn.jpush.android.api.JPushInterface;
36+
import cn.jpush.android.data.JPushCollectControl;
3637
import cn.jpush.android.data.JPushLocalNotification;
3738

3839
public class JPushModule extends ReactContextBaseJavaModule {
@@ -127,6 +128,61 @@ public void setChannelAndSound(ReadableMap readableMap) {
127128
}
128129
}
129130
@ReactMethod
131+
public void setLinkMergeEnable(boolean enable) {
132+
JPushInterface.setLinkMergeEnable(reactContext, enable);
133+
}
134+
135+
@ReactMethod
136+
public void setSmartPushEnable(boolean enable) {
137+
JPushInterface.setSmartPushEnable(reactContext, enable);
138+
}
139+
140+
@ReactMethod
141+
public void setGeofenceEnable(boolean enable) {
142+
JPushInterface.setGeofenceEnable(reactContext, enable);
143+
}
144+
145+
@ReactMethod
146+
public void setCollectControl(ReadableMap readableMap) {
147+
if (readableMap == null) {
148+
JLogger.w(JConstants.PARAMS_NULL);
149+
return;
150+
}
151+
boolean hadValue = false;
152+
JPushCollectControl.Builder builder = new JPushCollectControl.Builder();
153+
if (readableMap.hasKey(JConstants.IMEI)) {
154+
hadValue = true;
155+
builder.imei(readableMap.getBoolean(JConstants.IMEI));
156+
}
157+
if (readableMap.hasKey(JConstants.IMSI)) {
158+
hadValue = true;
159+
builder.imsi(readableMap.getBoolean(JConstants.IMSI));
160+
}
161+
if (readableMap.hasKey(JConstants.MAC)) {
162+
hadValue = true;
163+
builder.mac(readableMap.getBoolean(JConstants.MAC));
164+
}
165+
if (readableMap.hasKey(JConstants.WIFI)) {
166+
hadValue = true;
167+
builder.wifi(readableMap.getBoolean(JConstants.WIFI));
168+
}
169+
if (readableMap.hasKey(JConstants.BSSID)) {
170+
hadValue = true;
171+
builder.bssid(readableMap.getBoolean(JConstants.BSSID));
172+
}
173+
if (readableMap.hasKey(JConstants.SSID)) {
174+
hadValue = true;
175+
builder.ssid(readableMap.getBoolean(JConstants.SSID));
176+
}
177+
if (readableMap.hasKey(JConstants.CELL)) {
178+
hadValue = true;
179+
builder.cell(readableMap.getBoolean(JConstants.CELL));
180+
}
181+
if (hadValue) {
182+
JPushInterface.setCollectControl(reactContext, builder.build());
183+
}
184+
}
185+
@ReactMethod
130186
public void setBadgeNumber(ReadableMap readableMap) {
131187
if (readableMap == null) {
132188
JLogger.w(JConstants.PARAMS_NULL);

android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,12 @@ public class JConstants {
7171
public static final String PROPERTIES = "pros";
7272
public static final String IN_APP_MESSAGE_CLICK = "inappClick";
7373
public static final String IN_APP_MESSAGE_SHOW = "inappShow";
74+
75+
public static final String IMEI = "imei";
76+
public static final String IMSI = "imsi";
77+
public static final String MAC = "mac";
78+
public static final String WIFI = "wifi";
79+
public static final String BSSID = "bssid";
80+
public static final String SSID = "ssid";
81+
public static final String CELL = "cell";
7482
}

android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import cn.jpush.android.api.CustomMessage;
1414
import cn.jpush.android.api.JPushMessage;
1515
import cn.jpush.android.api.NotificationMessage;
16-
import cn.jpush.android.service.JPushMessageService;
16+
import cn.jpush.android.service.JPushMessageReceiver;
1717

18-
public class JPushModuleReceiver extends JPushMessageService {
18+
public class JPushModuleReceiver extends JPushMessageReceiver {
1919

2020
@Override
2121
public void onMessage(Context context, CustomMessage customMessage) {

example/android/app/src/main/assets/index.android.bundle

Lines changed: 529 additions & 0 deletions
Large diffs are not rendered by default.

example/android/app/src/main/java/com/example/MainApplication.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ class MainApplication : Application(), ReactApplication {
3636
override fun onCreate() {
3737
super.onCreate()
3838
SoLoader.init(this, false)
39+
3940
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
4041
// If you opted-in for the New Architecture, we load the native entry point for this app.
4142
load()
4243
}
4344
//调用此方法:点击通知让应用从后台切到前台
4445
//调用此方法:点击通知让应用从后台切到前台
4546
JPushModule.registerActivityLifecycle(this)
46-
JPushModule.init(this)
47+
JPushModule.init()
4748
}
4849
}

index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,4 +717,30 @@ export default class JPush {
717717
}
718718
}
719719

720+
static setLinkMergeEnable(enable) {
721+
if (Platform.OS == "ios") {
722+
}else if (Platform.OS == "android") {
723+
JPushModule.setLinkMergeEnable(enable)
724+
}
725+
}
726+
static setSmartPushEnable(enable) {
727+
if (Platform.OS == "ios") {
728+
}else if (Platform.OS == "android") {
729+
JPushModule.setSmartPushEnable(enable)
730+
}
731+
}
732+
static setGeofenceEnable(enable) {
733+
if (Platform.OS == "ios") {
734+
}else if (Platform.OS == "android") {
735+
JPushModule.setGeofenceEnable(enable)
736+
}
737+
}
738+
739+
static setCollectControl(params) {
740+
if (Platform.OS == "ios") {
741+
}else if (Platform.OS == "android") {
742+
JPushModule.setCollectControl(params)
743+
}
744+
}
745+
720746
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "index.d.ts",
77
"license": "ISC",
88
"author": "wicked.tc130",
9-
"version": "3.0.9",
9+
"version": "3.1.0",
1010
"repository": {
1111
"type": "git",
1212
"url": "https://github.com/jpush/jpush-react-native"

0 commit comments

Comments
 (0)