Skip to content

Commit

Permalink
Resolved ANRs when starting a new game (checking for multuplayer serv…
Browse files Browse the repository at this point in the history
…er connection)
  • Loading branch information
yairm210 committed Sep 29, 2024
1 parent 0fbfd66 commit 2ee5f08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -288,6 +289,9 @@ class NewGameScreen(
} catch(_: Throwable) {
false
}
finally {
Gdx.input.inputProcessor = stage
}
}

private suspend fun startNewGame() = coroutineScope {
Expand Down

0 comments on commit 2ee5f08

Please sign in to comment.