1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-12-21 21:23:57 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

fix build time check

This commit is contained in:
sunnylqm
2025-11-25 14:19:48 +08:00
parent f941b93cb3
commit 48b9f7ab07
3 changed files with 15 additions and 11 deletions

View File

@@ -44,13 +44,17 @@ public class UpdateContext {
String storedPackageVersion = this.sp.getString("packageVersion", null);
String storedBuildTime = this.sp.getString("buildTime", null);
// If stored versions don't exist, write current versions first
if (storedPackageVersion == null || storedBuildTime == null) {
SharedPreferences.Editor editor = sp.edit();
SharedPreferences.Editor editor = this.sp.edit();
if (storedPackageVersion == null) {
editor.putString("packageVersion", packageVersion);
editor.putString("buildTime", buildTime);
editor.apply();
storedPackageVersion = packageVersion;
}
if (storedBuildTime == null) {
editor.putString("buildTime", buildTime);
editor.apply();
storedBuildTime = buildTime;
}
@@ -65,10 +69,7 @@ public class UpdateContext {
editor.clear();
editor.putString("packageVersion", packageVersion);
editor.putString("buildTime", buildTime);
// Use commit() instead of apply() to ensure synchronous write completion
// This prevents race condition where getBundleUrl() might read null values
// if called before apply() completes
editor.commit();
editor.apply();
}
}