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) {
|
fun deleteRow(index: Int) {
|
||||||
|
viewModelScope.launchIO {
|
||||||
updateState {
|
updateState {
|
||||||
val rows = it.rows.toMutableList().apply { removeAt(index) }
|
val rows = it.rows.toMutableList().apply { removeAt(index) }
|
||||||
val rowData = it.rowData.toMutableList().apply { removeAt(index) }
|
val rowData = it.rowData.toMutableList().apply { removeAt(index) }
|
||||||
|
|
@ -185,6 +186,7 @@ class HomeSettingsViewModel
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun addRow(type: MetaRowType): Job =
|
fun addRow(type: MetaRowType): Job =
|
||||||
viewModelScope.launchIO {
|
viewModelScope.launchIO {
|
||||||
|
|
@ -341,6 +343,7 @@ class HomeSettingsViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateViewOptionsForAll(viewOptions: HomeRowViewOptions) {
|
fun updateViewOptionsForAll(viewOptions: HomeRowViewOptions) {
|
||||||
|
viewModelScope.launchIO {
|
||||||
updateState {
|
updateState {
|
||||||
it.copy(
|
it.copy(
|
||||||
rowData =
|
rowData =
|
||||||
|
|
@ -354,6 +357,7 @@ class HomeSettingsViewModel
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun saveToRemote() {
|
fun saveToRemote() {
|
||||||
viewModelScope.launchIO {
|
viewModelScope.launchIO {
|
||||||
|
|
@ -456,6 +460,7 @@ class HomeSettingsViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resizeCards(relative: Int) {
|
fun resizeCards(relative: Int) {
|
||||||
|
viewModelScope.launchIO {
|
||||||
updateState {
|
updateState {
|
||||||
val newRows =
|
val newRows =
|
||||||
it.rows.toMutableList().map { row ->
|
it.rows.toMutableList().map { row ->
|
||||||
|
|
@ -477,6 +482,7 @@ class HomeSettingsViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data class HomePageSettingsState(
|
data class HomePageSettingsState(
|
||||||
val loading: LoadingState,
|
val loading: LoadingState,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue