From c768b1750e715091504fe9d866013f6a6d44ac22 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 17 Dec 2024 10:26:35 +0800 Subject: [PATCH] feature: use `-p:DisableUpdateDetection=true` to disable built-in update detection feature (#819) --- src/App.Commands.cs | 12 ++++++++++++ src/App.axaml | 2 +- src/App.axaml.cs | 2 ++ src/SourceGit.csproj | 4 ++++ src/Views/Launcher.axaml | 4 ++-- src/Views/Preference.axaml | 4 +++- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/App.Commands.cs b/src/App.Commands.cs index 8a485029..18016a1c 100644 --- a/src/App.Commands.cs +++ b/src/App.Commands.cs @@ -25,6 +25,18 @@ namespace SourceGit private Action _action = null; } + public static bool IsCheckForUpdateCommandVisible + { + get + { + #if DISABLE_UPDATE_DETECTION + return false; + #else + return true; + #endif + } + } + public static readonly Command OpenPreferenceCommand = new Command(_ => OpenDialog(new Views.Preference())); public static readonly Command OpenHotkeysCommand = new Command(_ => OpenDialog(new Views.Hotkeys())); public static readonly Command OpenAppDataDirCommand = new Command(_ => Native.OS.OpenInFileManager(Native.OS.DataDir)); diff --git a/src/App.axaml b/src/App.axaml index 0f40031d..55aacb89 100644 --- a/src/App.axaml +++ b/src/App.axaml @@ -33,7 +33,7 @@ - + diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 0615724a..3d1547c9 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -548,9 +548,11 @@ namespace SourceGit _launcher = new ViewModels.Launcher(startupRepo); desktop.MainWindow = new Views.Launcher() { DataContext = _launcher }; + #if !DISABLE_UPDATE_DETECTION var pref = ViewModels.Preference.Instance; if (pref.ShouldCheck4UpdateOnStartup()) Check4Update(); + #endif } private ViewModels.Launcher _launcher = null; diff --git a/src/SourceGit.csproj b/src/SourceGit.csproj index 32f68d03..89893a39 100644 --- a/src/SourceGit.csproj +++ b/src/SourceGit.csproj @@ -26,6 +26,10 @@ link + + $(DefineConstants);DISABLE_UPDATE_DETECTION + + diff --git a/src/Views/Launcher.axaml b/src/Views/Launcher.axaml index d37cf928..a0691c4c 100644 --- a/src/Views/Launcher.axaml +++ b/src/Views/Launcher.axaml @@ -51,12 +51,12 @@ - + - + diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index 0ed598c2..6adbaca4 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:s="using:SourceGit" xmlns:m="using:SourceGit.Models" xmlns:c="using:SourceGit.Converters" xmlns:vm="using:SourceGit.ViewModels" @@ -45,7 +46,7 @@ - +