Skip to content

Commit

Permalink
fix android
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny.luo committed Dec 26, 2024
1 parent 16d388e commit 1578130
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onDownloadFailed(Throwable error) {
}
}

private void loadBundleLegacy() {
private void loadBundleLegacy(ReactApplicationContext mContext) {
final Activity currentActivity = mContext.getCurrentActivity();
if (currentActivity == null) {
return;
Expand All @@ -122,7 +122,7 @@ public void run() {
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options,Promise promise) {
final String hash = options.getString("hash");

if(hash==null || hash.isEmpty()){
if (hash == null || hash.isEmpty()) {
promise.reject("hash不能为空");
return;
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public void run() {
} catch (Throwable err) {
promise.reject(err);
Log.e("pushy", "switchVersion failed ", err);
loadBundleLegacy();
loadBundleLegacy(mContext);
}
}
});
Expand All @@ -182,7 +182,7 @@ public void run() {
}
}
});
}catch (Exception e){
} catch (Exception e){
promise.reject("执行报错:"+e.getMessage());
}
}
Expand All @@ -196,7 +196,7 @@ public void run() {
promise.resolve(true);
}
});
}catch (Exception e){
} catch (Exception e){
promise.reject("执行报错:"+e.getMessage());
}
}
Expand All @@ -210,7 +210,7 @@ public void run() {
promise.resolve(true);
}
});
}catch (Exception e){
} catch (Exception e){
promise.reject("执行报错:"+e.getMessage());
}

Expand Down Expand Up @@ -246,9 +246,9 @@ public void run() {

public static void getLocalHashInfo(UpdateContext updateContext, final String hash, Promise promise) {
String value = updateContext.getKv("hash_" + hash);
if(check(value)){
if (check(value)) {
promise.resolve(value);
}else {
} else {
promise.reject("校验报错:json字符串格式错误");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.LifecycleEventListener;
// import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
Expand All @@ -32,7 +32,7 @@
public class UpdateModule extends ReactContextBaseJavaModule {
UpdateContext updateContext;
public static ReactApplicationContext mContext;
private LifecycleEventListener mLifecycleEventListener = null;
// private LifecycleEventListener mLifecycleEventListener = null;

public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
super(reactContext);
Expand Down Expand Up @@ -171,7 +171,7 @@ public void onDownloadFailed(Throwable error) {
}

private void loadBundleLegacy() {
final Activity currentActivity = mContext.getCurrentActivity();
final Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.19.4",
"version": "10.19.5",
"description": "react-native hot update",
"main": "src/index",
"scripts": {
Expand Down

0 comments on commit 1578130

Please sign in to comment.