react-native-update 10.19.0 → 10.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  package cn.reactnative.modules.update;
2
2
 
3
3
  import android.app.Activity;
4
- import android.app.Application;
4
+ import android.content.Context;
5
5
  import android.util.Log;
6
6
  import com.facebook.react.ReactApplication;
7
7
  import com.facebook.react.ReactInstanceManager;
@@ -117,7 +117,7 @@ public class UpdateModuleImpl {
117
117
  public void run() {
118
118
  try {
119
119
  updateContext.switchVersion(hash);
120
- final Application application = (Application) getReactApplicationContext().getApplicationContext();
120
+ final Context application = mContext.getApplicationContext();
121
121
  ReactInstanceManager instanceManager = updateContext.getCustomReactInstanceManager();
122
122
 
123
123
  if (instanceManager == null) {
@@ -141,6 +141,7 @@ public class UpdateModuleImpl {
141
141
  promise.resolve(true);
142
142
  } catch (Throwable err) {
143
143
  promise.reject("pushy:"+err.getMessage());
144
+ final Activity activity = mContext.getCurrentActivity();
144
145
  if (activity != null) {
145
146
  activity.recreate();
146
147
  }
@@ -1,7 +1,7 @@
1
1
  package cn.reactnative.modules.update;
2
2
 
3
3
  import android.app.Activity;
4
- import android.app.Application;
4
+ import android.content.Context;
5
5
  import android.content.Intent;
6
6
  import android.net.Uri;
7
7
  import android.os.Build;
@@ -176,7 +176,7 @@ public class UpdateModule extends ReactContextBaseJavaModule {
176
176
  public void run() {
177
177
  try {
178
178
  updateContext.switchVersion(hash);
179
- final Application application = (Application) getReactApplicationContext().getApplicationContext();
179
+ final Context application = getReactApplicationContext().getApplicationContext();
180
180
  ReactInstanceManager instanceManager = updateContext.getCustomReactInstanceManager();
181
181
 
182
182
  if (instanceManager == null) {
@@ -199,6 +199,7 @@ public class UpdateModule extends ReactContextBaseJavaModule {
199
199
  instanceManager.recreateReactContextInBackground();
200
200
  promise.resolve(null);
201
201
  } catch (Throwable err) {
202
+ final Activity activity = getCurrentActivity();
202
203
  if (activity != null) {
203
204
  activity.recreate();
204
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.19.0",
3
+ "version": "10.19.1",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {