Browse Source

🔙 Add back `_isStartupCheck` + refresh `_config` before checking

- This prevents the "no available updates" pop-up from showing up when it's an automatic check. Thank you @chenshaoju for your feedback.
- Checking pre-release checks in the menu would work on the current run now.
tags/4.3.1.0
database64128 4 years ago
parent
commit
a9c1097ac5
No known key found for this signature in database GPG Key ID: 1CA27546BEDB8B01
2 changed files with 7 additions and 1 deletions
  1. +2
    -0
      shadowsocks-csharp/Controller/Service/UpdateChecker.cs
  2. +5
    -1
      shadowsocks-csharp/View/MenuViewController.cs

+ 2
- 0
shadowsocks-csharp/Controller/Service/UpdateChecker.cs View File

@@ -54,6 +54,8 @@ namespace Shadowsocks.Controller
// delay
logger.Info($"Waiting for {millisecondsDelay}ms before checking for version update.");
await Task.Delay(millisecondsDelay);
// update _config so we would know if the user checked or unchecked pre-release checks
_config = Program.MainController.GetCurrentConfiguration();
// start
logger.Info($"Checking for version update.");
try


+ 5
- 1
shadowsocks-csharp/View/MenuViewController.cs View File

@@ -30,6 +30,7 @@ namespace Shadowsocks.View
private NotifyIcon _notifyIcon;
private Icon icon, icon_in, icon_out, icon_both, previousIcon;
private bool _isStartupCheck;
private string _urlToOpen;
private ContextMenu contextMenu1;
@@ -114,6 +115,7 @@ namespace Shadowsocks.View
}
else if (config.autoCheckUpdate)
{
_isStartupCheck = true;
Dispatcher.CurrentDispatcher.Invoke(() => updateChecker.CheckForVersionUpdate(3000));
}
}
@@ -462,6 +464,7 @@ namespace Shadowsocks.View
Configuration config = controller.GetCurrentConfiguration();
if (config.firstRun)
return;
_isStartupCheck = true;
Dispatcher.CurrentDispatcher.Invoke(() => updateChecker.CheckForVersionUpdate(3000));
}
@@ -1004,10 +1007,11 @@ namespace Shadowsocks.View
void updateChecker_CheckUpdateCompleted(object sender, EventArgs e)
{
if (updateChecker.NewReleaseZipFilename == null)
if (!_isStartupCheck && updateChecker.NewReleaseZipFilename == null)
{
ShowBalloonTip(I18N.GetString("Shadowsocks"), I18N.GetString("No update is available"), ToolTipIcon.Info, 5000);
}
_isStartupCheck = false;
}
private void UpdateUpdateMenu()


Loading…
Cancel
Save