From c8d276281ada839a37ab6eb484c36b9b7772a0d1 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 7 Nov 2023 15:49:11 -0800 Subject: [PATCH] Fix flags not showing on kudosu rankings The `country` attribute is optional and not included in the kudosu rankings response so use `country_code` instead. --- osu.Game/Online/API/Requests/Responses/APIUser.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index 7c4093006d..2ee66453cf 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -34,20 +34,15 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"previous_usernames")] public string[] PreviousUsernames; - private CountryCode? countryCode; + [JsonProperty(@"country_code")] + private string countryCodeString; public CountryCode CountryCode { - get => countryCode ??= (Enum.TryParse(country?.Code, out CountryCode result) ? result : default); - set => countryCode = value; + get => Enum.TryParse(countryCodeString, out CountryCode result) ? result : CountryCode.Unknown; + set => countryCodeString = value.ToString(); } -#pragma warning disable 649 - [CanBeNull] - [JsonProperty(@"country")] - private Country country; -#pragma warning restore 649 - public readonly Bindable Status = new Bindable(); public readonly Bindable Activity = new Bindable();