Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make BeatmapSetOverlay accept nulls everywhere #2416

Merged
merged 5 commits into from
Apr 19, 2018

Conversation

peppy
Copy link
Sponsor Member

@peppy peppy commented Apr 18, 2018

A step forward in usability of BeatmapSetOverlay. The default state now matches what you are returned to when displaying a null BeatmapInfo.

Helps with making #2350 tidy.

  • Every component in the BeatmapSetOverlay hierarchy now accepts null in its settable property.
  • Actual display update logic has been moved to updateInfo, which is also called from BDL to provide a default state.

@smoogipoo
Copy link
Contributor

Can you split this up into multiple PRs or even just multiple commits next time? This is super difficult to go through since so many files are touched.

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 19, 2018

How would you split it up? It'd just become a commit per class or class group, at which point it's the same as just reviewing a file at a time. The changes I made are basically the same in each case. Once you start reviewing you'll understand.

@smoogipoo
Copy link
Contributor

Reviewing one class or class group at a time would make this so much simpler.

The avatar change is grouped into all of this, changes to how things are displayed in SuccessRate are grouped into all of this, changes to display and interaction of things like Beatmap in ScoresContainer are grouped into all of this.

None of these components have been tested individually, so there's a lot of cases I have to go through to validate the code visually.

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 19, 2018

This is one of the reasons I want individual tests per component. Right now the whole overlay is one testable component so that's how I felt it correct to apply updates.

@smoogipoo
Copy link
Contributor

Cool, sounds like something you should've done then.

@peppy
Copy link
Sponsor Member Author

peppy commented Apr 19, 2018

Can do if you'd prefer, though it's a large time investment and the changes made here are pretty straight-forward (just moving logic to a separate method).

@@ -31,15 +32,25 @@ public BeatmapMetrics Metrics

const int rating_range = 10;

var ratings = Metrics.Ratings.Skip(1).Take(rating_range); // adjust for API returning weird empty data at 0.
if (metrics == null)

This comment was marked as off-topic.

@@ -125,6 +120,15 @@ protected override void Update()

private void updatePreviewTrack(bool playing)
{
if (playing && BeatmapSet == null)

This comment was marked as off-topic.

This comment was marked as off-topic.

clickableArea.Action = () => profile?.ShowUser(avatar.User);
clickableArea.Action = () =>
{
if (avatar.User != null) profile?.ShowUser(avatar.User);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@@ -47,9 +47,7 @@ public TestCaseBeatmapScoresContainer()
AddStep("scores pack 1", () => scoresContainer.Scores = scores);
AddStep("scores pack 2", () => scoresContainer.Scores = anotherScores);
AddStep("only top score", () => scoresContainer.Scores = new[] { topScore });
AddStep("remove scores", scoresContainer.CleanAllScores);
AddStep("turn on loading", () => scoresContainer.IsLoading = true);
AddStep("turn off loading", () => scoresContainer.IsLoading = false);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.


private readonly ScrollContainer scroll;

private BeatmapSetInfo beatmapSet;

public BeatmapSetInfo BeatmapSet

This comment was marked as off-topic.

@smoogipoo
Copy link
Contributor

◕‿◕ sure why not

@smoogipoo smoogipoo merged commit 3824d61 into ppy:master Apr 19, 2018
@peppy
Copy link
Sponsor Member Author

peppy commented Apr 19, 2018

At very least I think this is a step in the right direction.

@peppy peppy deleted the beatmap-set-overlay-nullability branch June 21, 2018 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants