Remove obsolete WidgetViewModel

This commit is contained in:
MM20 2022-02-07 11:16:35 +01:00
parent 9280056d88
commit 5c104f76ee
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 0 additions and 31 deletions

View File

@ -6,5 +6,4 @@ import org.koin.dsl.module
val widgetsModule = module {
single { WidgetRepository(androidContext()) }
viewModel { WidgetViewModel(get()) }
}

View File

@ -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()
}
}