mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 12:11:39 +08:00
fix android
This commit is contained in:
@@ -101,25 +101,11 @@ public class UpdateModuleImpl {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
promise.reject("执行报错:"+e.getMessage());
|
promise.reject("执行报错:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadBundleLegacy(ReactApplicationContext mContext) {
|
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options, Promise promise) {
|
||||||
final Activity currentActivity = mContext.getCurrentActivity();
|
|
||||||
if (currentActivity == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentActivity.runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
currentActivity.recreate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options,Promise promise) {
|
|
||||||
final String hash = options.getString("hash");
|
final String hash = options.getString("hash");
|
||||||
|
|
||||||
if (hash == null || hash.isEmpty()) {
|
if (hash == null || hash.isEmpty()) {
|
||||||
@@ -156,7 +142,17 @@ public class UpdateModuleImpl {
|
|||||||
} catch (Throwable err) {
|
} catch (Throwable err) {
|
||||||
promise.reject(err);
|
promise.reject(err);
|
||||||
Log.e("pushy", "switchVersion failed ", err);
|
Log.e("pushy", "switchVersion failed ", err);
|
||||||
loadBundleLegacy(mContext);
|
final Activity currentActivity = mContext.getCurrentActivity();
|
||||||
|
if (currentActivity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentActivity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
currentActivity.recreate();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "10.19.5",
|
"version": "10.19.6",
|
||||||
"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