summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt')
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt b/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt
index f9edb6e1..42359df0 100644
--- a/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt
+++ b/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.kt
@@ -10,8 +10,8 @@ import androidx.preference.Preference
import com.wireguard.android.Application
import com.wireguard.android.R
import com.wireguard.android.util.ToolsInstaller
+import com.wireguard.android.util.lifecycleScope
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -27,7 +27,7 @@ class ToolsInstallerPreference(context: Context, attrs: AttributeSet?) : Prefere
override fun onAttached() {
super.onAttached()
- GlobalScope.launch(Dispatchers.Main.immediate) {
+ lifecycleScope.launch(Dispatchers.Main.immediate) {
try {
val state = withContext(Dispatchers.IO) { Application.getToolsInstaller().areInstalled() }
when {
@@ -45,7 +45,7 @@ class ToolsInstallerPreference(context: Context, attrs: AttributeSet?) : Prefere
override fun onClick() {
setState(State.WORKING)
- GlobalScope.launch(Dispatchers.Main.immediate) {
+ lifecycleScope.launch(Dispatchers.Main.immediate) {
try {
val result = withContext(Dispatchers.IO) { Application.getToolsInstaller().install() }
when {