Added Support for Debug Logging

Updated a couple of variables for better memory use.
Added Support for ignoring specific streamers
Moved to using a SingletonFactory for Singlton Classes
No Longer Using MessageBox for disconnected message
Added better detection for disconnected to stop it poping with other problems
Added Window and menu option to open window to manage ignored streamers
This commit is contained in:
Martin Barker
2023-02-21 21:25:38 +00:00
parent 03b620ecec
commit 49ea2ba2a6
25 changed files with 548 additions and 208 deletions

View File

@@ -1,8 +1,10 @@
using System;
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using TwitchDesktopNotifications.JsonStructure.Helix;
namespace TwitchDesktopNotifications.Core
@@ -10,39 +12,18 @@ namespace TwitchDesktopNotifications.Core
internal class NotifyManager
{
public Boolean shouldNotify(String streamerName)
public static Boolean ShouldNotify(String streamerName)
{
return notifyAll || !DataStore.GetInstance().Store.SteamersToNotify.Streamers.Contains(streamerName);
}
public void AddStreamerToNotifyList(String streamerName)
{
DataStore.GetInstance().Store.SteamersToNotify.Streamers.Add(streamerName);
DataStore.GetInstance().Save();
}
public void RemoveStreamerToNotifyList(String streamerName)
{
DataStore.GetInstance().Store.SteamersToNotify.Streamers.Remove(streamerName);
DataStore.GetInstance().Save();
}
public void ClearListOfEnabled()
{
DataStore.GetInstance().Store.SteamersToNotify.Streamers = new List<string>();
DataStore.GetInstance().Save();
}
public bool notifyAll
{
get
{
return DataStore.GetInstance().Store.SteamersToNotify.notifyAll;
}
set {
DataStore.GetInstance().Store.SteamersToNotify.notifyAll = value;
DataStore.GetInstance().Save();
if(DataStore.GetInstance().Store.SteamersToIgnore == null || DataStore.GetInstance().Store.SteamersToIgnore.Streamers == null) {
return true;
}
return !UIStreamer.GetCreateStreamer(streamerName).IsIgnored;
}
public static void AddStreamerToIgnoreList(string streamerName)
{
UIStreamer.GetCreateStreamer(streamerName).IsIgnored = true;
DataStore.GetInstance().Save();
}
}
}