@@ -80,6 +80,8 @@ private boolean isReactApplication(Context context) {
80
80
}
81
81
82
82
private void loadBundleLegacy (final Activity currentActivity ) {
83
+ CodePushUtils .log ("Legacy restart logic being used" );
84
+
83
85
mCodePush .invalidateCurrentInstance ();
84
86
85
87
currentActivity .runOnUiThread (new Runnable () {
@@ -240,19 +242,23 @@ public void dispatchDownloadProgressEvent() {
240
242
241
243
@ ReactMethod
242
244
public void getConfiguration (Promise promise ) {
243
- Activity currentActivity = getCurrentActivity ();
244
245
WritableNativeMap configMap = new WritableNativeMap ();
245
246
configMap .putString ("appVersion" , mCodePush .getAppVersion ());
246
247
configMap .putString ("deploymentKey" , mCodePush .getDeploymentKey ());
247
248
configMap .putString ("serverUrl" , mCodePush .getServerUrl ());
248
- configMap .putString ("clientUniqueId" ,
249
- Settings .Secure .getString (currentActivity .getContentResolver (),
250
- android .provider .Settings .Secure .ANDROID_ID ));
251
- String binaryHash = CodePushUpdateUtils .getHashForBinaryContents (currentActivity , mCodePush .isDebugMode ());
252
- if (binaryHash != null ) {
253
- // binaryHash will be null if the React Native assets were not bundled into the APK
254
- // (e.g. in Debug builds)
255
- configMap .putString (CodePushConstants .PACKAGE_HASH_KEY , binaryHash );
249
+
250
+ Activity currentActivity = getCurrentActivity ();
251
+ if (currentActivity != null ) {
252
+ configMap .putString ("clientUniqueId" ,
253
+ Settings .Secure .getString (currentActivity .getContentResolver (),
254
+ android .provider .Settings .Secure .ANDROID_ID ));
255
+
256
+ String binaryHash = CodePushUpdateUtils .getHashForBinaryContents (currentActivity , mCodePush .isDebugMode ());
257
+ if (binaryHash != null ) {
258
+ // binaryHash will be null if the React Native assets were not bundled into the APK
259
+ // (e.g. in Debug builds)
260
+ configMap .putString (CodePushConstants .PACKAGE_HASH_KEY , binaryHash );
261
+ }
256
262
}
257
263
258
264
promise .resolve (configMap );
0 commit comments