mirror of https://github.com/ppy/osu
Remove nullability of DI dependencies and fix incorrect load order
This commit is contained in:
parent
139401a04a
commit
3d645608eb
|
@ -24,13 +24,13 @@ namespace osu.Game.Online.Chat
|
|||
/// </summary>
|
||||
public class MessageNotifier : Component
|
||||
{
|
||||
[Resolved(CanBeNull = true)]
|
||||
private NotificationOverlay notificationOverlay { get; set; }
|
||||
[Resolved]
|
||||
private NotificationOverlay notifications { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
[Resolved]
|
||||
private ChatOverlay chatOverlay { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
[Resolved]
|
||||
private ChannelManager channelManager { get; set; }
|
||||
|
||||
private Bindable<bool> notifyOnMention;
|
||||
|
@ -81,7 +81,7 @@ private void newMessagesArrived(IEnumerable<Message> messages)
|
|||
}
|
||||
|
||||
// Only send notifications, if ChatOverlay and the target channel aren't visible.
|
||||
if (chatOverlay?.IsPresent == true && channelManager.CurrentChannel.Value == channel)
|
||||
if (chatOverlay.IsPresent && channelManager.CurrentChannel.Value == channel)
|
||||
return;
|
||||
|
||||
foreach (var message in messages.OrderByDescending(m => m.Id))
|
||||
|
@ -115,9 +115,7 @@ private bool checkForPMs(Channel channel, Message message)
|
|||
if (channel.Id != message.ChannelId)
|
||||
throw new ArgumentException("The provided channel doesn't match with the channel id provided by the message parameter.", nameof(channel));
|
||||
|
||||
var notification = new PrivateMessageNotification(message.Sender.Username, channel);
|
||||
notificationOverlay?.Post(notification);
|
||||
|
||||
notifications.Post(new PrivateMessageNotification(message.Sender.Username, channel));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -135,9 +133,7 @@ private bool checkForMentions(Channel channel, Message message, string username)
|
|||
if (channel.Id != message.ChannelId)
|
||||
throw new ArgumentException("The provided channel doesn't match with the channel id provided by the message parameter.", nameof(channel));
|
||||
|
||||
var notification = new MentionNotification(message.Sender.Username, channel);
|
||||
notificationOverlay?.Post(notification);
|
||||
|
||||
notifications.Post(new MentionNotification(message.Sender.Username, channel));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -726,8 +726,8 @@ protected override void LoadComplete()
|
|||
loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true);
|
||||
var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true);
|
||||
loadComponentSingleFile(new MessageNotifier(), AddInternal, true);
|
||||
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(new MessageNotifier(), AddInternal, true);
|
||||
loadComponentSingleFile(Settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true);
|
||||
var changelogOverlay = loadComponentSingleFile(new ChangelogOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true);
|
||||
|
|
Loading…
Reference in New Issue