Ensure only one daily challenge notification is fired per room

This commit is contained in:
Dean Herbert 2024-08-09 17:11:11 +09:00
parent 52b2d73e04
commit e146c8e230
No known key found for this signature in database

View File

@ -130,6 +130,8 @@ namespace osu.Game.Screens.Menu
}
}
private long? lastNotifiedDailyChallengeRoomId;
private void dailyChallengeChanged(ValueChangedEvent<DailyChallengeInfo?> info)
{
UpdateState();
@ -152,8 +154,11 @@ namespace osu.Game.Screens.Menu
cover.OnlineInfo = TooltipContent = room.Playlist.FirstOrDefault()?.Beatmap.BeatmapSet as APIBeatmapSet;
// We only want to notify the user if a new challenge recently went live.
if (Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 600)
if (Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 600 && room.RoomID.Value != lastNotifiedDailyChallengeRoomId)
{
lastNotifiedDailyChallengeRoomId = room.RoomID.Value;
notificationOverlay?.Post(new NewDailyChallengeNotification(room));
}
updateCountdown();
Scheduler.AddDelayed(updateCountdown, 1000, true);