From e5ec6b35ceaa15b7f185206742b27596eef2d5cb Mon Sep 17 00:00:00 2001 From: Fabian Sauter Date: Tue, 27 Jul 2021 18:30:39 +0200 Subject: [PATCH] Fixed loading accounts when initializing push --- Push/Classes/PushManager.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Push/Classes/PushManager.cs b/Push/Classes/PushManager.cs index 2dc238f6..e2c9677e 100644 --- a/Push/Classes/PushManager.cs +++ b/Push/Classes/PushManager.cs @@ -8,6 +8,7 @@ using Push.Classes.Events; using Push.Classes.Messages; using Storage.Classes; +using Storage.Classes.Contexts; using Windows.Networking.PushNotifications; using XMPP_API.Classes.Network; using XMPP_API.Classes.Network.TCP; @@ -79,7 +80,11 @@ private ushort GetServerPort() /// private static int GetAccountsHash() { - IEnumerable accounts = ConnectionHandler.INSTANCE.GetClients().Select(x => x.client.dbAccount.bareJid); + List accounts; + using (MainDbContext ctx = new MainDbContext()) + { + accounts = ctx.Accounts.Select(a => a.bareJid).ToList(); + } // The last bit always indicates push enabled: return unchecked(GetOrderIndependentHashCode(accounts) << 1) ^ Settings.GetSettingBoolean(SettingsConsts.PUSH_ENABLED).GetHashCode(); }