Skip to content

Commit

Permalink
Fix flag reset on connection dropouts
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Aug 21, 2024
1 parent a669c53 commit 922814f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions osu.Game/Screens/Menu/DailyChallengeButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected override void Update()
}
}

private long? lastNotifiedDailyChallengeRoomId;
private long? lastDailyChallengeRoomID;

private void dailyChallengeChanged(ValueChangedEvent<DailyChallengeInfo?> _)
{
Expand All @@ -152,19 +152,19 @@ private void dailyChallengeChanged(ValueChangedEvent<DailyChallengeInfo?> _)

roomRequest.Success += room =>
{
// force showing intro on the first time when a new daily challenge is up.
statics.SetValue(Static.DailyChallengeIntroPlayed, false);
Room = room;
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 (room.StartDate.Value != null
&& Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 1800
&& room.RoomID.Value != lastNotifiedDailyChallengeRoomId)
if (room.StartDate.Value != null && room.RoomID.Value != lastDailyChallengeRoomID)
{
lastNotifiedDailyChallengeRoomId = room.RoomID.Value;
notificationOverlay?.Post(new NewDailyChallengeNotification(room));
lastDailyChallengeRoomID = room.RoomID.Value;
// new challenge is live, reset intro played static.
statics.SetValue(Static.DailyChallengeIntroPlayed, false);
// we only want to notify the user if the new challenge just went live.
if (Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 1800)
notificationOverlay?.Post(new NewDailyChallengeNotification(room));
}
updateCountdown();
Expand Down

0 comments on commit 922814f

Please sign in to comment.