From cec3d986a76d97126863dbacbe7058786c4d2013 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Mon, 6 Mar 2017 01:04:51 +0000 Subject: [PATCH 01/35] add local buil script --- Deploy/local_build.ps1 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Deploy/local_build.ps1 diff --git a/Deploy/local_build.ps1 b/Deploy/local_build.ps1 new file mode 100644 index 0000000000..9dd7582b19 --- /dev/null +++ b/Deploy/local_build.ps1 @@ -0,0 +1,4 @@ +New-Alias nuget.exe ".\packages\NuGet.CommandLine.*\tools\NuGet.exe" +$env:APPVEYOR_BUILD_FOLDER = Convert-Path . +$env:APPVEYOR_BUILD_VERSION = "1.2.0" +& .\Deploy\squirrel_installer.ps1 \ No newline at end of file From e66f7a206e690ada4661e8dc34fecf7a08b7336b Mon Sep 17 00:00:00 2001 From: bao-qian Date: Mon, 6 Mar 2017 01:30:47 +0000 Subject: [PATCH 02/35] Add new version popup --- Wox.Core/Updater.cs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Wox.Core/Updater.cs b/Wox.Core/Updater.cs index e6ea1c7933..b9cae090fe 100644 --- a/Wox.Core/Updater.cs +++ b/Wox.Core/Updater.cs @@ -4,9 +4,12 @@ using System.Net; using System.Net.Http; using System.Net.Sockets; using System.Threading.Tasks; +using System.Windows; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Squirrel; +using Wox.Core.Resource; +using Wox.Infrastructure; using Wox.Infrastructure.Http; using Wox.Infrastructure.Logger; @@ -22,11 +25,24 @@ namespace Wox.Core try { - const string url = Infrastructure.Constant.Github; - // todo 5/9 the return value of UpdateApp() is NULL, fucking useless! + const string url = Constant.Github; + // UpdateApp() will return value only if the app is squirrel installed using (var m = await UpdateManager.GitHubUpdateManager(url, urlDownloader: d)) { - await m.UpdateApp(); + var e = await m.CheckForUpdate().NonNull(); + var fe = e.FutureReleaseEntry; + var ce = e.CurrentlyInstalledVersion; + if (fe.Version > ce.Version) + { + var t = NewVersinoTips(fe.Version.ToString()); + MessageBox.Show(t); + + await m.DownloadReleases(e.ReleasesToApply); + await m.ApplyReleases(e); + await m.CreateUninstallerRegistryEntry(); + + Log.Info($"|Updater.UpdateApp|Future Release <{fe.Formatted()}>"); + } } } catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException) @@ -99,5 +115,13 @@ namespace Wox.Core var newVersion = version.Replace("v", ".").Replace(".", "").Replace("*", ""); return int.Parse(newVersion); } + + public static string NewVersinoTips(string version) + { + var translater = InternationalizationManager.Instance; + var tips = string.Format(translater.GetTranslation("newVersionTips"), version); + return tips; + } + } } From c41035058a7935ecc28a5059f6f19ac2ee98cfbb Mon Sep 17 00:00:00 2001 From: bao-qian Date: Mon, 6 Mar 2017 01:54:06 +0000 Subject: [PATCH 03/35] Merge update logic #1266 --- Wox.Core/Updater.cs | 57 +------------------------ Wox/SettingWindow.xaml | 2 - Wox/SettingWindow.xaml.cs | 12 +----- Wox/ViewModel/SettingWindowViewModel.cs | 13 +----- 4 files changed, 3 insertions(+), 81 deletions(-) diff --git a/Wox.Core/Updater.cs b/Wox.Core/Updater.cs index b9cae090fe..cf758c152c 100644 --- a/Wox.Core/Updater.cs +++ b/Wox.Core/Updater.cs @@ -1,12 +1,9 @@ using System; -using System.Diagnostics; using System.Net; using System.Net.Http; using System.Net.Sockets; using System.Threading.Tasks; using System.Windows; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Squirrel; using Wox.Core.Resource; using Wox.Infrastructure; @@ -64,59 +61,7 @@ namespace Wox.Core } } - - public static async Task NewVersion() - { - const string githubAPI = @"https://api.github.com/repos/wox-launcher/wox/releases/latest"; - - string response; - try - { - response = await Http.Get(githubAPI); - } - catch (WebException e) - { - Log.Exception("|Updater.NewVersion|Can't connect to github api to check new version", e); - return string.Empty; - } - - if (!string.IsNullOrEmpty(response)) - { - JContainer json; - try - { - json = (JContainer)JsonConvert.DeserializeObject(response); - } - catch (JsonSerializationException e) - { - Log.Exception("|Updater.NewVersion|can't parse response", e); - return string.Empty; - } - var version = json?["tag_name"]?.ToString(); - if (!string.IsNullOrEmpty(version)) - { - return version; - } - else - { - Log.Warn("|Updater.NewVersion|Can't find tag_name from Github API response"); - return string.Empty; - } - } - else - { - Log.Warn("|Updater.NewVersion|Can't get response from Github API"); - return string.Empty; - } - } - - public static int NumericVersion(string version) - { - var newVersion = version.Replace("v", ".").Replace(".", "").Replace("*", ""); - return int.Parse(newVersion); - } - - public static string NewVersinoTips(string version) + private static string NewVersinoTips(string version) { var translater = InternationalizationManager.Instance; var tips = string.Format(translater.GetTranslation("newVersionTips"), version); diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 0e0d8ed60d..35b02cebda 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -384,8 +384,6 @@