mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
Move code into coroutines
This commit is contained in:
parent
8437ddb51d
commit
bec833b0e8
1 changed files with 42 additions and 36 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue