From 01902f78f9505b91861af44edd86cd3316878d06 Mon Sep 17 00:00:00 2001 From: Pablo Date: Fri, 9 Feb 2024 08:16:41 +0100 Subject: [PATCH] fix code smells Signed-off-by: Pablo --- .../dhis2/usescases/teiDashboard/DashboardViewModel.kt | 6 ++++-- .../usescases/teiDashboard/TeiDashboardMobileActivity.kt | 6 ++++-- .../usescases/teiDashboard/TeiDashboardPresenter.java | 2 -- app/src/main/res/layout-land/fragment_tei_data.xml | 8 -------- app/src/main/res/layout/fragment_tei_data.xml | 8 -------- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardViewModel.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardViewModel.kt index ce5fbd6d61..167e3f7e31 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardViewModel.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardViewModel.kt @@ -69,7 +69,8 @@ class DashboardViewModel( _state.value = model.currentEnrollment.aggregatedSyncState() } - } catch (_: Exception) { + } catch (e: Exception) { + Timber.e(e) } } } @@ -81,7 +82,8 @@ class DashboardViewModel( } try { _groupByStage.value = result.await() - } catch (_: Exception) { + } catch (e: Exception) { + Timber.e(e) } } } diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardMobileActivity.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardMobileActivity.kt index 5946c25002..da4c7fb462 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardMobileActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardMobileActivity.kt @@ -404,7 +404,7 @@ class TeiDashboardMobileActivity : } } val enrollmentStatus = - dashboardModel.currentEnrollment != null && dashboardModel.currentEnrollment.status() == EnrollmentStatus.ACTIVE + dashboardModel.currentEnrollment.status() == EnrollmentStatus.ACTIVE if (intent.getStringExtra(Constants.EVENT_UID) != null && enrollmentStatus) { dashboardViewModel.updateEventUid( intent.getStringExtra(Constants.EVENT_UID), @@ -626,7 +626,9 @@ class TeiDashboardMobileActivity : StatusChangeResultCode.FAILED -> displayMessage(getString(R.string.something_wrong)) StatusChangeResultCode.ACTIVE_EXIST -> displayMessage(getString(R.string.status_change_error_active_exist)) StatusChangeResultCode.WRITE_PERMISSION_FAIL -> displayMessage(getString(R.string.permission_denied)) - StatusChangeResultCode.CHANGED -> {} + StatusChangeResultCode.CHANGED -> { + /*No message needed to be displayed*/ + } } } diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenter.java b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenter.java index b4bf086cf2..76f0f76bb0 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenter.java +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenter.java @@ -28,7 +28,6 @@ public class TeiDashboardPresenter implements TeiDashboardContracts.Presenter { private final PreferenceProvider preferenceProvider; private final TeiDashboardContracts.View view; - private String teiUid; public String programUid; public CompositeDisposable compositeDisposable; @@ -45,7 +44,6 @@ public TeiDashboardPresenter( MatomoAnalyticsController matomoAnalyticsController ) { this.view = view; - this.teiUid = teiUid; this.programUid = programUid; this.analyticsHelper = analyticsHelper; this.dashboardRepository = dashboardRepository; diff --git a/app/src/main/res/layout-land/fragment_tei_data.xml b/app/src/main/res/layout-land/fragment_tei_data.xml index bceea76407..72de1edd8c 100644 --- a/app/src/main/res/layout-land/fragment_tei_data.xml +++ b/app/src/main/res/layout-land/fragment_tei_data.xml @@ -76,14 +76,6 @@ - diff --git a/app/src/main/res/layout/fragment_tei_data.xml b/app/src/main/res/layout/fragment_tei_data.xml index db2cd06869..9d0e646c6e 100644 --- a/app/src/main/res/layout/fragment_tei_data.xml +++ b/app/src/main/res/layout/fragment_tei_data.xml @@ -78,14 +78,6 @@ - -