Skip to content

Commit

Permalink
[ANDROAPP-5800] fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmr committed Feb 14, 2024
1 parent 8ad122c commit 5b68161
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class SearchTEIViewModel(
minAttributesToSearch,
)
uiState = uiState.copy(minAttributesMessage = message)
uiState.shouldShowMinAttributeWarning.emit(true)
uiState.updateMinAttributeWarning(true)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package org.dhis2.usescases.searchTrackEntity.searchparameters.model

import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import org.dhis2.form.model.FieldUiModel

data class SearchParametersUiState(
val items: List<FieldUiModel> = listOf(),
val minAttributesMessage: String? = null,
val shouldShowMinAttributeWarning: MutableSharedFlow<Boolean> = MutableSharedFlow(),
)
private val _shouldShowMinAttributeWarning: MutableSharedFlow<Boolean> = MutableSharedFlow(),
) {
val shouldShowMinAttributeWarning: SharedFlow<Boolean> = _shouldShowMinAttributeWarning

suspend fun updateMinAttributeWarning(showWarning: Boolean) {
_shouldShowMinAttributeWarning.emit(showWarning)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusDirection
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.graphics.vector.ImageVector
import org.dhis2.R
import org.dhis2.commons.resources.ResourceManager
import org.dhis2.form.model.FieldUiModel
import org.dhis2.form.model.UiRenderType
Expand Down Expand Up @@ -42,7 +43,7 @@ fun provideParameterSelectorItem(
return ParameterSelectorItemModel(
icon = provideIcon(fieldUiModel.valueType, fieldUiModel.renderingType),
label = fieldUiModel.label,
helper = "Optional",
helper = resources.getString(R.string.optional),
inputField = {
FieldProvider(
modifier = Modifier,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -969,4 +969,5 @@
<string name="remove_enrollment_dialog_title">Remove from %s?</string>
<string name="remove_enrollment_dialog_message">Data from %s will de deleted. This action cannot be undone.</string>
<string name="clear_search">\"Clear search\"</string>
<string name="optional">Optional</string>
</resources>

0 comments on commit 5b68161

Please sign in to comment.