mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Fix regression in android build parsing behaviour
This commit is contained in:
parent
66544aa72a
commit
3f1b9edabe
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
using osu.Game;
|
||||
using osu.Game.Updater;
|
||||
|
||||
@ -18,9 +19,32 @@ namespace osu.Android
|
||||
|
||||
try
|
||||
{
|
||||
// todo: needs checking before play store redeploy.
|
||||
string versionName = packageInfo.VersionName;
|
||||
// undo play store version garbling
|
||||
// We store the osu! build number in the "VersionCode" field to better support google play releases.
|
||||
// If we were to use the main build number, it would require a new submission each time (similar to TestFlight).
|
||||
// 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)));
|
||||
}
|
||||
catch
|
||||
|
Loading…
Reference in New Issue
Block a user