diff --git a/src/main/kotlin/com/github/purofle/nmsl/pages/DownloadPage.kt b/src/main/kotlin/com/github/purofle/nmsl/pages/DownloadPage.kt index b4e2696..a099fc8 100644 --- a/src/main/kotlin/com/github/purofle/nmsl/pages/DownloadPage.kt +++ b/src/main/kotlin/com/github/purofle/nmsl/pages/DownloadPage.kt @@ -26,7 +26,9 @@ import com.github.purofle.nmsl.game.Manifest import com.github.purofle.nmsl.game.VersionType import com.github.purofle.nmsl.utils.getDefaultProvider import com.github.purofle.nmsl.utils.getGameDownloader +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import java.time.Instant import java.time.ZoneOffset import java.time.format.DateTimeFormatter @@ -46,7 +48,9 @@ class DownloadPage : Page { var remoteManifest: Manifest? by rememberSaveable { mutableStateOf(null) } LaunchedEffect(Unit) { - remoteManifest = GameManager.downloadManifest(DownloadProvider.getDefaultProvider()) + withContext(Dispatchers.IO) { + remoteManifest = GameManager.downloadManifest(DownloadProvider.getDefaultProvider()) + } } val scope = rememberCoroutineScope() diff --git a/src/main/kotlin/com/github/purofle/nmsl/pages/GamePage.kt b/src/main/kotlin/com/github/purofle/nmsl/pages/GamePage.kt index c264290..2eea3b2 100644 --- a/src/main/kotlin/com/github/purofle/nmsl/pages/GamePage.kt +++ b/src/main/kotlin/com/github/purofle/nmsl/pages/GamePage.kt @@ -23,6 +23,7 @@ import com.github.purofle.nmsl.config.NmslConfig import com.github.purofle.nmsl.game.GameManager import com.github.purofle.nmsl.utils.getGameDownloader import com.github.purofle.nmsl.utils.startGame +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import org.jetbrains.skiko.ClipboardManager import org.jetbrains.skiko.URIManager @@ -91,8 +92,8 @@ class GamePage : Page { if (selectedGame.isNotBlank()) { ExtendedFloatingActionButton( { + scope.launch(Dispatchers.IO) { val gameDownloader = getGameDownloader(selectedGame) - scope.launch { startGame(selectedGame, gameDownloader.getLauncherArgument()) }