From 622f159867d8df5ef90827707651c769faa632f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Lampron?= Date: Thu, 5 Dec 2024 10:31:13 -0500 Subject: [PATCH] CheckPledgeStatus only if the user is connected to patreon --- src/PoeLurker.Core/KeyboardLurker.cs | 6 +++++- src/PoeLurker.UI/PoeLurker.UI.csproj | 2 +- src/PoeLurker.UI/ViewModels/ShellViewModel.cs | 5 ++++- src/PoeLurker.UI/ViewModels/SplashScreenViewModel.cs | 9 ++++++--- src/PoeLurker.UI/ViewModels/TradebarViewModel.cs | 7 +++++-- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/PoeLurker.Core/KeyboardLurker.cs b/src/PoeLurker.Core/KeyboardLurker.cs index 89dc19bf..dbb705bb 100644 --- a/src/PoeLurker.Core/KeyboardLurker.cs +++ b/src/PoeLurker.Core/KeyboardLurker.cs @@ -60,7 +60,11 @@ public KeyboardLurker(int processId, SettingsService settingsService, HotkeyServ _keyboardHelper = keyboardHelper; _itemParser = new ItemParser(); - _itemParser.CheckPledgeStatus(); + if (settingsService.ConnectedToPatreon) + { + _itemParser.CheckPledgeStatus(); + } + _settingsService.OnSave += SettingsService_OnSave; _keyboardHook = new KeyboardHook(_processId); _ = _keyboardHook.InstallAsync(); diff --git a/src/PoeLurker.UI/PoeLurker.UI.csproj b/src/PoeLurker.UI/PoeLurker.UI.csproj index 78f50148..dd5f0214 100644 --- a/src/PoeLurker.UI/PoeLurker.UI.csproj +++ b/src/PoeLurker.UI/PoeLurker.UI.csproj @@ -7,7 +7,7 @@ enable true TrayIcon.ico - 2.0.0 + 2.0.1 PoeLurker diff --git a/src/PoeLurker.UI/ViewModels/ShellViewModel.cs b/src/PoeLurker.UI/ViewModels/ShellViewModel.cs index 10ef236e..822f4f7c 100644 --- a/src/PoeLurker.UI/ViewModels/ShellViewModel.cs +++ b/src/PoeLurker.UI/ViewModels/ShellViewModel.cs @@ -924,7 +924,10 @@ public Task HandleAsync(SkillTimelineMessage message, CancellationToken token) /// private async Task CheckPledgeStatus() { - await ClipboardHelper.CheckPledgeStatusAsync(); + if (_settingsService.ConnectedToPatreon) + { + await ClipboardHelper.CheckPledgeStatusAsync(); + } } private Task ShowViewModel(PoeOverlayBase overlay) diff --git a/src/PoeLurker.UI/ViewModels/SplashScreenViewModel.cs b/src/PoeLurker.UI/ViewModels/SplashScreenViewModel.cs index 0fd3a9f8..8d0a5b8a 100644 --- a/src/PoeLurker.UI/ViewModels/SplashScreenViewModel.cs +++ b/src/PoeLurker.UI/ViewModels/SplashScreenViewModel.cs @@ -44,10 +44,13 @@ public SplashscreenViewModel(SettingsViewModel settings, IEventAggregator eventA Execute.OnUIThread(async () => { - await patreonService.CheckPledgeStatus(); - if (patreonService.Pledging) + if (!settings.NotConnected) { - return; + await patreonService.CheckPledgeStatus(); + if (patreonService.Pledging) + { + return; + } } ShowPatreon = true; diff --git a/src/PoeLurker.UI/ViewModels/TradebarViewModel.cs b/src/PoeLurker.UI/ViewModels/TradebarViewModel.cs index bba717bd..8c37f1a0 100644 --- a/src/PoeLurker.UI/ViewModels/TradebarViewModel.cs +++ b/src/PoeLurker.UI/ViewModels/TradebarViewModel.cs @@ -634,8 +634,11 @@ protected override Task OnDeactivateAsync(bool close, CancellationToken token) /// protected async override Task OnActivateAsync(CancellationToken token) { - await _pushBulletService.CheckPledgeStatus(); - await _pushHoverService.CheckPledgeStatus(); + if (SettingsService.ConnectedToPatreon) + { + await _pushBulletService.CheckPledgeStatus(); + await _pushHoverService.CheckPledgeStatus(); + } SettingsService.OnSave += SettingsService_OnSave;