diff --git a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs b/osu.Game.Tests/Visual/TestCaseChatDisplay.cs index c03b12bdc1..9057ec0d79 100644 --- a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs +++ b/osu.Game.Tests/Visual/TestCaseChatDisplay.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using osu.Framework.Graphics.Containers; +using osu.Game.Online.Chat; using osu.Game.Overlays; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseChatTabControl.cs b/osu.Game.Tests/Visual/TestCaseChatTabControl.cs index e530c1b72a..a1b8eaf051 100644 --- a/osu.Game.Tests/Visual/TestCaseChatTabControl.cs +++ b/osu.Game.Tests/Visual/TestCaseChatTabControl.cs @@ -15,6 +15,7 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; +using osu.Game.Overlays.Chat.Tabs; using osu.Game.Users; using OpenTK.Graphics; diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 233ed00261..ed8677097b 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -50,7 +50,7 @@ namespace osu.Game.Online.Chat private IAPIProvider api; private ScheduledDelegate fetchMessagesScheduleder; private GetMessagesRequest fetchMsgReq; - private GetPrivateMessagesRequest fetchPrivateMsgReq; + private GetPrivateMessagesRequest fetchUserMsgReq; private long? lastChannelMsgId; private long? lastUserMsgId; @@ -170,16 +170,16 @@ namespace osu.Game.Online.Chat ); - if (fetchPrivateMsgReq == null) + if (fetchUserMsgReq == null) fetchMessages( - () => new GetPrivateMessagesRequest(lastChannelMsgId), + () => new GetPrivateMessagesRequest(lastUserMsgId), messages => { if (messages == null) return; handleUserMessages(messages); - lastUserMsgId = messages.LastOrDefault()?.Id ?? lastUserMsgId; - fetchPrivateMsgReq = null; + lastUserMsgId = messages.Max(m => m.Id) ?? lastUserMsgId; + fetchUserMsgReq = null; } ); } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index cae5352739..b32585e129 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -124,6 +124,7 @@ namespace osu.Game var channelManager = new ChannelManager(); dependencies.Inject(channelManager); dependencies.Cache(channelManager); + AddInternal(channelManager); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index de241dd9c0..8132c3c7ed 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -332,7 +332,6 @@ namespace osu.Game.Overlays channelManager.CurrentChannel.ValueChanged += currentChatChanged; channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged; channelManager.AvailableChannels.CollectionChanged += (sender, args) => channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels); - Add(channelManager); } private void postMessage(TextBox textbox, bool newText)