Use viewModelScope instead of GlobalScope

This commit is contained in:
topjohnwu
2022-03-23 18:03:41 -07:00
parent b1faa5eed4
commit e67d0678f9
2 changed files with 12 additions and 13 deletions
@@ -125,10 +125,12 @@ class SuRequestViewModel(
val pos = selectedItemPosition
timeoutPrefs.edit().putInt(handler.policy.packageName, pos).apply()
handler.respond(action, Config.Value.TIMEOUT_LIST[pos])
// Kill activity after response
DieEvent().publish()
viewModelScope.launch {
handler.respond(action, Config.Value.TIMEOUT_LIST[pos])
// Kill activity after response
DieEvent().publish()
}
}
private fun cancelTimer() {