Skip to content

Commit 1578130

Browse files
author
sunny.luo
committed
fix android
1 parent 16d388e commit 1578130

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void onDownloadFailed(Throwable error) {
105105
}
106106
}
107107

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

125-
if(hash==null || hash.isEmpty()){
125+
if (hash == null || hash.isEmpty()) {
126126
promise.reject("hash不能为空");
127127
return;
128128
}
@@ -156,7 +156,7 @@ public void run() {
156156
} catch (Throwable err) {
157157
promise.reject(err);
158158
Log.e("pushy", "switchVersion failed ", err);
159-
loadBundleLegacy();
159+
loadBundleLegacy(mContext);
160160
}
161161
}
162162
});
@@ -182,7 +182,7 @@ public void run() {
182182
}
183183
}
184184
});
185-
}catch (Exception e){
185+
} catch (Exception e){
186186
promise.reject("执行报错:"+e.getMessage());
187187
}
188188
}
@@ -196,7 +196,7 @@ public void run() {
196196
promise.resolve(true);
197197
}
198198
});
199-
}catch (Exception e){
199+
} catch (Exception e){
200200
promise.reject("执行报错:"+e.getMessage());
201201
}
202202
}
@@ -210,7 +210,7 @@ public void run() {
210210
promise.resolve(true);
211211
}
212212
});
213-
}catch (Exception e){
213+
} catch (Exception e){
214214
promise.reject("执行报错:"+e.getMessage());
215215
}
216216

@@ -246,9 +246,9 @@ public void run() {
246246

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

android/src/oldarch/cn/reactnative/modules/update/UpdateModule.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import com.facebook.react.ReactApplication;
1111
import com.facebook.react.ReactInstanceManager;
12-
import com.facebook.react.bridge.LifecycleEventListener;
12+
// import com.facebook.react.bridge.LifecycleEventListener;
1313
import com.facebook.react.bridge.Promise;
1414
import com.facebook.react.bridge.ReactApplicationContext;
1515
import com.facebook.react.bridge.ReactContext;
@@ -32,7 +32,7 @@
3232
public class UpdateModule extends ReactContextBaseJavaModule {
3333
UpdateContext updateContext;
3434
public static ReactApplicationContext mContext;
35-
private LifecycleEventListener mLifecycleEventListener = null;
35+
// private LifecycleEventListener mLifecycleEventListener = null;
3636

3737
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
3838
super(reactContext);
@@ -171,7 +171,7 @@ public void onDownloadFailed(Throwable error) {
171171
}
172172

173173
private void loadBundleLegacy() {
174-
final Activity currentActivity = mContext.getCurrentActivity();
174+
final Activity currentActivity = getCurrentActivity();
175175
if (currentActivity == null) {
176176
return;
177177
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update",
3-
"version": "10.19.4",
3+
"version": "10.19.5",
44
"description": "react-native hot update",
55
"main": "src/index",
66
"scripts": {

0 commit comments

Comments
 (0)