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

Compare commits

...

4 Commits

Author SHA1 Message Date
Sunny Luo
1cab582bd0 Update package.json 2025-06-17 22:29:46 +08:00
波仔糕
7da5a165fd modify harmony download logic to async (#502) 2025-06-17 22:29:28 +08:00
sunnylqm
d5194a1ad1 bump version to 10.29.2 and add delayed execution for clearing first-time and rollback marks in UpdateModule 2025-06-16 12:00:19 +08:00
sunnylqm
ebc9b97e70 fix proguard 2025-06-14 23:34:54 +08:00
8 changed files with 75 additions and 22 deletions

View File

@@ -12,7 +12,7 @@
"react-native-paper": "^5.14.5",
"react-native-safe-area-context": "^5.4.1",
"react-native-svg": "^15.12.0",
"react-native-update": "^10.28.11",
"react-native-update": "^10.29.0",
"react-native-vector-icons": "^10.2.0",
},
"devDependencies": {
@@ -1420,7 +1420,7 @@
"react-native-svg": ["react-native-svg@15.12.0", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-iE25PxIJ6V0C6krReLquVw6R0QTsRTmEQc4K2Co3P6zsimU/jltcDBKYDy1h/5j9S/fqmMeXnpM+9LEWKJKI6A=="],
"react-native-update": ["react-native-update@10.28.11", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-afoaUsUFwIKj4lETWm5ilfMcWkbcTId0HJ9PaL9G0sPUBNokT0TdLPPezVglYqVWFTe8I+KAS0yD7hLG9F9StA=="],
"react-native-update": ["react-native-update@10.29.0", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-TFGwJxI62OHPJimxMnI8PDvUBhZio1alsgIvXHYh1oYAZYYejkUvwl+Ojdbm58IKoZzxAaT7RvD1qGdvlg/oKg=="],
"react-native-url-polyfill": ["react-native-url-polyfill@2.0.0", "", { "dependencies": { "whatwg-url-without-unicode": "8.0.0-3" }, "peerDependencies": { "react-native": "*" } }, "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA=="],

View File

@@ -22,7 +22,7 @@
"react-native-paper": "^5.14.5",
"react-native-safe-area-context": "^5.4.1",
"react-native-svg": "^15.12.0",
"react-native-update": "^10.28.11",
"react-native-update": "^10.29.0",
"react-native-vector-icons": "^10.2.0"
},
"devDependencies": {

34
android/proguard.pro vendored
View File

@@ -1,3 +1,37 @@
# Keep our update module classes
-keepnames class cn.reactnative.modules.update.DownloadTask { *; }
-keepnames class cn.reactnative.modules.update.UpdateModuleImpl { *; }
-keepnames class cn.reactnative.modules.update.** { *; }
# Keep React Native classes
-keepnames class com.facebook.react.ReactInstanceManager { *; }
-keepnames class com.facebook.react.** { *; }
-keepnames class com.facebook.react.bridge.** { *; }
-keepnames class com.facebook.react.devsupport.** { *; }
# Keep fields used in reflection
-keepclassmembers class com.facebook.react.ReactInstanceManager {
private JSBundleLoader mBundleLoader;
private String mJSBundleFile;
}
-keepclassmembers class com.facebook.react.ReactDelegate {
private ReactHost mReactHost;
}
-keepclassmembers class com.facebook.react.ReactHost {
private boolean mUseDevSupport;
private ReactHostDelegate mReactHostDelegate;
}
# Keep Expo related classes
-keepnames class expo.modules.ExpoReactHostFactory$ExpoReactHostDelegate { *; }
# Keep methods used in reflection
-keepclassmembers class com.facebook.react.ReactActivity {
public ReactDelegate getReactDelegate();
}
-keepclassmembers class com.facebook.react.ReactHost {
public void reload(java.lang.String);
}

View File

@@ -169,6 +169,7 @@ public class UpdateContext {
}
public void markSuccess() {
if (!BuildConfig.DEBUG) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("firstTimeOk", true);
String lastVersion = sp.getString("lastVersion", null);
@@ -181,6 +182,7 @@ public class UpdateContext {
this.cleanUp();
}
}
public void clearFirstTime() {
SharedPreferences.Editor editor = sp.edit();

View File

@@ -147,6 +147,10 @@ public class UpdateModuleImpl {
reactHostField.setAccessible(true);
Object reactHost = reactHostField.get(reactDelegate);
Field devSupport = reactHost.getClass().getDeclaredField("mUseDevSupport");
devSupport.setAccessible(true);
devSupport.set(reactHost, false);
// Access the mReactHostDelegate field
Field reactHostDelegateField = reactHost.getClass().getDeclaredField("mReactHostDelegate");
reactHostDelegateField.setAccessible(true);

View File

@@ -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,13 +41,23 @@ public class UpdateModule extends NativePushySpec {
boolean isFirstTime = updateContext.isFirstTime();
constants.put("isFirstTime", isFirstTime);
if (isFirstTime) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
updateContext.clearFirstTime();
}
}, 2000);
}
String rolledBackVersion = updateContext.rolledBackVersion();
constants.put("rolledBackVersion", rolledBackVersion);
if (rolledBackVersion != null) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
updateContext.clearRollbackMark();
}
}, 2000);
}
constants.put("uuid", updateContext.getKv("uuid"));
return constants;
}

View File

@@ -73,7 +73,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPpk(
const jsi::Value* args,
size_t count)
{
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadPatchFromPpk", args, count));
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadPatchFromPpk", args, count));
}
static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage(
@@ -82,7 +82,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage(
const jsi::Value* args,
size_t count)
{
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadPatchFromPackage", args, count));
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadPatchFromPackage", args, count));
}
static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate(
@@ -91,7 +91,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate(
const jsi::Value* args,
size_t count)
{
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadFullUpdate", args, count));
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadFullUpdate", args, count));
}
static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk(
@@ -100,7 +100,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk(
const jsi::Value* args,
size_t count)
{
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadAndInstallApk", args, count));
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadAndInstallApk", args, count));
}

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.29.0",
"version": "10.29.3",
"description": "react-native hot update",
"main": "src/index",
"scripts": {