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.content.Intent; | ||||||
| import android.net.Uri; | import android.net.Uri; | ||||||
| import android.os.Build; | import android.os.Build; | ||||||
|  | import android.os.Handler; | ||||||
|  | import android.os.Looper; | ||||||
| import com.facebook.react.bridge.Promise; | import com.facebook.react.bridge.Promise; | ||||||
| import com.facebook.react.bridge.ReactApplicationContext; | import com.facebook.react.bridge.ReactApplicationContext; | ||||||
| import com.facebook.react.bridge.ReactContext; | import com.facebook.react.bridge.ReactContext; | ||||||
| @@ -17,6 +19,7 @@ import java.util.Map; | |||||||
| public class UpdateModule extends NativePushySpec { | public class UpdateModule extends NativePushySpec { | ||||||
|     UpdateContext updateContext; |     UpdateContext updateContext; | ||||||
|     public static ReactApplicationContext mContext; |     public static ReactApplicationContext mContext; | ||||||
|  |     private final Handler handler = new Handler(Looper.getMainLooper()); | ||||||
|     public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) { |     public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) { | ||||||
|         super(reactContext); |         super(reactContext); | ||||||
|         this.updateContext = updateContext; |         this.updateContext = updateContext; | ||||||
| @@ -38,12 +41,22 @@ public class UpdateModule extends NativePushySpec { | |||||||
|         boolean isFirstTime = updateContext.isFirstTime(); |         boolean isFirstTime = updateContext.isFirstTime(); | ||||||
|         constants.put("isFirstTime", isFirstTime); |         constants.put("isFirstTime", isFirstTime); | ||||||
|         if (isFirstTime) { |         if (isFirstTime) { | ||||||
|             updateContext.clearFirstTime(); |             handler.postDelayed(new Runnable() { | ||||||
|  |                 @Override | ||||||
|  |                 public void run() { | ||||||
|  |                     updateContext.clearFirstTime(); | ||||||
|  |                 } | ||||||
|  |             }, 2000); | ||||||
|         } |         } | ||||||
|         String rolledBackVersion = updateContext.rolledBackVersion(); |         String rolledBackVersion = updateContext.rolledBackVersion(); | ||||||
|         constants.put("rolledBackVersion", rolledBackVersion); |         constants.put("rolledBackVersion", rolledBackVersion); | ||||||
|         if (rolledBackVersion != null) { |         if (rolledBackVersion != null) { | ||||||
|             updateContext.clearRollbackMark(); |             handler.postDelayed(new Runnable() { | ||||||
|  |                 @Override | ||||||
|  |                 public void run() { | ||||||
|  |                     updateContext.clearRollbackMark(); | ||||||
|  |                 } | ||||||
|  |             }, 2000); | ||||||
|         } |         } | ||||||
|         constants.put("uuid", updateContext.getKv("uuid")); |         constants.put("uuid", updateContext.getKv("uuid")); | ||||||
|         return constants; |         return constants; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "react-native-update", |   "name": "react-native-update", | ||||||
|   "version": "10.29.1", |   "version": "10.29.2", | ||||||
|   "description": "react-native hot update", |   "description": "react-native hot update", | ||||||
|   "main": "src/index", |   "main": "src/index", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm