-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add notification on daily challenge conclusion & start of new one #29188
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b46f3c9
Add notification on daily challenge conclusion & start of new one
bdach b77a10b
Fix tests maybe
bdach a05f810
Attempt to fix tests more
bdach 1b57a2a
Show new daily challenge notification globally
bdach d5f9173
Remove unused local variable
peppy d75c170
Merge branch 'master' into daily-challenge/better-messaging
peppy 5ebb5ad
Fix test failure due to `TestMetadataClient` providing null statistic…
peppy bdc465e
Reword notification text slightly
peppy e77489f
Allow notification of new strings
peppy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Screens; | ||
using osu.Game.Beatmaps.Drawables.Cards; | ||
using osu.Game.Online.API.Requests.Responses; | ||
using osu.Game.Online.Rooms; | ||
using osu.Game.Overlays.Notifications; | ||
using osu.Game.Screens.Menu; | ||
|
||
namespace osu.Game.Screens.OnlinePlay.DailyChallenge | ||
{ | ||
public partial class NewDailyChallengeNotification : SimpleNotification | ||
{ | ||
private readonly Room room; | ||
|
||
private BeatmapCardNano card = null!; | ||
|
||
public NewDailyChallengeNotification(Room room) | ||
{ | ||
this.room = room; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OsuGame? game) | ||
{ | ||
Text = "Today's daily challenge is here! Click here to play."; | ||
Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!)); | ||
Activated = () => | ||
{ | ||
game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]); | ||
return true; | ||
}; | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
card.Width = Content.DrawWidth; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on having this notification appear even if you aren't on the daily challenge screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See last line of OP:
I'd rather avoid accusations of us 'railroading' users into this feature, but maybe I'm overly sensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair i guess. we'll see if people request it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe only show for those who participated?
The current behavior doesn't work for people who log in straight at 0 UTC, when the button doesn't show.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly thinking the vast majority of users are not going to be annoyed by a notification once a day at a specific time of day and we should just go for it and wait for complaints, rather than the other way around.
Obviously only for the "new daily challenge" notification, not the other one.
I'm also fine with a toggle for this being added, something like "Receive notifications for game-wide events"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok well I'll have a go I guess, although now that I think about it figuring out a place to put the notification logic may prove to be a right pain in the ass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this in 1b57a2a. No toggle for now unless you think it is imperative for one to exist.
Not sure you'll like the placement, but it does work globally because of some implementation details (even if the button is offscreen, the bindable change callbacks fire, because that stuff is being invoked from
MetadataClient
which is everpresent).