Skip to content

Commit

Permalink
支持忽略更新版本
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed May 6, 2023
1 parent de0aff9 commit 03d19d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/BiliLite.UWP/Helpers/SettingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ public class Other
/// 保护日志敏感信息
/// </summary>
public const string PROTECT_LOG_INFO = "protectLogInfo";

public const string IGNORE_VERSION = "ignoreVersion";
}
}
}
9 changes: 8 additions & 1 deletion src/BiliLite.UWP/Helpers/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ public static async Task CheckVersion()
{
var result = await new GitApi().CheckUpdate().Request();
var ver = JsonConvert.DeserializeObject<NewVersion>(result.results);
var ignoreVersion = SettingHelper.GetValue(SettingHelper.Other.IGNORE_VERSION, "");
if (ignoreVersion.Equals(ver.version)) return;
var num = $"{SystemInformation.ApplicationVersion.Major}{SystemInformation.ApplicationVersion.Minor.ToString("00")}{SystemInformation.ApplicationVersion.Build.ToString("00")}";
var v = int.Parse(num);
if (ver.version_num > v)
Expand All @@ -318,12 +320,17 @@ public static async Task CheckVersion()
});
dialog.Content = markdownText;
dialog.PrimaryButtonText = "查看详情";
dialog.SecondaryButtonText = "忽略";
dialog.CloseButtonText = "取消";
dialog.SecondaryButtonText = "忽略该版本";

dialog.PrimaryButtonClick += new Windows.Foundation.TypedEventHandler<ContentDialog, ContentDialogButtonClickEventArgs>(async (sender, e) =>
{
await Windows.System.Launcher.LaunchUriAsync(new Uri(ver.url));
});
dialog.SecondaryButtonClick += (sender, e) =>
{
SettingHelper.SetValue(SettingHelper.Other.IGNORE_VERSION, ver.version);
};
await dialog.ShowAsync();
}
}
Expand Down

0 comments on commit 03d19d4

Please sign in to comment.