From 5276300c081ce7d3cfd2042d89c7189fa9866e33 Mon Sep 17 00:00:00 2001 From: David Paiva Date: Sat, 20 Nov 2021 14:11:02 +0000 Subject: [PATCH] Added required changes. --- osu.Desktop/DiscordRichPresence.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index dd3fca095e..d72774e96f 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -97,7 +97,7 @@ private void updateStatus() presence.State = truncate(activity.Value.Status); presence.Details = truncate(getDetails(activity.Value)); - if (getOnlineID(activity.Value) != string.Empty) + if (getOnlineID(activity.Value) != null) { presence.Buttons = new Button[] { @@ -167,18 +167,14 @@ private string getDetails(UserActivity activity) return string.Empty; } - private string getOnlineID(UserActivity activity) + private int? getOnlineID(UserActivity activity) { - switch (activity) + if (activity is UserActivity.InGame game && game.BeatmapInfo.OnlineID > 0) { - case UserActivity.InGame game: - if (!(game.BeatmapInfo.OnlineID < 1)) - return game.BeatmapInfo.OnlineID.ToString(); - - return string.Empty; + return game.BeatmapInfo.OnlineID; } - return string.Empty; + return null; } protected override void Dispose(bool isDisposing)