From 2ee5f08855dc03f3fd0467a3cbf4123a52889abd Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sun, 29 Sep 2024 23:25:15 +0300 Subject: [PATCH] Resolved ANRs when starting a new game (checking for multuplayer server connection) --- core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt index 2aa3e8fdd7727..f1d05855fce3b 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt @@ -277,6 +277,7 @@ class NewGameScreen( } private fun checkConnectionToMultiplayerServer(): Boolean { + Gdx.input.inputProcessor = null // To avoid ANRs return try { val multiplayerServer = UncivGame.Current.settings.multiplayer.server val u = URL(if (Multiplayer.usesDropbox()) "https://content.dropboxapi.com" else multiplayerServer) @@ -288,6 +289,9 @@ class NewGameScreen( } catch(_: Throwable) { false } + finally { + Gdx.input.inputProcessor = stage + } } private suspend fun startNewGame() = coroutineScope {