react-native-update 10.19.4 → 10.19.6
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.
|
@@ -101,28 +101,14 @@ public class UpdateModuleImpl {
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
}catch (Exception e){
|
|
104
|
-
promise.reject("执行报错:"+e.getMessage());
|
|
104
|
+
promise.reject("执行报错:" + e.getMessage());
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
final Activity currentActivity = mContext.getCurrentActivity();
|
|
110
|
-
if (currentActivity == null) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
currentActivity.runOnUiThread(new Runnable() {
|
|
115
|
-
@Override
|
|
116
|
-
public void run() {
|
|
117
|
-
currentActivity.recreate();
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options,Promise promise) {
|
|
108
|
+
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options, Promise promise) {
|
|
123
109
|
final String hash = options.getString("hash");
|
|
124
110
|
|
|
125
|
-
if(hash==null || hash.isEmpty()){
|
|
111
|
+
if (hash == null || hash.isEmpty()) {
|
|
126
112
|
promise.reject("hash不能为空");
|
|
127
113
|
return;
|
|
128
114
|
}
|
|
@@ -156,7 +142,17 @@ public class UpdateModuleImpl {
|
|
|
156
142
|
} catch (Throwable err) {
|
|
157
143
|
promise.reject(err);
|
|
158
144
|
Log.e("pushy", "switchVersion failed ", err);
|
|
159
|
-
|
|
145
|
+
final Activity currentActivity = mContext.getCurrentActivity();
|
|
146
|
+
if (currentActivity == null) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
currentActivity.runOnUiThread(new Runnable() {
|
|
151
|
+
@Override
|
|
152
|
+
public void run() {
|
|
153
|
+
currentActivity.recreate();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
158
|
});
|
|
@@ -182,7 +178,7 @@ public class UpdateModuleImpl {
|
|
|
182
178
|
}
|
|
183
179
|
}
|
|
184
180
|
});
|
|
185
|
-
}catch (Exception e){
|
|
181
|
+
} catch (Exception e){
|
|
186
182
|
promise.reject("执行报错:"+e.getMessage());
|
|
187
183
|
}
|
|
188
184
|
}
|
|
@@ -196,7 +192,7 @@ public class UpdateModuleImpl {
|
|
|
196
192
|
promise.resolve(true);
|
|
197
193
|
}
|
|
198
194
|
});
|
|
199
|
-
}catch (Exception e){
|
|
195
|
+
} catch (Exception e){
|
|
200
196
|
promise.reject("执行报错:"+e.getMessage());
|
|
201
197
|
}
|
|
202
198
|
}
|
|
@@ -210,7 +206,7 @@ public class UpdateModuleImpl {
|
|
|
210
206
|
promise.resolve(true);
|
|
211
207
|
}
|
|
212
208
|
});
|
|
213
|
-
}catch (Exception e){
|
|
209
|
+
} catch (Exception e){
|
|
214
210
|
promise.reject("执行报错:"+e.getMessage());
|
|
215
211
|
}
|
|
216
212
|
|
|
@@ -246,9 +242,9 @@ public class UpdateModuleImpl {
|
|
|
246
242
|
|
|
247
243
|
public static void getLocalHashInfo(UpdateContext updateContext, final String hash, Promise promise) {
|
|
248
244
|
String value = updateContext.getKv("hash_" + hash);
|
|
249
|
-
if(check(value)){
|
|
245
|
+
if (check(value)) {
|
|
250
246
|
promise.resolve(value);
|
|
251
|
-
}else {
|
|
247
|
+
} else {
|
|
252
248
|
promise.reject("校验报错:json字符串格式错误");
|
|
253
249
|
}
|
|
254
250
|
|
|
@@ -9,7 +9,7 @@ import android.util.Log;
|
|
|
9
9
|
|
|
10
10
|
import com.facebook.react.ReactApplication;
|
|
11
11
|
import com.facebook.react.ReactInstanceManager;
|
|
12
|
-
import com.facebook.react.bridge.LifecycleEventListener;
|
|
12
|
+
// import com.facebook.react.bridge.LifecycleEventListener;
|
|
13
13
|
import com.facebook.react.bridge.Promise;
|
|
14
14
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
15
15
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -32,7 +32,7 @@ import static androidx.core.content.FileProvider.getUriForFile;
|
|
|
32
32
|
public class UpdateModule extends ReactContextBaseJavaModule {
|
|
33
33
|
UpdateContext updateContext;
|
|
34
34
|
public static ReactApplicationContext mContext;
|
|
35
|
-
private LifecycleEventListener mLifecycleEventListener = null;
|
|
35
|
+
// private LifecycleEventListener mLifecycleEventListener = null;
|
|
36
36
|
|
|
37
37
|
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
|
|
38
38
|
super(reactContext);
|
|
@@ -171,7 +171,7 @@ public class UpdateModule extends ReactContextBaseJavaModule {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
private void loadBundleLegacy() {
|
|
174
|
-
final Activity currentActivity =
|
|
174
|
+
final Activity currentActivity = getCurrentActivity();
|
|
175
175
|
if (currentActivity == null) {
|
|
176
176
|
return;
|
|
177
177
|
}
|