add version support range

This commit is contained in:
qimiko committed 2024-06-19 03:40:00 -07:00
1 parent d21ab708dc
commit a562f5ec75
4 files changed
+6 -3

No files matched your search

@@ -172,7 +172,7 @@ fun MainScreen(
GamePackageUtils.getGameVersionCode(context.packageManager)
}
if (gdVersion < Constants.SUPPORTED_VERSION_CODE) {
if (gdVersion < Constants.SUPPORTED_VERSION_CODE_MIN) {
val versionName = remember {
GamePackageUtils.getUnifiedVersionName(context.packageManager)
}
@@ -63,10 +63,11 @@ fun UpdateWarning(inSafeMode: Boolean = false, onDismiss: () -> Unit) {
preferenceKey = PreferenceUtils.Key.DISMISSED_GJ_UPDATE
)
val onUnsupportedVersion = gdVersionCode < Constants.SUPPORTED_VERSION_CODE_MIN || gdVersionCode > Constants.SUPPORTED_VERSION_CODE
val canDismissRelease = gdVersionCode >= Constants.SUPPORTED_VERSION_CODE
val shouldDismiss = canDismissRelease && gdVersionCode == lastDismissedVersion
if (gdVersionCode != Constants.SUPPORTED_VERSION_CODE && !shouldDismiss) {
if (onUnsupportedVersion && !shouldDismiss) {
AlertDialog(
icon = {
Icon(
@@ -143,7 +143,7 @@ class LaunchViewModel(private val application: Application): ViewModel() {
return _uiState.emit(LaunchUIState.Cancelled(LaunchCancelReason.LAST_LAUNCH_CRASHED))
}
if (GamePackageUtils.getGameVersionCode(packageManager) < Constants.SUPPORTED_VERSION_CODE) {
if (GamePackageUtils.getGameVersionCode(packageManager) < Constants.SUPPORTED_VERSION_CODE_MIN) {
return _uiState.emit(LaunchUIState.Cancelled(LaunchCancelReason.GAME_OUTDATED))
}
@@ -13,6 +13,8 @@ object Constants {
@SuppressLint("SdCardPath")
const val GJ_DATA_DIR = "/data/data/${PACKAGE_NAME}"
const val SUPPORTED_VERSION_CODE_MIN = 38L
const val SUPPORTED_VERSION_CODE = 39L
const val SUPPORTED_VERSION_STRING = "2.2.142"
}