mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Fix regression in android build parsing behaviour
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Android.App;
|
using Android.App;
|
||||||
|
using Android.OS;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
|
|
||||||
@ -18,9 +19,32 @@ namespace osu.Android
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// todo: needs checking before play store redeploy.
|
// We store the osu! build number in the "VersionCode" field to better support google play releases.
|
||||||
string versionName = packageInfo.VersionName;
|
// If we were to use the main build number, it would require a new submission each time (similar to TestFlight).
|
||||||
// undo play store version garbling
|
// In order to do this, we should split it up and pad the numbers to still ensure sequential increase over time.
|
||||||
|
//
|
||||||
|
// We also need to be aware that older SDK versions store this as a 32bit int.
|
||||||
|
//
|
||||||
|
// Basic conversion format (as done in Fastfile): 2020.606.0 -> 202006060
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/52977079/android-sdk-28-versioncode-in-packageinfo-has-been-deprecated
|
||||||
|
string versionName = string.Empty;
|
||||||
|
|
||||||
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
||||||
|
{
|
||||||
|
versionName = packageInfo.LongVersionCode.ToString();
|
||||||
|
versionName = versionName.Substring(versionName.Length - 9);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
// this is required else older SDKs will report missing method exception.
|
||||||
|
versionName = packageInfo.VersionCode.ToString();
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
}
|
||||||
|
|
||||||
|
// undo play store version garbling (as mentioned above).
|
||||||
return new Version(int.Parse(versionName.Substring(0, 4)), int.Parse(versionName.Substring(4, 4)), int.Parse(versionName.Substring(8, 1)));
|
return new Version(int.Parse(versionName.Substring(0, 4)), int.Parse(versionName.Substring(4, 4)), int.Parse(versionName.Substring(8, 1)));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
Reference in New Issue
Block a user