mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-22 00:42:38 +00:00
block launch on outdated game versions
This commit is contained in:
2 files changed
+24
-16
No files matched your search
@@ -744,7 +744,6 @@ fun PlayButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (showSafeModeDialog) {
|
if (showSafeModeDialog) {
|
||||||
SafeModeDialog(
|
SafeModeDialog(
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
@@ -762,6 +761,20 @@ fun PlayButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun LaunchBlockedLabel(text: String) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
Text(text, modifier = Modifier.padding(12.dp))
|
||||||
|
OutlinedButton(onClick = { onSettings(context) }) {
|
||||||
|
Icon(Icons.Filled.Settings, contentDescription = null)
|
||||||
|
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||||
|
Text(context.getString(R.string.launcher_settings))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MainScreen(
|
fun MainScreen(
|
||||||
gdInstalled: Boolean = true,
|
gdInstalled: Boolean = true,
|
||||||
@@ -772,7 +785,6 @@ fun MainScreen(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
val shouldUpdate by PreferenceUtils.useBooleanPreference(PreferenceUtils.Key.UPDATE_AUTOMATICALLY)
|
val shouldUpdate by PreferenceUtils.useBooleanPreference(PreferenceUtils.Key.UPDATE_AUTOMATICALLY)
|
||||||
|
|
||||||
val autoUpdateState by releaseViewModel.uiState.collectAsState()
|
val autoUpdateState by releaseViewModel.uiState.collectAsState()
|
||||||
|
|
||||||
val geodeJustInstalled = (autoUpdateState as? ReleaseViewModel.ReleaseUIState.Finished)
|
val geodeJustInstalled = (autoUpdateState as? ReleaseViewModel.ReleaseUIState.Finished)
|
||||||
@@ -834,6 +846,13 @@ fun MainScreen(
|
|||||||
|
|
||||||
when {
|
when {
|
||||||
gdInstalled && geodeInstalled -> {
|
gdInstalled && geodeInstalled -> {
|
||||||
|
val gdVersion = remember {
|
||||||
|
LaunchUtils.getGeometryDashVersionCode(context.packageManager)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gdVersion < Constants.SUPPORTED_VERSION_CODE) {
|
||||||
|
LaunchBlockedLabel(stringResource(R.string.game_outdated))
|
||||||
|
} else {
|
||||||
val stopLaunch = releaseViewModel.isInUpdate || hasError
|
val stopLaunch = releaseViewModel.isInUpdate || hasError
|
||||||
PlayButton(
|
PlayButton(
|
||||||
stopAutomaticLaunch = stopLaunch,
|
stopAutomaticLaunch = stopLaunch,
|
||||||
@@ -844,6 +863,7 @@ fun MainScreen(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gdInstalled -> {
|
gdInstalled -> {
|
||||||
Text(
|
Text(
|
||||||
context.getString(R.string.geode_download_title),
|
context.getString(R.string.geode_download_title),
|
||||||
@@ -871,20 +891,7 @@ fun MainScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> LaunchBlockedLabel(stringResource(R.string.game_not_found))
|
||||||
Text(
|
|
||||||
context.getString(R.string.game_not_found),
|
|
||||||
modifier = Modifier.padding(12.dp)
|
|
||||||
)
|
|
||||||
OutlinedButton(onClick = { onSettings(context) }) {
|
|
||||||
Icon(
|
|
||||||
Icons.Filled.Settings,
|
|
||||||
contentDescription = context.getString(R.string.launcher_settings_icon_alt)
|
|
||||||
)
|
|
||||||
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
|
||||||
Text(context.getString(R.string.launcher_settings))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateCard(
|
UpdateCard(
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<string name="launcher_settings_icon_alt">settings icon</string>
|
<string name="launcher_settings_icon_alt">settings icon</string>
|
||||||
<string name="launcher_retry_icon_alt">retry icon</string>
|
<string name="launcher_retry_icon_alt">retry icon</string>
|
||||||
<string name="geode_download_title">Geode is not installed.</string>
|
<string name="geode_download_title">Geode is not installed.</string>
|
||||||
|
<string name="game_outdated">A Geometry Dash update is required.</string>
|
||||||
<string name="geode_download_description">Geode is downloading. Please wait.</string>
|
<string name="geode_download_description">Geode is downloading. Please wait.</string>
|
||||||
<plurals name="automatically_load_countdown">
|
<plurals name="automatically_load_countdown">
|
||||||
<item quantity="one">Automatically launching game in %1$d second.</item>
|
<item quantity="one">Automatically launching game in %1$d second.</item>
|
||||||
|
|||||||
Reference in new issue
Block a user