Load app status data off the UI thread
Previously, the data was loaded on the UI thread which produced a visible freeze after clicking "App backup status".
This commit is contained in:
parent
0612f79195
commit
fbdfa40300
1 changed files with 2 additions and 1 deletions
|
@ -37,6 +37,7 @@ import com.stevesoltys.seedvault.transport.requestBackup
|
||||||
import com.stevesoltys.seedvault.ui.RequireProvisioningViewModel
|
import com.stevesoltys.seedvault.ui.RequireProvisioningViewModel
|
||||||
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
||||||
import com.stevesoltys.seedvault.ui.notification.getAppName
|
import com.stevesoltys.seedvault.ui.notification.getAppName
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ internal class SettingsViewModel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAppStatusResult(): LiveData<AppStatusResult> = liveData {
|
private fun getAppStatusResult(): LiveData<AppStatusResult> = liveData(Dispatchers.Default) {
|
||||||
val pm = app.packageManager
|
val pm = app.packageManager
|
||||||
val locale = Locale.getDefault()
|
val locale = Locale.getDefault()
|
||||||
val list = packageService.userApps.map {
|
val list = packageService.userApps.map {
|
||||||
|
|
Loading…
Reference in a new issue