Merge pull request #16960 from peppy/beatmap-overlay-load-after-login

Fix beatmap overlay not re-fetching results after initial login
This commit is contained in:
Bartłomiej Dach 2022-02-22 23:27:49 +01:00 committed by GitHub
commit d0d0830888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -67,6 +67,8 @@ namespace osu.Game.Overlays.BeatmapListing
[Resolved]
private IAPIProvider api { get; set; }
private IBindable<APIUser> apiUser;
public BeatmapListingFilterControl()
{
RelativeSizeAxes = Axes.X;
@ -127,7 +129,7 @@ namespace osu.Game.Overlays.BeatmapListing
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider, IAPIProvider api)
{
sortControlBackground.Colour = colourProvider.Background4;
}
@ -161,6 +163,9 @@ namespace osu.Game.Overlays.BeatmapListing
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
sortDirection.BindValueChanged(_ => queueUpdateSearch());
apiUser = api.LocalUser.GetBoundCopy();
apiUser.BindValueChanged(_ => queueUpdateSearch());
}
public void TakeFocus() => searchControl.TakeFocus();
@ -190,6 +195,9 @@ namespace osu.Game.Overlays.BeatmapListing
resetSearch();
if (!api.IsLoggedIn)
return;
queryChangedDebounce = Scheduler.AddDelayed(() =>
{
resetSearch();

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Localisation;
using osu.Framework.Graphics;
@ -19,6 +20,7 @@ using osu.Game.Beatmaps.Drawables.Cards;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapListing;
using osu.Game.Resources.Localisation.Web;
@ -32,6 +34,11 @@ namespace osu.Game.Overlays
[Resolved]
private PreviewTrackManager previewTrackManager { get; set; }
[Resolved]
private IAPIProvider api { get; set; }
private IBindable<APIUser> apiUser;
private Drawable currentContent;
private Container panelTarget;
private FillFlowContainer<BeatmapCard> foundContent;
@ -93,6 +100,13 @@ namespace osu.Game.Overlays
{
base.LoadComplete();
filterControl.CardSize.BindValueChanged(_ => onCardSizeChanged());
apiUser = api.LocalUser.GetBoundCopy();
apiUser.BindValueChanged(_ =>
{
if (api.IsLoggedIn)
addContentToResultsArea(Drawable.Empty());
});
}
public void ShowWithSearch(string query)