diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs
index dd3abb6f81..3c463f6f0c 100644
--- a/osu.Game/Configuration/OsuConfigManager.cs
+++ b/osu.Game/Configuration/OsuConfigManager.cs
@@ -96,6 +96,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.NotifyOnUsernameMentioned, true);
SetDefault(OsuSetting.NotifyOnPrivateMessage, true);
+ SetDefault(OsuSetting.NotifyOnFriendPresenceChange, true);
// Audio
SetDefault(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
@@ -417,6 +418,7 @@ namespace osu.Game.Configuration
IntroSequence,
NotifyOnUsernameMentioned,
NotifyOnPrivateMessage,
+ NotifyOnFriendPresenceChange,
UIHoldActivationDelay,
HitLighting,
StarFountains,
diff --git a/osu.Game/Localisation/OnlineSettingsStrings.cs b/osu.Game/Localisation/OnlineSettingsStrings.cs
index 8e8c81cf59..98364a3f5a 100644
--- a/osu.Game/Localisation/OnlineSettingsStrings.cs
+++ b/osu.Game/Localisation/OnlineSettingsStrings.cs
@@ -29,6 +29,16 @@ namespace osu.Game.Localisation
///
public static LocalisableString NotifyOnPrivateMessage => new TranslatableString(getKey(@"notify_on_private_message"), @"Show a notification when you receive a private message");
+ ///
+ /// "Show notification popups when friends change status"
+ ///
+ public static LocalisableString NotifyOnFriendPresenceChange => new TranslatableString(getKey(@"notify_on_friend_presence_change"), @"Show notification popups when friends change status");
+
+ ///
+ /// "Notifications will be shown when friends go online/offline."
+ ///
+ public static LocalisableString NotifyOnFriendPresenceChangeTooltip => new TranslatableString(getKey(@"notify_on_friend_presence_change_tooltip"), @"Notifications will be shown when friends go online/offline.");
+
///
/// "Integrations"
///
@@ -84,6 +94,6 @@ namespace osu.Game.Localisation
///
public static LocalisableString HideCountryFlags => new TranslatableString(getKey(@"hide_country_flags"), @"Hide country flags");
- private static string getKey(string key) => $"{prefix}:{key}";
+ private static string getKey(string key) => $@"{prefix}:{key}";
}
}
diff --git a/osu.Game/Online/FriendPresenceNotifier.cs b/osu.Game/Online/FriendPresenceNotifier.cs
index 8fcf1a9f69..655a004d3e 100644
--- a/osu.Game/Online/FriendPresenceNotifier.cs
+++ b/osu.Game/Online/FriendPresenceNotifier.cs
@@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
+using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
@@ -38,6 +39,10 @@ namespace osu.Game.Online
[Resolved]
private OsuColour colours { get; set; } = null!;
+ [Resolved]
+ private OsuConfigManager config { get; set; } = null!;
+
+ private readonly Bindable notifyOnFriendPresenceChange = new BindableBool();
private readonly IBindableDictionary userStates = new BindableDictionary();
private readonly HashSet onlineAlertQueue = new HashSet();
private readonly HashSet offlineAlertQueue = new HashSet();
@@ -49,6 +54,8 @@ namespace osu.Game.Online
{
base.LoadComplete();
+ config.BindWith(OsuSetting.NotifyOnFriendPresenceChange, notifyOnFriendPresenceChange);
+
userStates.BindTo(metadataClient.UserStates);
userStates.BindCollectionChanged((_, args) =>
{
@@ -103,6 +110,12 @@ namespace osu.Game.Online
if (lastOnlineAlertTime == null || Time.Current - lastOnlineAlertTime < 1000)
return;
+ if (!notifyOnFriendPresenceChange.Value)
+ {
+ lastOnlineAlertTime = null;
+ return;
+ }
+
APIUser? singleUser = onlineAlertQueue.Count == 1 ? onlineAlertQueue.Single() : null;
notifications.Post(new SimpleNotification
@@ -134,6 +147,12 @@ namespace osu.Game.Online
if (lastOfflineAlertTime == null || Time.Current - lastOfflineAlertTime < 1000)
return;
+ if (!notifyOnFriendPresenceChange.Value)
+ {
+ lastOfflineAlertTime = null;
+ return;
+ }
+
notifications.Post(new SimpleNotification
{
Icon = FontAwesome.Solid.UserMinus,
diff --git a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs
index 7bd0829add..608c6ef1b2 100644
--- a/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs
@@ -29,6 +29,12 @@ namespace osu.Game.Overlays.Settings.Sections.Online
Current = config.GetBindable(OsuSetting.NotifyOnPrivateMessage)
},
new SettingsCheckbox
+ {
+ LabelText = OnlineSettingsStrings.NotifyOnFriendPresenceChange,
+ TooltipText = OnlineSettingsStrings.NotifyOnFriendPresenceChangeTooltip,
+ Current = config.GetBindable(OsuSetting.NotifyOnFriendPresenceChange),
+ },
+ new SettingsCheckbox
{
LabelText = OnlineSettingsStrings.HideCountryFlags,
Current = config.GetBindable(OsuSetting.HideCountryFlags)