Skip to content

Commit

Permalink
Clear all notifications before resetting BuildNotificationList
Browse files Browse the repository at this point in the history
  • Loading branch information
robinnorth committed Oct 18, 2024
1 parent 31ef271 commit 563204a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Editor/Notifications/BuildNotificationList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ public static BuildNotificationList instance
{
get
{
if (_instance == null)
_instance = new BuildNotificationList();
_instance ??= new BuildNotificationList();

return _instance;
}
}

#endregion

public List<BuildNotification> notifications = new List<BuildNotification>();
public List<BuildNotification> warnings = new List<BuildNotification>();
public List<BuildNotification> errors = new List<BuildNotification>();
public List<BuildNotification> notifications = new();
public List<BuildNotification> warnings = new();
public List<BuildNotification> errors = new();

public BuildNotificationList()
{
Expand All @@ -34,7 +33,7 @@ public BuildNotificationList()

public void AddNotification(BuildNotification notification)
{
BuildNotification entry = null;
BuildNotification entry;
switch (notification.cat)
{
case BuildNotification.Category.Error:
Expand Down Expand Up @@ -87,31 +86,35 @@ public void RefreshNotifications()

public void Remove(BuildNotification notification)
{
BuildNotification entry = null;
BuildNotification entry;
switch (notification.cat)
{
case BuildNotification.Category.Error:
entry = FindDuplicate(notification, errors);
if (entry != null)
errors.Remove(entry);
_ = errors.Remove(entry);
break;

case BuildNotification.Category.Warning:
entry = FindDuplicate(notification, warnings);
if (entry != null)
warnings.Remove(entry);
_ = warnings.Remove(entry);
break;

case BuildNotification.Category.Notification:
entry = FindDuplicate(notification, notifications);
if (entry != null)
notifications.Remove(entry);
_ = notifications.Remove(entry);
break;
}
}

public void Reset()
{
notifications.Clear();
warnings.Clear();
errors.Clear();

_instance = null;
}

Expand Down

0 comments on commit 563204a

Please sign in to comment.