Construct notifications client inside ChannelManager

This commit is contained in:
Dan Balasescu 2022-11-04 18:51:00 +09:00
parent 72745656e7
commit fa18b5f701
8 changed files with 10 additions and 13 deletions

View File

@ -151,7 +151,7 @@ namespace osu.Game.Tests.Chat
public ChannelManagerContainer(IAPIProvider apiProvider)
{
InternalChild = ChannelManager = new ChannelManager(apiProvider, apiProvider.GetNotificationsConnector());
InternalChild = ChannelManager = new ChannelManager(apiProvider);
}
}
}

View File

@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.Online
{
linkColour = colours.Blue;
var chatManager = new ChannelManager(API, API.GetNotificationsConnector());
var chatManager = new ChannelManager(API);
BindableList<Channel> availableChannels = (BindableList<Channel>)chatManager.AvailableChannels;
availableChannels.Add(new Channel { Name = "#english" });
availableChannels.Add(new Channel { Name = "#japanese" });

View File

@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online
RelativeSizeAxes = Axes.Both,
CachedDependencies = new (Type, object)[]
{
(typeof(ChannelManager), channelManager = new ChannelManager(API, API.GetNotificationsConnector())),
(typeof(ChannelManager), channelManager = new ChannelManager(API)),
},
Children = new Drawable[]
{

View File

@ -250,7 +250,7 @@ namespace osu.Game.Tests.Visual.Online
public TestContainer(IAPIProvider api, Channel[] channels)
{
this.channels = channels;
ChannelManager = new ChannelManager(api, api.GetNotificationsConnector());
ChannelManager = new ChannelManager(api);
}
[BackgroundDependencyLoader]

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Online
{
var api = parent.Get<IAPIProvider>();
Add(channelManager = new ChannelManager(api, api.GetNotificationsConnector()));
Add(channelManager = new ChannelManager(api));
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tournament.Components
if (manager == null)
{
AddInternal(manager = new ChannelManager(api, api.GetNotificationsConnector()));
AddInternal(manager = new ChannelManager(api));
Channel.BindTo(manager.CurrentChannel);
}

View File

@ -74,10 +74,11 @@ namespace osu.Game.Online.Chat
private bool channelsInitialised;
private ScheduledDelegate ackDelegate;
public ChannelManager(IAPIProvider api, NotificationsClientConnector connector)
public ChannelManager(IAPIProvider api)
{
this.api = api;
this.connector = connector;
connector = api.GetNotificationsConnector();
CurrentChannel.ValueChanged += currentChannelChanged;
}

View File

@ -44,7 +44,6 @@ using osu.Game.Localisation;
using osu.Game.Online;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Chat;
using osu.Game.Online.Notifications;
using osu.Game.Overlays;
using osu.Game.Overlays.Music;
using osu.Game.Overlays.Notifications;
@ -84,7 +83,6 @@ namespace osu.Game
private ChatOverlay chatOverlay;
private ChannelManager channelManager;
private NotificationsClientConnector notificationsClient;
[NotNull]
protected readonly NotificationOverlay Notifications = new NotificationOverlay();
@ -680,7 +678,6 @@ namespace osu.Game
{
base.Dispose(isDisposing);
SentryLogger.Dispose();
notificationsClient.Dispose();
}
protected override IDictionary<FrameworkSetting, object> GetFrameworkConfigDefaults()
@ -758,7 +755,6 @@ namespace osu.Game
BackButton.Receptor receptor;
dependencies.CacheAs(idleTracker = new GameIdleTracker(6000));
dependencies.CacheAs(notificationsClient = API.GetNotificationsConnector());
var sessionIdleTracker = new GameIdleTracker(300000);
sessionIdleTracker.IsIdle.BindValueChanged(idle =>
@ -885,7 +881,7 @@ namespace osu.Game
loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true);
loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true);
var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true);
loadComponentSingleFile(channelManager = new ChannelManager(API, notificationsClient), AddInternal, true);
loadComponentSingleFile(channelManager = new ChannelManager(API), AddInternal, true);
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true);
loadComponentSingleFile(new MessageNotifier(), AddInternal, true);
loadComponentSingleFile(Settings = new SettingsOverlay(), leftFloatingOverlayContent.Add, true);