Remove obsolete WidgetViewModel
This commit is contained in:
parent
9280056d88
commit
5c104f76ee
@ -6,5 +6,4 @@ import org.koin.dsl.module
|
|||||||
|
|
||||||
val widgetsModule = module {
|
val widgetsModule = module {
|
||||||
single { WidgetRepository(androidContext()) }
|
single { WidgetRepository(androidContext()) }
|
||||||
viewModel { WidgetViewModel(get()) }
|
|
||||||
}
|
}
|
||||||
@ -1,30 +0,0 @@
|
|||||||
package de.mm20.launcher2.widgets
|
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
class WidgetViewModel(
|
|
||||||
private val widgetRepository: WidgetRepository
|
|
||||||
) : ViewModel() {
|
|
||||||
|
|
||||||
|
|
||||||
suspend fun getWidgets(): List<Widget> {
|
|
||||||
return withContext(viewModelScope.coroutineContext + Dispatchers.IO) {
|
|
||||||
widgetRepository.getWidgets()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun saveWidgets(widgets: List<Widget>) {
|
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
|
||||||
widgetRepository.saveWidgets(widgets)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getInternalWidgets(): List<Widget> {
|
|
||||||
return widgetRepository.getInternalWidgets()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user