1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Merge pull request #3332 from smoogipoo/fix-startup-webrequests

Fix DirectOverlay performing web requests on startup
This commit is contained in:
Dean Herbert 2018-08-30 14:58:17 +09:00 committed by GitHub
commit 46099fcbef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,6 +240,15 @@ namespace osu.Game.Overlays
});
}
protected override void PopIn()
{
base.PopIn();
// Queries are allowed to be run only on the first pop-in
if (getSetsRequest == null)
Scheduler.AddOnce(updateSearch);
}
private SearchBeatmapSetsRequest getSetsRequest;
private readonly Bindable<string> currentQuery = new Bindable<string>();
@ -251,16 +260,22 @@ namespace osu.Game.Overlays
{
queryChangedDebounce?.Cancel();
if (!IsLoaded) return;
if (!IsLoaded)
return;
if (State == Visibility.Hidden)
return;
BeatmapSets = null;
ResultAmounts = null;
getSetsRequest?.Cancel();
if (api == null) return;
if (api == null)
return;
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return;
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty))
return;
previewTrackManager.StopAnyPlaying(this);