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

Show daily challenge intro screen once per session #29542

Merged

Conversation

frenzibyte
Copy link
Member

@frenzibyte frenzibyte commented Aug 20, 2024

CleanShot.2024-08-21.at.03.39.58-converted.mp4

Adding tests for this one will be a bit bothersome, but I can do it on request.

Comment on lines 155 to 156
// force showing intro on the first time when a new daily challenge is up.
statics.SetValue(Static.DailyChallengeIntroPlayed, false);
Copy link
Collaborator

@bdach bdach Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this reset works as intended.

  1. Log in
  2. Go to daily challenge, intro plays
  3. Exit daily challenge, log out and back in again
  4. Go to daily challenge, intro plays again

This is happening because daily challenge room ID resets to null when logging out and is received from the server afresh on login. This'll also happen when the user's connection drops out.

To make this work you probably want to store the room ID here or something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be fine for it to play again after a logout / login.

Imagine the case of a shared PC where osu! is left running. I'd expect each user to see it once.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but as mentioned this will also happen on connection drop-outs which is not desired.

@@ -461,6 +464,8 @@ private void beginAnimation()
{
Schedule(() =>
{
statics.SetValue(Static.DailyChallengeIntroPlayed, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this flag being set at the very end of the animation rather than at the start already.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagined some users might find it more convenient to press the daily challenge screen to intro the screen then immediately hit back then go again, and I don't know if I want to allow that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @peppy

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be set after playing out.

I imagined some users might find it more convenient to press the daily challenge screen to intro the screen then immediately hit back then go again, and I don't know if I want to allow that.

Sounds like really bad UX. If users hate the intro that much then we've done something wrong. We don't create hacky UX workaround like this intentionally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's basically what I'm trying to say, that we don't want that to happen.

Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented.

@pull-request-size pull-request-size bot added size/L and removed size/S labels Aug 21, 2024
@peppy peppy self-requested a review August 22, 2024 05:56
Seems like some bad copy-paste in the past. Most of this is already
being done in `TestSceneDailyChallenge`.
@peppy peppy force-pushed the show-daily-challenge-intro-once-per-session branch from 105daeb to 9b9986b Compare August 22, 2024 06:15
@@ -71,6 +72,7 @@ public void TestDailyChallengeButton()
NotificationOverlay notificationOverlay = null!;
DependencyProvidingContainer buttonContainer = null!;

AddStep("set intro played flag", () => Dependencies.Get<SessionStatics>().SetValue(Static.DailyChallengeIntroPlayed, true));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split this out into an isolated test rather than shoving more and more in such a weird place.

I've started you off in 9b9986b (my test intentionally fails, you can get it working). Once done you can remove the tests in here as they are not related to menu buttons.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't bother splitting the test since all of those reflect on the DailyChallengeButton itself, but sure.

if (source.CurrentPlaylistItem.Value != null)
{
result.CurrentPlaylistItem.Value = result.CurrentPlaylistItem.Value.With(new Optional<IBeatmapInfo>(source.CurrentPlaylistItem.Value.Beatmap));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentary for other readers: normally you'd expect such code to skip the explicit Optional<T> construction because Optional<T> defines an implicit conversion from T, but in this instance that implicit conversion cannot be applied because here T is IBeatmapInfo and the language spec forbids such cases:

For a given source type $S$ and target type $T$, if $S$ or $T$ are nullable value types, let $S_0$ and $T_0$ refer to their underlying types; otherwise, $S_0$ and $T_0$ are equal to $S$ and $T$ respectively. A class or struct is permitted to declare a conversion from a source type $S$ to a target type $T$ only if all of the following are true:

  • $S_0$ and $T_0$ are different types.
  • Either $S_0$ or $T_0$ is the instance type of the class or struct that contains the operator declaration.
  • Neither $S_0$ nor $T_0$ is an interface_type.
  • Excluding user-defined conversions, a conversion does not exist from $S$ to $T$ or from $T$ to $S$.

(source: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/conversions#1052-permitted-user-defined-conversions)

@bdach bdach requested a review from peppy August 27, 2024 07:17
@bdach bdach added the next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! label Aug 30, 2024
@peppy peppy merged commit e79604c into ppy:master Sep 1, 2024
13 checks passed
@frenzibyte frenzibyte deleted the show-daily-challenge-intro-once-per-session branch September 1, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:daily-challenge next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! size/L type:behavioural
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Daily Challenge Intro Always Plays
3 participants