Move code into coroutines

This commit is contained in:
Damontecres 2026-01-30 10:30:39 -05:00
parent 8437ddb51d
commit bec833b0e8
No known key found for this signature in database

View file

@ -176,6 +176,7 @@ class HomeSettingsViewModel
}
fun deleteRow(index: Int) {
viewModelScope.launchIO {
updateState {
val rows = it.rows.toMutableList().apply { removeAt(index) }
val rowData = it.rowData.toMutableList().apply { removeAt(index) }
@ -185,6 +186,7 @@ class HomeSettingsViewModel
)
}
}
}
fun addRow(type: MetaRowType): Job =
viewModelScope.launchIO {
@ -341,6 +343,7 @@ class HomeSettingsViewModel
}
fun updateViewOptionsForAll(viewOptions: HomeRowViewOptions) {
viewModelScope.launchIO {
updateState {
it.copy(
rowData =
@ -354,6 +357,7 @@ class HomeSettingsViewModel
)
}
}
}
fun saveToRemote() {
viewModelScope.launchIO {
@ -456,6 +460,7 @@ class HomeSettingsViewModel
}
fun resizeCards(relative: Int) {
viewModelScope.launchIO {
updateState {
val newRows =
it.rows.toMutableList().map { row ->
@ -477,6 +482,7 @@ class HomeSettingsViewModel
}
}
}
}
data class HomePageSettingsState(
val loading: LoadingState,