From 780b4b9d1895410d7ed3ff4132c10d114a1c2ee7 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 11 Aug 2021 10:02:57 +0800 Subject: [PATCH] feature: add preference setting to enable/disable crash report --- src/Models/Issue.cs | 2 ++ src/Models/Preference.cs | 5 ++++ src/Resources/Locales/en_US.xaml | 1 + src/Resources/Locales/zh_CN.xaml | 1 + src/Views/Preference.xaml | 41 +++++++++++++++++++------------- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/Models/Issue.cs b/src/Models/Issue.cs index 01bc476a..2bdc6e29 100644 --- a/src/Models/Issue.cs +++ b/src/Models/Issue.cs @@ -24,6 +24,8 @@ namespace SourceGit.Models { /// /// public static void Create(System.Exception e) { + if (!Preference.Instance.General.EnableCrashReport) return; + try { var issue = new Issue(); issue.AccessToken = "d0d56410f13a3826b87fb0868d5a26ce"; // 这是我个人的Token,仅启用ISSUE创建功能,请不要使用 diff --git a/src/Models/Preference.cs b/src/Models/Preference.cs index 9799e926..3224a329 100644 --- a/src/Models/Preference.cs +++ b/src/Models/Preference.cs @@ -72,6 +72,11 @@ namespace SourceGit.Models { /// 启用自动拉取远程变更(每10分钟一次) /// public bool AutoFetchRemotes { get; set; } = true; + + /// + /// 是否启用崩溃上报 + /// + public bool EnableCrashReport { get; set; } = false; } /// diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index ec9d920a..02b4f1be 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -362,6 +362,7 @@ Check for update Fetch remotes automatically (need restart) Restore windows + Enable crash report (maybe include related path) GIT SETTING Install Path Input path for git.exe diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index da37676e..fabf7ce0 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -361,6 +361,7 @@ 启用检测更新 启用定时自动拉取远程更新(重启生效) 启动时恢复上次打开的仓库 + 开启崩溃上报(可能涉及上报相关路径) GIT配置 安装路径 填写git.exe所在位置 diff --git a/src/Views/Preference.xaml b/src/Views/Preference.xaml index 2968df59..62415a8d 100644 --- a/src/Views/Preference.xaml +++ b/src/Views/Preference.xaml @@ -64,6 +64,7 @@ + @@ -180,21 +181,27 @@ Grid.Row="7" Grid.Column="1" Content="{DynamicResource Text.Preference.RestoreTabs}" IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/> + + + - + @@ -217,11 +224,11 @@ - + @@ -244,36 +251,36 @@ - +