mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-17 21:56:11 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7023ff57ca | ||
![]() |
17e21d79cf | ||
![]() |
1cab582bd0 | ||
![]() |
7da5a165fd | ||
![]() |
d5194a1ad1 | ||
![]() |
ebc9b97e70 |
@@ -12,7 +12,7 @@
|
|||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-safe-area-context": "^5.4.1",
|
"react-native-safe-area-context": "^5.4.1",
|
||||||
"react-native-svg": "^15.12.0",
|
"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",
|
"react-native-vector-icons": "^10.2.0",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"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-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=="],
|
"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=="],
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-safe-area-context": "^5.4.1",
|
"react-native-safe-area-context": "^5.4.1",
|
||||||
"react-native-svg": "^15.12.0",
|
"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"
|
"react-native-vector-icons": "^10.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
34
android/proguard.pro
vendored
34
android/proguard.pro
vendored
@@ -1,3 +1,37 @@
|
|||||||
|
# Keep our update module classes
|
||||||
-keepnames class cn.reactnative.modules.update.DownloadTask { *; }
|
-keepnames class cn.reactnative.modules.update.DownloadTask { *; }
|
||||||
-keepnames class cn.reactnative.modules.update.UpdateModuleImpl { *; }
|
-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.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);
|
||||||
|
}
|
@@ -169,6 +169,7 @@ public class UpdateContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void markSuccess() {
|
public void markSuccess() {
|
||||||
|
if (!BuildConfig.DEBUG) {
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
SharedPreferences.Editor editor = sp.edit();
|
||||||
editor.putBoolean("firstTimeOk", true);
|
editor.putBoolean("firstTimeOk", true);
|
||||||
String lastVersion = sp.getString("lastVersion", null);
|
String lastVersion = sp.getString("lastVersion", null);
|
||||||
@@ -181,6 +182,7 @@ public class UpdateContext {
|
|||||||
|
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearFirstTime() {
|
public void clearFirstTime() {
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
SharedPreferences.Editor editor = sp.edit();
|
||||||
|
@@ -147,6 +147,10 @@ public class UpdateModuleImpl {
|
|||||||
reactHostField.setAccessible(true);
|
reactHostField.setAccessible(true);
|
||||||
Object reactHost = reactHostField.get(reactDelegate);
|
Object reactHost = reactHostField.get(reactDelegate);
|
||||||
|
|
||||||
|
Field devSupport = reactHost.getClass().getDeclaredField("mUseDevSupport");
|
||||||
|
devSupport.setAccessible(true);
|
||||||
|
devSupport.set(reactHost, false);
|
||||||
|
|
||||||
// Access the mReactHostDelegate field
|
// Access the mReactHostDelegate field
|
||||||
Field reactHostDelegateField = reactHost.getClass().getDeclaredField("mReactHostDelegate");
|
Field reactHostDelegateField = reactHost.getClass().getDeclaredField("mReactHostDelegate");
|
||||||
reactHostDelegateField.setAccessible(true);
|
reactHostDelegateField.setAccessible(true);
|
||||||
|
@@ -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,13 +41,23 @@ 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) {
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
updateContext.clearFirstTime();
|
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) {
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
updateContext.clearRollbackMark();
|
updateContext.clearRollbackMark();
|
||||||
}
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
constants.put("uuid", updateContext.getKv("uuid"));
|
constants.put("uuid", updateContext.getKv("uuid"));
|
||||||
return constants;
|
return constants;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@@ -73,7 +73,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPpk(
|
|||||||
const jsi::Value* args,
|
const jsi::Value* args,
|
||||||
size_t count)
|
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(
|
static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage(
|
||||||
@@ -82,7 +82,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage(
|
|||||||
const jsi::Value* args,
|
const jsi::Value* args,
|
||||||
size_t count)
|
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(
|
static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate(
|
||||||
@@ -91,7 +91,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate(
|
|||||||
const jsi::Value* args,
|
const jsi::Value* args,
|
||||||
size_t count)
|
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(
|
static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk(
|
||||||
@@ -100,7 +100,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk(
|
|||||||
const jsi::Value* args,
|
const jsi::Value* args,
|
||||||
size_t count)
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ export class PushyFileJSBundleProvider extends JSBundleProvider {
|
|||||||
this.updateContext = new UpdateContext(context);
|
this.updateContext = new UpdateContext(context);
|
||||||
}
|
}
|
||||||
getURL(): string {
|
getURL(): string {
|
||||||
return this.updateContext.getBundleUrl();
|
return this.updateContext.getBundleUrl().substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getBundle(): Promise<ArrayBuffer> {
|
async getBundle(): Promise<ArrayBuffer> {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "10.29.0",
|
"version": "10.29.4",
|
||||||
"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