mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	bump version to 10.29.2 and add delayed execution for clearing first-time and rollback marks in UpdateModule
This commit is contained in:
		| @@ -4,6 +4,8 @@ import static androidx.core.content.FileProvider.getUriForFile; | ||||
| import android.content.Intent; | ||||
| import android.net.Uri; | ||||
| import android.os.Build; | ||||
| import android.os.Handler; | ||||
| import android.os.Looper; | ||||
| import com.facebook.react.bridge.Promise; | ||||
| import com.facebook.react.bridge.ReactApplicationContext; | ||||
| import com.facebook.react.bridge.ReactContext; | ||||
| @@ -17,6 +19,7 @@ import java.util.Map; | ||||
| public class UpdateModule extends NativePushySpec { | ||||
|     UpdateContext updateContext; | ||||
|     public static ReactApplicationContext mContext; | ||||
|     private final Handler handler = new Handler(Looper.getMainLooper()); | ||||
|     public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) { | ||||
|         super(reactContext); | ||||
|         this.updateContext = updateContext; | ||||
| @@ -38,12 +41,22 @@ public class UpdateModule extends NativePushySpec { | ||||
|         boolean isFirstTime = updateContext.isFirstTime(); | ||||
|         constants.put("isFirstTime", isFirstTime); | ||||
|         if (isFirstTime) { | ||||
|             updateContext.clearFirstTime(); | ||||
|             handler.postDelayed(new Runnable() { | ||||
|                 @Override | ||||
|                 public void run() { | ||||
|                     updateContext.clearFirstTime(); | ||||
|                 } | ||||
|             }, 2000); | ||||
|         } | ||||
|         String rolledBackVersion = updateContext.rolledBackVersion(); | ||||
|         constants.put("rolledBackVersion", rolledBackVersion); | ||||
|         if (rolledBackVersion != null) { | ||||
|             updateContext.clearRollbackMark(); | ||||
|             handler.postDelayed(new Runnable() { | ||||
|                 @Override | ||||
|                 public void run() { | ||||
|                     updateContext.clearRollbackMark(); | ||||
|                 } | ||||
|             }, 2000); | ||||
|         } | ||||
|         constants.put("uuid", updateContext.getKv("uuid")); | ||||
|         return constants; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "react-native-update", | ||||
|   "version": "10.29.1", | ||||
|   "version": "10.29.2", | ||||
|   "description": "react-native hot update", | ||||
|   "main": "src/index", | ||||
|   "scripts": { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm