Skip to content

Commit d5194a1

Browse files
committed
bump version to 10.29.2 and add delayed execution for clearing first-time and rollback marks in UpdateModule
1 parent ebc9b97 commit d5194a1

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

android/src/newarch/cn/reactnative/modules/update/UpdateModule.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.content.Intent;
55
import android.net.Uri;
66
import android.os.Build;
7+
import android.os.Handler;
8+
import android.os.Looper;
79
import com.facebook.react.bridge.Promise;
810
import com.facebook.react.bridge.ReactApplicationContext;
911
import com.facebook.react.bridge.ReactContext;
@@ -17,6 +19,7 @@
1719
public class UpdateModule extends NativePushySpec {
1820
UpdateContext updateContext;
1921
public static ReactApplicationContext mContext;
22+
private final Handler handler = new Handler(Looper.getMainLooper());
2023
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
2124
super(reactContext);
2225
this.updateContext = updateContext;
@@ -38,12 +41,22 @@ protected Map<String, Object> getTypedExportedConstants() {
3841
boolean isFirstTime = updateContext.isFirstTime();
3942
constants.put("isFirstTime", isFirstTime);
4043
if (isFirstTime) {
41-
updateContext.clearFirstTime();
44+
handler.postDelayed(new Runnable() {
45+
@Override
46+
public void run() {
47+
updateContext.clearFirstTime();
48+
}
49+
}, 2000);
4250
}
4351
String rolledBackVersion = updateContext.rolledBackVersion();
4452
constants.put("rolledBackVersion", rolledBackVersion);
4553
if (rolledBackVersion != null) {
46-
updateContext.clearRollbackMark();
54+
handler.postDelayed(new Runnable() {
55+
@Override
56+
public void run() {
57+
updateContext.clearRollbackMark();
58+
}
59+
}, 2000);
4760
}
4861
constants.put("uuid", updateContext.getKv("uuid"));
4962
return constants;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update",
3-
"version": "10.29.1",
3+
"version": "10.29.2",
44
"description": "react-native hot update",
55
"main": "src/index",
66
"scripts": {

0 commit comments

Comments
 (0)