Skip to content

Commit

Permalink
ktlint
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan committed Feb 14, 2024
1 parent 6b4db0b commit bea9813
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import io.reactivex.Single
import io.reactivex.functions.Function
import org.dhis2.bindings.profilePicturePath
import org.dhis2.commons.data.tuples.Pair
import org.dhis2.commons.resources.ResourceManager
import org.dhis2.commons.prefs.Preference
import org.dhis2.commons.prefs.PreferenceProvider
import org.dhis2.utils.AuthorityException
import org.dhis2.utils.DateUtils
import org.dhis2.utils.ValueUtils
import org.hisp.dhis.android.core.D2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class DashboardViewModel(
viewModelScope.launch(dispatcher.io()) {
val result = async {
dashboardModel.value.takeIf { it is DashboardEnrollmentModel }?.let {
repository.deleteEnrollmentIfPossible((it as DashboardEnrollmentModel).currentEnrollment.uid())
repository.deleteEnrollment((it as DashboardEnrollmentModel).currentEnrollment.uid())
.blockingGet()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ class TeiDashboardMobileActivity :
}

val deleteEnrollmentItem = popupMenu.menu.findItem(R.id.deleteEnrollment)
deleteEnrollmentItem.isVisible = presenter.checkIfEnrollmentCanBeDeleted(enrollmentUid)
deleteEnrollmentItem.isVisible =
presenter.checkIfEnrollmentCanBeDeleted(enrollmentUid)

if (enrollmentUid != null) {
val status = presenter.getEnrollmentStatus(enrollmentUid)
Expand All @@ -577,7 +578,7 @@ class TeiDashboardMobileActivity :
showTutorial(true)
}

R.id.markForFollowUp -> dashboardViewModel.onFollowUp(programModel)
R.id.markForFollowUp -> dashboardViewModel.onFollowUp()
R.id.deleteTei -> showDeleteTEIConfirmationDialog()
R.id.deleteEnrollment -> showRemoveEnrollmentConfirmationDialog()
R.id.programSelector -> presenter.onEnrollmentSelectorClick()
Expand Down Expand Up @@ -651,17 +652,24 @@ class TeiDashboardMobileActivity :
}

private fun showRemoveEnrollmentConfirmationDialog() {
DeleteBottomSheetDialog(
title = getString(R.string.remove_enrollment_dialog_title).format(programModel.currentProgram.displayName()),
description = getString(R.string.remove_enrollment_dialog_message).format(programModel.currentProgram.displayName()),
mainButtonText = getString(R.string.remove),
onMainButtonClick = {
presenter.deleteEnrollment()
},
).show(
supportFragmentManager,
DeleteBottomSheetDialog.TAG,
)
val dashboardModel = dashboardViewModel.dashboardModel.value
if (dashboardModel is DashboardEnrollmentModel) {
DeleteBottomSheetDialog(
title = getString(R.string.remove_enrollment_dialog_title).format(
dashboardModel.currentProgram().displayName(),
),
description = getString(R.string.remove_enrollment_dialog_message).format(
dashboardModel.currentProgram().displayName(),
),
mainButtonText = getString(R.string.remove),
onMainButtonClick = {
dashboardViewModel.deleteEnrollment { authorityErrorMessage() }
},
).show(
supportFragmentManager,
DeleteBottomSheetDialog.TAG,
)
}
}

override fun onRelationshipMapLoaded() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class TEIDataFragment : FragmentGlobalAbstract(), TEIDataContracts.View {
}

override fun updateEnrollment(update: Boolean) {
if(update) {
if (update) {
presenter.fetchEvents(update)
presenter.getEnrollment()?.let { eventAdapter?.setEnrollment(it) }
dashboardViewModel.updateDashboard()
Expand Down

0 comments on commit bea9813

Please sign in to comment.