8000 fix: [ANDROAPP-6880] Clear selection when dismissing input or clicking done by Balcan · Pull Request #4166 · dhis2/dhis2-android-capture-app · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: [ANDROAPP-6880] Clear selection when dismissing input or clicking done #4166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@ fun DataSetInstanceScreen(
mutableStateOf<TableSelection>(TableSelection.Unselected())
}

LaunchedEffect((dataSetScreenState as? DataSetScreenState.Loaded)?.nextCellSelection) {
tableCellSelection =
(dataSetScreenState as? DataSetScreenState.Loaded)?.nextCellSelection?.first
?: TableSelection.Unselected()
LaunchedEffect((dataSetScreenState as? DataSetScreenState.Loaded)) {
if ((dataSetScreenState as? DataSetScreenState.Loaded)?.nextCellSelection?.first != null) {
tableCellSelection = (dataSetScreenState as? DataSetScreenState.Loaded)?.nextCellSelection?.first!!
} else if ((dataSetScreenState as? DataSetScreenState.Loaded)?.selectedCellInfo == null) {
tableCellSelection = TableSelection.Unselected()
}
}

Scaffold(
Expand Down Expand Up @@ -457,6 +459,7 @@ fun DataSetInstanceScreen(
>
scope.launch {
dataSetTableViewModel.updateSelectedCell(null)
tableCellSelection = TableSelection.Unselected()
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ internal class DataSetTableViewModel(
),
selectedCellInfo = null,
initialSection = selectedSectionIndex ?: 0,
nextCellSelection = Pair(null, false),
)
} else {
it
Expand Down Expand Up @@ -310,6 +311,7 @@ internal class DataSetTableViewModel(
_dataSetScreenState.update {
(it as? DataSetScreenState.Loaded)?.copy(
nextCellSelection = Pair(null, false),
selectedCellInfo = null,
) ?: it
}
updateSelectedCell(null)
Expand All @@ -319,6 +321,12 @@ internal class DataSetTableViewModel(
)
}
} else {
_dataSetScreenState.update {
(it as? DataSetScreenState.Loaded)?.copy(
nextCellSelection = Pair(null, false),
selectedCellInfo = null,
) ?: it
}
null
}
val isLastCell = isLastCell(cellId ?: "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ internal class DataSetTableViewModelTest : KoinTest {
with(awaitItem()) {
assertTrue(this is DataSetScreenState.Loaded)
assertTrue((this as DataSetScreenState.Loaded).selectedCellInfo == null)
assertTrue(this.nextCellSelection.first == null)
}
}
}
Expand Down
0