From 1fd72ba8bcf294a7b869067d499dbb27295bc258 Mon Sep 17 00:00:00 2001 From: Chloe <25387744+qimiko@users.noreply.github.com> Date: Sun, 3 Nov 2024 06:11:41 -0700 Subject: [PATCH] i overthought it --- .../main/java/com/geode/launcher/MainActivity.kt | 11 +++++++++++ .../launcher/preferences/SettingsActivity.kt | 15 ++++++++++++--- app/src/main/res/values/strings.xml | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/geode/launcher/MainActivity.kt b/app/src/main/java/com/geode/launcher/MainActivity.kt index 1df691d..75b2aa4 100644 --- a/app/src/main/java/com/geode/launcher/MainActivity.kt +++ b/app/src/main/java/com/geode/launcher/MainActivity.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -189,6 +190,16 @@ fun MainScreen( beginLaunch = true }, ) + + if (gdVersion < Constants.SUPPORTED_VERSION_CODE) { + ElevatedCard(modifier = Modifier.padding(8.dp)) { + Text( + stringResource(R.string.launcher_game_update_required), + textAlign = TextAlign.Center, + modifier = Modifier.padding(8.dp).sizeIn(maxWidth = 512.dp) + ) + } + } } } gdInstalled -> { diff --git a/app/src/main/java/com/geode/launcher/preferences/SettingsActivity.kt b/app/src/main/java/com/geode/launcher/preferences/SettingsActivity.kt index d269acb..9c55594 100644 --- a/app/src/main/java/com/geode/launcher/preferences/SettingsActivity.kt +++ b/app/src/main/java/com/geode/launcher/preferences/SettingsActivity.kt @@ -51,6 +51,8 @@ import com.geode.launcher.ui.theme.GeodeLauncherTheme import com.geode.launcher.ui.theme.LocalTheme import com.geode.launcher.ui.theme.Theme import com.geode.launcher.ui.theme.Typography +import com.geode.launcher.utils.Constants +import com.geode.launcher.utils.GamePackageUtils import com.geode.launcher.utils.LaunchUtils import com.geode.launcher.utils.PreferenceUtils import java.net.ConnectException @@ -178,9 +180,16 @@ fun UpdateIndicator( context.getString(R.string.preference_check_for_updates_success) ) } else { - snackbarHostState.showSnackbar( - context.getString(R.string.preference_check_for_updates_none_found) - ) + val gdInstalled = GamePackageUtils.isGameInstalled(context.packageManager) + if (gdInstalled && GamePackageUtils.getGameVersionCode(context.packageManager) < Constants.SUPPORTED_VERSION_CODE) { + snackbarHostState.showSnackbar( + context.getString(R.string.launcher_game_update_required_short) + ) + } else { + snackbarHostState.showSnackbar( + context.getString(R.string.preference_check_for_updates_none_found) + ) + } } } else -> {} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4c53c88..ac9f774 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -33,6 +33,10 @@ The current version of Geometry Dash is not compatible with the version supported by the launcher. A launcher update is required to fix this.\nLaunch will continue, but crashes may occur! + + A Geometry Dash update is required. + The currently installed version of Geometry Dash is out-of-date. Please update to continue receiving Geode updates. + A new launcher update is available! Dismiss Enable safe mode?