Browse Source

Fix ANR when opening from notification/widget (#8683)

Ivan Iskandar 2 years ago
parent
commit
c288e6b8fa
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt

+ 5 - 4
app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt

@@ -73,7 +73,6 @@ import kotlinx.coroutines.flow.drop
 import kotlinx.coroutines.flow.launchIn
 import kotlinx.coroutines.flow.onEach
 import kotlinx.coroutines.launch
-import kotlinx.coroutines.runBlocking
 import logcat.LogPriority
 import uy.kohesive.injekt.Injekt
 import uy.kohesive.injekt.api.get
@@ -325,9 +324,11 @@ class MainActivity : BaseActivity() {
     }
 
     override fun onNewIntent(intent: Intent) {
-        val handle = runBlocking { handleIntentAction(intent) }
-        if (!handle) {
-            super.onNewIntent(intent)
+        lifecycleScope.launch {
+            val handle = handleIntentAction(intent)
+            if (!handle) {
+                super.onNewIntent(intent)
+            }
         }
     }