@@ -4,10 +4,15 @@ import android.content.Intent
44import android.net.Uri
55import android.os.Bundle
66import android.util.Log
7+ import androidx.lifecycle.lifecycleScope
78import com.v2ray.ang.R
89import com.v2ray.ang.databinding.ActivityLogcatBinding
910import com.v2ray.ang.extension.toast
1011import com.v2ray.ang.handler.AngConfigManager
12+ import kotlinx.coroutines.Dispatchers
13+ import kotlinx.coroutines.delay
14+ import kotlinx.coroutines.launch
15+ import kotlinx.coroutines.withContext
1116import java.net.URLDecoder
1217
1318class UrlSchemeActivity : BaseActivity () {
@@ -66,11 +71,15 @@ class UrlSchemeActivity : BaseActivity() {
6671 decodedUrl + = " #${fragment} "
6772 }
6873 Log .d(" UrlScheme-decodedUrl" , decodedUrl)
69- val (count, countSub) = AngConfigManager .importBatchConfig(decodedUrl, " " , false )
70- if (count + countSub > 0 ) {
71- toast(R .string.import_subscription_success)
72- } else {
73- toast(R .string.import_subscription_failure)
74+ lifecycleScope.launch(Dispatchers .IO ) {
75+ val (count, countSub) = AngConfigManager .importBatchConfig(decodedUrl, " " , false )
76+ withContext(Dispatchers .Main ) {
77+ if (count + countSub > 0 ) {
78+ toast(R .string.import_subscription_success)
79+ } else {
80+ toast(R .string.import_subscription_failure)
81+ }
82+ }
7483 }
7584 }
7685 }
0 commit comments