From 8ad258f42676b053083d467e5cc0ddee080ebd4f Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Tue, 5 Mar 2019 17:34:23 +0800 Subject: [PATCH 1/2] only check IsLoggedIn after requesting scores --- osu.Game/Online/Leaderboards/Leaderboard.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 38df0efd6f..2c19b939e7 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -213,12 +213,6 @@ namespace osu.Game.Online.Leaderboards pendingUpdateScores?.Cancel(); pendingUpdateScores = Schedule(() => { - if (api?.IsLoggedIn != true) - { - PlaceholderState = PlaceholderState.NotLoggedIn; - return; - } - PlaceholderState = PlaceholderState.Retrieving; loading.Show(); @@ -231,6 +225,12 @@ namespace osu.Game.Online.Leaderboards if (getScoresRequest == null) return; + if (api?.IsLoggedIn != true) + { + PlaceholderState = PlaceholderState.NotLoggedIn; + return; + } + getScoresRequest.Failure += e => Schedule(() => { if (e is OperationCanceledException) From f98d55531fa4a7cf57c9e8f07858c06ce367cf8f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Mar 2019 18:48:59 +0900 Subject: [PATCH 2/2] Add documentation for FetchScores --- osu.Game/Online/Leaderboards/Leaderboard.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 2c19b939e7..f5b6e185c7 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -243,6 +243,11 @@ namespace osu.Game.Online.Leaderboards }); } + /// + /// Performs a fetch/refresh of scores to be displayed. + /// + /// A callback which should be called when fetching is completed. Scheduling is not required. + /// An responsible for the fetch operation. This will be queued and performed automatically. protected abstract APIRequest FetchScores(Action> scoresCallback); private Placeholder currentPlaceholder;