From ae1f0c554726940fb5729102dce36885cf023669 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 10 Mar 2023 09:35:50 -0500 Subject: [PATCH] Starts websockets on an IO Thread --- .../java/com/vitorpamplona/amethyst/ui/MainActivity.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt index 9ea473a80..cdb3aab35 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt @@ -21,6 +21,9 @@ import com.vitorpamplona.amethyst.service.relays.Client import com.vitorpamplona.amethyst.ui.screen.AccountScreen import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel import com.vitorpamplona.amethyst.ui.theme.AmethystTheme +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch class MainActivity : FragmentActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -66,7 +69,9 @@ class MainActivity : FragmentActivity() { super.onResume() // Only starts after login - ServiceManager.start() + GlobalScope.launch(Dispatchers.IO) { + ServiceManager.start() + } } override fun onPause() {