Skip to content

Commit

Permalink
Load app status data off the UI thread
Browse files Browse the repository at this point in the history
Previously, the data was loaded on the UI thread which produced a
visible freeze after clicking "App backup status".
  • Loading branch information
Torsten Grote authored and Chirayu Desai committed Oct 8, 2020
1 parent 0612f79 commit fbdfa40
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -37,6 +37,7 @@ import com.stevesoltys.seedvault.transport.requestBackup
import com.stevesoltys.seedvault.ui.RequireProvisioningViewModel
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
import com.stevesoltys.seedvault.ui.notification.getAppName
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.Locale

Expand Down Expand Up @@ -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 locale = Locale.getDefault()
val list = packageService.userApps.map {
Expand Down

0 comments on commit fbdfa40

Please sign in to comment.