From b72122ff8fa8a47b90353aa47602d5562165299b Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Thu, 5 Dec 2024 08:41:14 +0100 Subject: [PATCH] fix: [ANDROAPP-6703] refresh selected item when inputCardData list is modified --- .../ui/provider/inputfield/FieldProvider.kt | 7 ------ .../inputfield/MatrixInputProvider.kt | 2 -- .../inputfield/MatrixSequentialUtilites.kt | 25 +------------------ .../inputfield/SequentialInputProvider.kt | 3 --- 4 files changed, 1 insertion(+), 36 deletions(-) diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt index 7b415964ef..2515ddf353 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/FieldProvider.kt @@ -1,6 +1,5 @@ package org.dhis2.form.ui.provider.inputfield -import android.content.Context import android.content.Intent import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.focusable @@ -23,7 +22,6 @@ import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Size import androidx.compose.ui.layout.onSizeChanged -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.TextFieldValue @@ -68,7 +66,6 @@ fun FieldProvider( focusManager: FocusManager, onNextClicked: () -> Unit, ) { - val context = LocalContext.current val bringIntoViewRequester = remember { BringIntoViewRequester() } val focusRequester = remember { FocusRequester() } var visibleArea by remember { mutableStateOf(Rect.Zero) } @@ -112,7 +109,6 @@ fun FieldProvider( inputStyle = inputStyle, fieldUiModel = fieldUiModel, intentHandler = intentHandler, - context = context, fetchOptions = { intentHandler( FormIntent.FetchOptions( @@ -484,7 +480,6 @@ fun ProvideByOptionSet( inputStyle: InputStyle, fieldUiModel: FieldUiModel, intentHandler: (FormIntent) -> Unit, - context: Context, fetchOptions: () -> Unit, ) { when (fieldUiModel.renderingType) { @@ -516,7 +511,6 @@ fun ProvideByOptionSet( inputStyle = inputStyle, fieldUiModel = fieldUiModel, intentHandler = intentHandler, - context = context, ) } @@ -526,7 +520,6 @@ fun ProvideByOptionSet( inputStyle = inputStyle, fieldUiModel = fieldUiModel, intentHandler = intentHandler, - context = context, ) } diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixInputProvider.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixInputProvider.kt index b926d87596..ed0adf2a36 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixInputProvider.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixInputProvider.kt @@ -1,6 +1,5 @@ package org.dhis2.form.ui.provider.inputfield -import android.content.Context import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue @@ -21,7 +20,6 @@ internal fun ProvideMatrixInput( modifier: Modifier, inputStyle: InputStyle, fieldUiModel: FieldUiModel, - context: Context, intentHandler: (FormIntent) -> Unit, ) { val inputCardDataList: MutableList = mutableListOf() diff --git a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixSequentialUtilites.kt b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixSequentialUtilites.kt index 6fbe9b727d..a55f3ebcad 100644 --- a/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixSequentialUtilites.kt +++ b/form/src/main/java/org/dhis2/form/ui/provider/inputfield/MatrixSequentialUtilites.kt @@ -4,31 +4,8 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import org.dhis2.form.model.FieldUiModel -import org.dhis2.ui.MetadataIconData -import org.hisp.dhis.android.core.option.Option import org.hisp.dhis.mobile.ui.designsystem.component.ImageCardData -@Composable -fun rememberInputCardList( - options: List