diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1057264be8d..6f9ff04deff 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -255,7 +255,6 @@ dependencies { implementation(libs.analytics.customactivityoncrash) implementation(platform(libs.dispatcher.dispatchBOM)) implementation(libs.dispatcher.dispatchCore) - implementation(libs.dhis2.mobile.designsystem) coreLibraryDesugaring(libs.desugar) diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardContracts.java b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardContracts.java index 645066c482e..f15ad4237d3 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardContracts.java +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardContracts.java @@ -26,8 +26,6 @@ public interface View extends AbstractActivityContracts.View { void showTabsAndEnableSwipe(); - void updateStatus(); - void displayStatusError(StatusChangeResultCode statusCode); } 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 da4c7fb4623..e2237db4185 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardMobileActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardMobileActivity.kt @@ -187,11 +187,6 @@ class TeiDashboardMobileActivity : dashboardViewModel.showStatusErrorMessages.observe(this) { displayStatusError(it) } - dashboardViewModel.updateEnrollment.observe(this) { - if (it) { - updateStatus() - } - } dashboardViewModel.dashboardModel.observe(this) { when (it) { is DashboardEnrollmentModel -> setData(it) @@ -618,9 +613,6 @@ class TeiDashboardMobileActivity : ViewCompat.setElevation(binding.toolbar, elevation) } - override fun updateStatus() { - } - override fun displayStatusError(statusCode: StatusChangeResultCode) { when (statusCode) { StatusChangeResultCode.FAILED -> displayMessage(getString(R.string.something_wrong)) diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardModule.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardModule.kt index 651c9c76819..386d063420b 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardModule.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardModule.kt @@ -42,7 +42,6 @@ class TeiDashboardModule( ): TeiDashboardContracts.Presenter { return TeiDashboardPresenter( view, - teiUid, programUid, dashboardRepository, schedulerProvider, 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 76f0f76bb04..080ab925ecd 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenter.java +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenter.java @@ -36,7 +36,7 @@ public class TeiDashboardPresenter implements TeiDashboardContracts.Presenter { public TeiDashboardPresenter( TeiDashboardContracts.View view, - String teiUid, String programUid, + String programUid, DashboardRepository dashboardRepository, SchedulerProvider schedulerProvider, AnalyticsHelper analyticsHelper, @@ -176,9 +176,7 @@ public void updateEnrollmentStatus(String enrollmentUid, EnrollmentStatus status .subscribeOn(schedulerProvider.io()) .observeOn(schedulerProvider.ui()) .subscribe(statusCode -> { - if (statusCode == StatusChangeResultCode.CHANGED) { - view.updateStatus(); - } else { + if (statusCode != StatusChangeResultCode.CHANGED) { view.displayStatusError(statusCode); } }, Timber::e) diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataContracts.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataContracts.kt index 5a0c408e8cc..64ace14afd0 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataContracts.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataContracts.kt @@ -11,7 +11,6 @@ import org.dhis2.commons.data.EventViewModel import org.dhis2.commons.data.StageSection import org.dhis2.usescases.general.AbstractActivityContracts import org.hisp.dhis.android.core.enrollment.Enrollment -import org.hisp.dhis.android.core.enrollment.EnrollmentStatus import org.hisp.dhis.android.core.program.Program import org.hisp.dhis.android.core.program.ProgramStage @@ -21,7 +20,6 @@ class TEIDataContracts { fun setEvents(events: List) fun displayGenerateEvent(): Consumer fun areEventsCompleted(): Consumer> - fun enrollmentCompleted(): Consumer fun switchFollowUp(followUp: Boolean) fun displayGenerateEvent(eventUid: String) fun restoreAdapter(programUid: String, teiUid: String, enrollmentUid: String) diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt index 315a1ba54e9..f06e41d02d2 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataFragment.kt @@ -375,12 +375,6 @@ class TEIDataFragment : FragmentGlobalAbstract(), TEIDataContracts.View { } } - override fun enrollmentCompleted(): Consumer { - return Consumer { enrollmentStatus -> - if (enrollmentStatus == EnrollmentStatus.COMPLETED) dashboardActivity.updateStatus() - } - } - override fun viewLifecycleOwner(): LifecycleOwner { return this.viewLifecycleOwner } diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt index f8e3cc2985d..c7eada9f94b 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt @@ -7,6 +7,7 @@ import androidx.annotation.VisibleForTesting import androidx.core.app.ActivityOptionsCompat import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData +import io.reactivex.Completable import io.reactivex.Flowable import io.reactivex.Observable import io.reactivex.Single @@ -244,12 +245,13 @@ class TEIDataPresenter( if (hasWriteAccessInProgram) { compositeDisposable.add( - dashboardRepository.completeEnrollment(enrollmentUid) + Completable.fromCallable { + dashboardRepository.completeEnrollment(enrollmentUid).blockingFirst() + } .subscribeOn(schedulerProvider.computation()) .observeOn(schedulerProvider.ui()) - .map { obj -> obj.status() ?: EnrollmentStatus.ACTIVE } .subscribe( - view.enrollmentCompleted(), + {}, Timber.Forest::d, ), ) diff --git a/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt b/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt index 3fb3f0488a8..eaee8a1cbfd 100644 --- a/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt +++ b/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt @@ -47,7 +47,6 @@ class TeiDashboardPresenterTest { fun setup() { presenter = TeiDashboardPresenter( view, - teiUid, programUid, repository, schedulers, @@ -182,18 +181,6 @@ class TeiDashboardPresenterTest { verify(repository).getEnrollmentStatus(any()) } - @Test - fun `Should update the status of the enrollment`() { - whenever( - repository.updateEnrollmentStatus("uid", EnrollmentStatus.COMPLETED), - ) doReturn Observable.just(StatusChangeResultCode.CHANGED) - - presenter.updateEnrollmentStatus("uid", EnrollmentStatus.COMPLETED) - - verify(view).updateStatus() - verifyNoMoreInteractions(view) - } - @Test fun `Should show error message when updating the status of the enrollment returns an error`() { whenever( diff --git a/build.gradle.kts b/build.gradle.kts index 05802d58432..b1783fea566 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,6 +51,7 @@ val isNonStable: (String) -> Boolean = { version -> allprojects { configurations.all { resolutionStrategy { + cacheDynamicVersionsFor(0, TimeUnit.SECONDS) eachDependency { if (requested.group == "org.jacoco") useVersion("0.8.10") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 06b1bb0691a..16219d1544c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ kotlin = '1.9.21' hilt = '2.47' hiltCompiler = '1.0.0' jacoco = '0.8.10' -designSystem = "0.2-20240208.105715-18" +designSystem = "0.2-20240208.162422-19" dhis2sdk = "1.10.0-20240129.132841-8" ruleEngine = "2.1.9" appcompat = "1.6.1"