@@ -426,49 +426,53 @@ protected Void doInBackground(Object... params) {
426
426
427
427
@ ReactMethod
428
428
public void getNewStatusReport (final Promise promise ) {
429
-
430
- AsyncTask asyncTask = new AsyncTask () {
431
- @ Override
432
- protected Void doInBackground (Object ... params ) {
433
- if (needToReportRollback ) {
434
- needToReportRollback = false ;
435
- JSONArray failedUpdates = getFailedUpdates ();
436
- if (failedUpdates != null && failedUpdates .length () > 0 ) {
437
- try {
438
- JSONObject lastFailedPackageJSON = failedUpdates .getJSONObject (failedUpdates .length () - 1 );
439
- WritableMap lastFailedPackage = CodePushUtils .convertJsonObjectToWriteable (lastFailedPackageJSON );
440
- WritableMap failedStatusReport = codePushTelemetryManager .getRollbackReport (lastFailedPackage );
441
- if (failedStatusReport != null ) {
442
- promise .resolve (failedStatusReport );
429
+ if (isDebugMode ) {
430
+ // Do not report metrics if running in debug mode.
431
+ promise .resolve ("" );
432
+ } else {
433
+ AsyncTask asyncTask = new AsyncTask () {
434
+ @ Override
435
+ protected Void doInBackground (Object ... params ) {
436
+ if (needToReportRollback ) {
437
+ needToReportRollback = false ;
438
+ JSONArray failedUpdates = getFailedUpdates ();
439
+ if (failedUpdates != null && failedUpdates .length () > 0 ) {
440
+ try {
441
+ JSONObject lastFailedPackageJSON = failedUpdates .getJSONObject (failedUpdates .length () - 1 );
442
+ WritableMap lastFailedPackage = CodePushUtils .convertJsonObjectToWriteable (lastFailedPackageJSON );
443
+ WritableMap failedStatusReport = codePushTelemetryManager .getRollbackReport (lastFailedPackage );
444
+ if (failedStatusReport != null ) {
445
+ promise .resolve (failedStatusReport );
446
+ return null ;
447
+ }
448
+ } catch (JSONException e ) {
449
+ throw new CodePushUnknownException ("Unable to read failed updates information stored in SharedPreferences." , e );
450
+ }
451
+ }
452
+ } else if (didUpdate ) {
453
+ WritableMap currentPackage = codePushPackage .getCurrentPackage ();
454
+ if (currentPackage != null ) {
455
+ WritableMap newPackageStatusReport = codePushTelemetryManager .getUpdateReport (currentPackage );
456
+ if (newPackageStatusReport != null ) {
457
+ promise .resolve (newPackageStatusReport );
443
458
return null ;
444
459
}
445
- } catch (JSONException e ) {
446
- throw new CodePushUnknownException ("Unable to read failed updates information stored in SharedPreferences." , e );
447
460
}
448
- }
449
- } else if (didUpdate ) {
450
- WritableMap currentPackage = codePushPackage .getCurrentPackage ();
451
- if (currentPackage != null ) {
452
- WritableMap newPackageStatusReport = codePushTelemetryManager .getUpdateReport (currentPackage );
453
- if (newPackageStatusReport != null ) {
454
- promise .resolve (newPackageStatusReport );
461
+ } else if (isRunningBinaryVersion ) {
462
+ WritableMap newAppVersionStatusReport = codePushTelemetryManager .getBinaryUpdateReport (appVersion );
463
+ if (newAppVersionStatusReport != null ) {
464
+ promise .resolve (newAppVersionStatusReport );
455
465
return null ;
456
466
}
457
467
}
458
- } else if (isRunningBinaryVersion ) {
459
- WritableMap newAppVersionStatusReport = codePushTelemetryManager .getBinaryUpdateReport (appVersion );
460
- if (newAppVersionStatusReport != null ) {
461
- promise .resolve (newAppVersionStatusReport );
462
- return null ;
463
- }
464
- }
465
468
466
- promise .resolve ("" );
467
- return null ;
468
- }
469
- };
469
+ promise .resolve ("" );
470
+ return null ;
471
+ }
472
+ };
470
473
471
- asyncTask .execute ();
474
+ asyncTask .execute ();
475
+ }
472
476
}
473
477
474
478
@ ReactMethod
0 commit comments