mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 12:51:44 +08:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7023ff57ca | ||
![]() |
17e21d79cf | ||
![]() |
1cab582bd0 | ||
![]() |
7da5a165fd | ||
![]() |
d5194a1ad1 |
@@ -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;
|
||||||
|
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.1",
|
"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