@@ -33,14 +33,14 @@ public CodePushTelemetryManager(Context applicationContext, String codePushPrefe
3333
3434 public WritableMap getBinaryUpdateReport (String appVersion ) {
3535 String previousStatusReportIdentifier = this .getPreviousStatusReportIdentifier ();
36+ WritableNativeMap reportMap = null ;
3637 if (previousStatusReportIdentifier == null ) {
3738 this .clearRetryStatusReport ();
38- WritableNativeMap reportMap = new WritableNativeMap ();
39+ reportMap = new WritableNativeMap ();
3940 reportMap .putString (APP_VERSION_KEY , appVersion );
40- return reportMap ;
4141 } else if (!previousStatusReportIdentifier .equals (appVersion )) {
4242 this .clearRetryStatusReport ();
43- WritableNativeMap reportMap = new WritableNativeMap ();
43+ reportMap = new WritableNativeMap ();
4444 if (this .isStatusReportIdentifierCodePushLabel (previousStatusReportIdentifier )) {
4545 String previousDeploymentKey = this .getDeploymentKeyFromStatusReportIdentifier (previousStatusReportIdentifier );
4646 String previousLabel = this .getVersionLabelFromStatusReportIdentifier (previousStatusReportIdentifier );
@@ -52,10 +52,9 @@ public WritableMap getBinaryUpdateReport(String appVersion) {
5252 reportMap .putString (APP_VERSION_KEY , appVersion );
5353 reportMap .putString (PREVIOUS_LABEL_OR_APP_VERSION_KEY , previousStatusReportIdentifier );
5454 }
55- return reportMap ;
5655 }
5756
58- return null ;
57+ return reportMap ;
5958 }
6059
6160 public WritableMap getRetryStatusReport () {
@@ -68,7 +67,6 @@ public WritableMap getRetryStatusReport() {
6867 return CodePushUtils .convertJsonObjectToWritable (retryStatusReport );
6968 } catch (JSONException e ) {
7069 e .printStackTrace ();
71- return null ;
7270 }
7371 }
7472
@@ -85,36 +83,33 @@ public WritableMap getRollbackReport(WritableMap lastFailedPackage) {
8583 public WritableMap getUpdateReport (WritableMap currentPackage ) {
8684 String currentPackageIdentifier = this .getPackageStatusReportIdentifier (currentPackage );
8785 String previousStatusReportIdentifier = this .getPreviousStatusReportIdentifier ();
86+ WritableNativeMap reportMap = null ;
8887 if (currentPackageIdentifier != null ) {
8988 if (previousStatusReportIdentifier == null ) {
9089 this .clearRetryStatusReport ();
91- WritableNativeMap reportMap = new WritableNativeMap ();
90+ reportMap = new WritableNativeMap ();
9291 reportMap .putMap (PACKAGE_KEY , currentPackage );
9392 reportMap .putString (STATUS_KEY , DEPLOYMENT_SUCCEEDED_STATUS );
94- return reportMap ;
9593 } else if (!previousStatusReportIdentifier .equals (currentPackageIdentifier )) {
9694 this .clearRetryStatusReport ();
95+ reportMap = new WritableNativeMap ();
9796 if (this .isStatusReportIdentifierCodePushLabel (previousStatusReportIdentifier )) {
9897 String previousDeploymentKey = this .getDeploymentKeyFromStatusReportIdentifier (previousStatusReportIdentifier );
9998 String previousLabel = this .getVersionLabelFromStatusReportIdentifier (previousStatusReportIdentifier );
100- WritableNativeMap reportMap = new WritableNativeMap ();
10199 reportMap .putMap (PACKAGE_KEY , currentPackage );
102100 reportMap .putString (STATUS_KEY , DEPLOYMENT_SUCCEEDED_STATUS );
103101 reportMap .putString (PREVIOUS_DEPLOYMENT_KEY_KEY , previousDeploymentKey );
104102 reportMap .putString (PREVIOUS_LABEL_OR_APP_VERSION_KEY , previousLabel );
105- return reportMap ;
106103 } else {
107104 // Previous status report was with a binary app version.
108- WritableNativeMap reportMap = new WritableNativeMap ();
109105 reportMap .putMap (PACKAGE_KEY , currentPackage );
110106 reportMap .putString (STATUS_KEY , DEPLOYMENT_SUCCEEDED_STATUS );
111107 reportMap .putString (PREVIOUS_LABEL_OR_APP_VERSION_KEY , previousStatusReportIdentifier );
112- return reportMap ;
113108 }
114109 }
115110 }
116111
117- return null ;
112+ return reportMap ;
118113 }
119114
120115 public void recordStatusReported (ReadableMap statusReport ) {
0 commit comments