Forráskód Böngészése

Start integrating new API client

Antony Male 10 éve
szülő
commit
d6f981f0f8

+ 16 - 11
server/version_check.php

@@ -63,32 +63,37 @@ function get_with_wildcard($src, $value, $default = null)
 }
 
 $versions = [
-   '1.2.4' => [
-      '*' => [
-         'url' => ['*' => 'http://www.google.co.uk'],
+   '1.0.11' => [
+      'installed' => [
+         'direct_download_url' => [
+            'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.11/SyncTrayzorSetup-x64.exe',
+            'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.11/SyncTrayzorSetup-x86.exe'
+         ],
       ],
+      'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v1.0.11',
       'release_notes' => "These\nare some release notes",
    ],
 ];
 
 $upgrades = [
-   '1.2.3' => ['to' => '1.2.4', 'formatter' => '1'],
+   '1.0.10' => ['to' => '1.0.11', 'formatter' => '1'],
 ];
 
 $response_formatters = [
    '1' => function($arch, $variant, $to_version, $to_version_info, $overrides)
    {
       $variant_info = get_with_wildcard($to_version_info, $variant);
-      $url = get_with_wildcard($variant_info['url'], $arch);
+      $direct_download_url = get_with_wildcard($variant_info['direct_download_url'], $arch);
 
       $data = [];
-      if ($url != null)
+      if ($direct_download_url != null)
       {
-	 $data = [
-	    'version' => $to_version,
-	    'url' => $url,
-	    'release_notes' => isset($overrides['release_notes']) ? $overrides['release_notes'] : $to_version_info['release_notes'],
-	 ];
+         $data = [
+            'version' => $to_version,
+            'direct_download_url' => $direct_download_url,
+            'release_page_url' => $to_version_info['release_page_url'],
+            'release_notes' => isset($overrides['release_notes']) ? $overrides['release_notes'] : $to_version_info['release_notes'],
+         ];
       }
 
       return $data;

+ 2 - 3
src/SyncTrayzor/Bootstrapper.cs

@@ -45,7 +45,6 @@ namespace SyncTrayzor
             builder.Bind<ISyncThingConnectionsWatcherFactory>().To<SyncThingConnectionsWatcherFactory>();
             builder.Bind<INotifyIconManager>().To<NotifyIconManager>().InSingletonScope();
             builder.Bind<IWatchedFolderMonitor>().To<WatchedFolderMonitor>().InSingletonScope();
-            builder.Bind<IGithubApiClient>().To<GithubApiClient>().InSingletonScope();
             builder.Bind<IUpdateManager>().To<UpdateManager>().InSingletonScope();
             builder.Bind<IUpdateChecker>().To<UpdateChecker>();
             builder.Bind<IUpdatePromptProvider>().To<UpdatePromptProvider>();
@@ -102,7 +101,7 @@ namespace SyncTrayzor
                 SystemEvents.PowerModeChanged += (o, e) =>
                 {
                     if (e.Mode == PowerModes.Resume)
-                        this.Container.Get<IUpdateChecker>().CheckForAcceptableUpdatesAsync();
+                        this.Container.Get<IUpdateChecker>().CheckForAcceptableUpdateAsync();
                 };
             }
 
@@ -133,7 +132,7 @@ namespace SyncTrayzor
 
             // We don't care if this fails
             if (config.NotifyOfNewVersions)
-                this.Container.Get<IUpdateChecker>().CheckForAcceptableUpdatesAsync();
+                this.Container.Get<IUpdateChecker>().CheckForAcceptableUpdateAsync();
         }
 
         protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)

+ 3 - 11
src/SyncTrayzor/Pages/AboutViewModel.cs

@@ -59,21 +59,13 @@ namespace SyncTrayzor.Pages
 
         private async void CheckForNewerVersionAsync()
         {
-            var results = await this.updateChecker.FetchUpdatesAsync();
+            var results = await this.updateChecker.FetchUpdateAsync();
 
             if (results == null)
                 return;
 
-            if (results.LatestVersionIsNewer)
-            {
-                this.NewerVersion = results.LatestVersion.ToString(3);
-                this.newerVersionDownloadUrl = results.LatestVersionDownloadUrl;
-            }
-            else
-            {
-                this.NewerVersion = null;
-                this.newerVersionDownloadUrl = null;
-            }
+            this.NewerVersion = results.NewVersion.ToString(3);
+            this.newerVersionDownloadUrl = results.ReleasePageUrl;
         }
 
         public void ShowHomepage()

+ 48 - 0
src/SyncTrayzor/Services/AssemblyProvider.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SyncTrayzor.Services
+{
+    public interface IAssemblyProvider
+    {
+        Version Version { get; }
+        string Location { get; }
+        ProcessorArchitecture ProcessorArchitecture { get; }
+        Stream GetManifestResourceStream(string path);
+    }
+
+    public class AssemblyProvider : IAssemblyProvider
+    {
+        private readonly Assembly assembly;
+
+        public AssemblyProvider()
+        {
+            this.assembly = Assembly.GetExecutingAssembly();
+        }
+
+        public Version Version
+        {
+            get { return this.assembly.GetName().Version; }
+        }
+
+        public string Location
+        {
+            get { return this.assembly.Location; }
+        }
+
+        public ProcessorArchitecture ProcessorArchitecture
+        {
+            get { return this.assembly.GetName().ProcessorArchitecture; }
+        }
+
+        public Stream GetManifestResourceStream(string path)
+        {
+            return this.assembly.GetManifestResourceStream(path);
+        }
+    }
+}

+ 0 - 4
src/SyncTrayzor/Services/ConfigurationApplicator.cs

@@ -19,7 +19,6 @@ namespace SyncTrayzor.Services
         private readonly ISyncThingManager syncThingManager;
         private readonly IAutostartProvider autostartProvider;
         private readonly IWatchedFolderMonitor watchedFolderMonitor;
-        private readonly IGithubApiClient githubApiClient;
         private readonly IUpdateManager updateManager;
 
         public ConfigurationApplicator(
@@ -28,7 +27,6 @@ namespace SyncTrayzor.Services
             ISyncThingManager syncThingManager,
             IAutostartProvider autostartProvider,
             IWatchedFolderMonitor watchedFolderMonitor,
-            IGithubApiClient githubApiClient,
             IUpdateManager updateManager)
         {
             this.configurationProvider = configurationProvider;
@@ -38,7 +36,6 @@ namespace SyncTrayzor.Services
             this.syncThingManager = syncThingManager;
             this.autostartProvider = autostartProvider;
             this.watchedFolderMonitor = watchedFolderMonitor;
-            this.githubApiClient = githubApiClient;
             this.updateManager = updateManager;
 
             this.syncThingManager.DataLoaded += (o, e) => this.LoadFolders();
@@ -47,7 +44,6 @@ namespace SyncTrayzor.Services
 
         public void ApplyConfiguration()
         {
-            this.githubApiClient.SetConnectionDetails(Settings.Default.GithubApiUrl);
             this.watchedFolderMonitor.BackoffInterval = TimeSpan.FromMilliseconds(Settings.Default.DirectoryWatcherBackoffMilliseconds);
             this.watchedFolderMonitor.FolderExistenceCheckingInterval = TimeSpan.FromMilliseconds(Settings.Default.DirectoryWatcherFolderExistenceCheckMilliseconds);
 

+ 0 - 45
src/SyncTrayzor/Services/UpdateManagement/GithubApiClient.cs

@@ -1,45 +0,0 @@
-using Refit;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SyncTrayzor.Services.UpdateManagement
-{
-    public interface IGithubApiClient
-    {
-        void SetConnectionDetails(Uri baseAddress);
-        Task<Release> FetchLatestReleaseAsync();
-    }
-
-    public class GithubApiClient : IGithubApiClient
-    {
-        private IGithubApi api;
-
-        public void SetConnectionDetails(Uri baseAddress)
-        {
-            var httpClient = new HttpClient()
-            {
-                BaseAddress = baseAddress,
-            };
-
-            this.api = RestService.For<IGithubApi>(httpClient);
-        }
-
-        public async Task<Release> FetchLatestReleaseAsync()
-        {
-            var releases = await this.api.FetchReleasesAsync();
-
-            var latestRelease = (from release in releases
-                                where !release.IsDraft && !release.IsPrerelease
-                                where release.Assets.Any(assert => assert.ContentType == "application/octet-stream")
-                                let version = new Version(release.TagName.TrimStart('v'))
-                                orderby version descending
-                                select new Release(version, release.Url, release.Body)).FirstOrDefault();
-
-            return latestRelease;
-        }
-    }
-}

+ 2 - 3
src/SyncTrayzor/Services/UpdateManagement/IGithubApi.cs → src/SyncTrayzor/Services/UpdateManagement/IUpdateNotificationApi.cs

@@ -7,10 +7,9 @@ using System.Threading.Tasks;
 
 namespace SyncTrayzor.Services.UpdateManagement
 {
-    [Headers("User-Agent: SyncTrayzor")]
-    public interface IGithubApi
+    public interface IUpdateNotificationApi
     {
         [Get("/releases")]
-        Task<List<ReleaseResponse>> FetchReleasesAsync();
+        Task<UpdateNotificationResponse> FetchUpdateAsync(string version, string arch, string variant);
     }
 }

+ 0 - 42
src/SyncTrayzor/Services/UpdateManagement/ReleaseResponse.cs

@@ -1,42 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SyncTrayzor.Services.UpdateManagement
-{
-    public class ReleaseAssetResponse
-    {
-        [JsonProperty("content_type")]
-        public string ContentType { get; set; }
-    }
-
-    public class ReleaseResponse
-    {
-        [JsonProperty("tag_name")]
-        public string TagName { get; set; }
-
-        [JsonProperty("name")]
-        public string Name { get; set; }
-
-        [JsonProperty("html_url")]
-        public string Url { get; set; }
-
-        [JsonProperty("draft")]
-        public bool IsDraft { get; set; }
-
-        [JsonProperty("prerelease")]
-        public bool IsPrerelease { get; set; }
-
-        [JsonProperty("published_at")]
-        public DateTime PublishedAt { get; set; }
-
-        [JsonProperty("assets")]
-        public List<ReleaseAssetResponse> Assets { get; set; }
-
-        [JsonProperty("body")]
-        public string Body { get; set; }
-    }
-}

+ 64 - 25
src/SyncTrayzor/Services/UpdateManagement/UpdateChecker.cs

@@ -14,57 +14,96 @@ namespace SyncTrayzor.Services.UpdateManagement
 {
     public class VersionCheckResults
     {
-        public Version LatestVersion { get; private set; }
-        public bool LatestVersionIsNewer { get; private set; }
-        public string LatestVersionDownloadUrl { get; private set; }
-        public string LatestVersionChangelog { get; private set; }
+        public Version NewVersion { get; private set; }
+        public string DownloadUrl { get; private set; }
+        public string ReleaseNotes { get; private set; }
+        public string ReleasePageUrl { get; private set; }
 
-        public VersionCheckResults(Version latestVersion, bool latestVersionIsNewer, string latestVersionDownloadUrl, string latestVersionChangelog)
+        public VersionCheckResults(
+            Version newVersion,
+            string downloadUrl,
+            string releaseNotes,
+            string releasePageUrl)
         {
-            this.LatestVersion = latestVersion;
-            this.LatestVersionIsNewer = latestVersionIsNewer;
-            this.LatestVersionDownloadUrl = latestVersionDownloadUrl;
-            this.LatestVersionChangelog = latestVersionChangelog;
+            this.NewVersion = newVersion;
+            this.DownloadUrl = downloadUrl;
+            this.ReleaseNotes = releaseNotes;
+            this.ReleasePageUrl = ReleasePageUrl;
         }
 
         public override string ToString()
         {
-            return String.Format("<VersionCheckResults LatestVersion={0} IsNewer={1} DownloadUrl={2}>", this.LatestVersion, this.LatestVersionIsNewer, this.LatestVersionDownloadUrl);
+            return String.Format("<VersionCheckResults NewVersion={0} DownloadUrl={1} ReleaseNotes={2} ReleasePageUrl={3}>",
+                this.NewVersion, this.DownloadUrl, this.ReleasePageUrl);
         }
     }
 
     public interface IUpdateChecker
     {
-        Task<VersionCheckResults> FetchUpdatesAsync();
-        Task<VersionCheckResults> CheckForAcceptableUpdatesAsync(Version latestIgnoredVersion = null);
+        Task<VersionCheckResults> FetchUpdateAsync();
+        Task<VersionCheckResults> CheckForAcceptableUpdateAsync(Version latestIgnoredVersion = null);
     }
 
     public class UpdateChecker : IUpdateChecker
     {
         private static readonly Logger logger = LogManager.GetCurrentClassLogger();
+        private static readonly Dictionary<ProcessorArchitecture, string> processorArchitectureToStringMap = new Dictionary<ProcessorArchitecture, string>()
+        {
+            { ProcessorArchitecture.Amd64, "x64" },
+            { ProcessorArchitecture.Arm, "arm" },
+            { ProcessorArchitecture.IA64, "x64" },
+            { ProcessorArchitecture.MSIL, "msil" },
+            { ProcessorArchitecture.None, "none" },
+            { ProcessorArchitecture.X86, "86" }
+        };
 
-        private readonly IGithubApiClient apiClient;
+        private readonly Version applicationVersion;
+        private readonly ProcessorArchitecture processorArchitecture;
+        private readonly string variant;
+        private readonly IUpdateNotificationClient updateNotificationClient;
 
-        public UpdateChecker(IGithubApiClient apiClient)
+        public UpdateChecker(
+            Version applicationVersion,
+            ProcessorArchitecture processorArchitecture,
+            string variant,
+            IUpdateNotificationClient updateNotificationClient)
         {
-            this.apiClient = apiClient;
+            this.applicationVersion = applicationVersion;
+            this.processorArchitecture = processorArchitecture;
+            this.variant = variant;
+            this.updateNotificationClient = updateNotificationClient;
         }
 
-        public async Task<VersionCheckResults> FetchUpdatesAsync()
+        public async Task<VersionCheckResults> FetchUpdateAsync()
         {
             // We don't care if we fail
             try
             {
-                var applicationVersion = Assembly.GetExecutingAssembly().GetName().Version;
-                var latestRelease = await this.apiClient.FetchLatestReleaseAsync();
+                var update = await this.updateNotificationClient.FetchUpdateAsync(
+                    this.applicationVersion.ToString(3),
+                    processorArchitectureToStringMap[this.processorArchitecture],
+                    this.variant);
+
+                if (update == null)
+                {
+                    logger.Info("No updates found");
+                    return null;
+                }
+
+                if (update.Error != null)
+                {
+                    logger.Warn("Update API returned an error. Code: {0} Message: {1}", update.Error.Code, update.Error.Message);
+                    return null;
+                }
 
-                if (latestRelease == null)
+                var updateData = update.Data;
+                if (updateData == null)
                 {
-                    logger.Info("No suitable releases found");
+                    logger.Warn("Update response returned no error, but no data either");
                     return null;
                 }
 
-                var results = new VersionCheckResults(latestRelease.Version, latestRelease.Version > applicationVersion, latestRelease.DownloadUrl, latestRelease.Body);
+                var results = new VersionCheckResults(updateData.Version, updateData.DirectDownloadUrl, updateData.ReleaseNotes, updateData.ReleasePageUrl);
                 logger.Info("Found new version: {0}", results);
                 return results;
             }
@@ -75,17 +114,17 @@ namespace SyncTrayzor.Services.UpdateManagement
             }
         }
         
-        public async Task<VersionCheckResults> CheckForAcceptableUpdatesAsync(Version latestIgnoredVersion)
+        public async Task<VersionCheckResults> CheckForAcceptableUpdateAsync(Version latestIgnoredVersion)
         {
-            var results = await this.FetchUpdatesAsync();
+            var results = await this.FetchUpdateAsync();
 
             if (results == null)
                 return null;
 
-            if (latestIgnoredVersion != null && results.LatestVersion <= latestIgnoredVersion)
+            if (results.NewVersion <= this.applicationVersion)
                 return null;
 
-            if (!results.LatestVersionIsNewer)
+            if (latestIgnoredVersion != null && results.NewVersion <= latestIgnoredVersion)
                 return null;
 
             return results;

+ 30 - 0
src/SyncTrayzor/Services/UpdateManagement/UpdateCheckerFactory.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SyncTrayzor.Services.UpdateManagement
+{
+    public interface IUpdateCheckerFactory
+    {
+        IUpdateChecker CreateUpdateChecker(string baseUrl, string variant);
+    }
+
+    public class UpdateCheckerFactory : IUpdateCheckerFactory
+    {
+        private readonly IAssemblyProvider assemblyProvider;
+        private readonly IUpdateNotificationClientFactory updateNotificationClientFactory;
+
+        public UpdateCheckerFactory(IAssemblyProvider assemblyProvider, IUpdateNotificationClientFactory updateNotificationClientFactory)
+        {
+            this.assemblyProvider = assemblyProvider;
+            this.updateNotificationClientFactory = updateNotificationClientFactory;
+        }
+
+        public IUpdateChecker CreateUpdateChecker(string baseUrl, string variant)
+        {
+            return new UpdateChecker(this.assemblyProvider.Version, this.assemblyProvider.ProcessorArchitecture, variant, this.updateNotificationClientFactory.CreateUpdateNotificationClient(baseUrl));
+        }
+    }
+}

+ 14 - 9
src/SyncTrayzor/Services/UpdateManagement/UpdateManager.cs

@@ -27,6 +27,8 @@ namespace SyncTrayzor.Services.UpdateManagement
     {
         event EventHandler<VersionIgnoredEventArgs> VersionIgnored;
         Version LatestIgnoredVersion { get; set; }
+        string Variant { get; set; }
+        string UpdateCheckApiUrl { get; set; }
         bool CheckForUpdates { get; set; }
     }
 
@@ -37,7 +39,7 @@ namespace SyncTrayzor.Services.UpdateManagement
         private static readonly TimeSpan timeBetweenChecks = TimeSpan.FromHours(3);
 
         private readonly IApplicationState applicationState;
-        private readonly IUpdateChecker updateChecker;
+        private readonly IUpdateCheckerFactory updateCheckerFactory;
         private readonly IProcessStartProvider processStartProvider;
         private readonly IUpdatePromptProvider updatePromptProvider;
         private readonly System.Timers.Timer promptTimer;
@@ -46,6 +48,8 @@ namespace SyncTrayzor.Services.UpdateManagement
 
         public event EventHandler<VersionIgnoredEventArgs> VersionIgnored;
         public Version LatestIgnoredVersion { get; set; }
+        public string Variant { get; set; }
+        public string UpdateCheckApiUrl { get; set; }
 
         private bool _checkForUpdates;
         public bool CheckForUpdates
@@ -62,12 +66,12 @@ namespace SyncTrayzor.Services.UpdateManagement
 
         public UpdateManager(
             IApplicationState applicationState,
-            IUpdateChecker updateChecker,
+            IUpdateCheckerFactory updateCheckerFactory,
             IProcessStartProvider processStartProvider,
             IUpdatePromptProvider updatePromptProvider)
         {
             this.applicationState = applicationState;
-            this.updateChecker = updateChecker;
+            this.updateCheckerFactory = updateCheckerFactory;
             this.processStartProvider = processStartProvider;
             this.updatePromptProvider = updatePromptProvider;
 
@@ -142,7 +146,8 @@ namespace SyncTrayzor.Services.UpdateManagement
 
             this.RestartTimer();
 
-            var checkResult = await this.updateChecker.CheckForAcceptableUpdatesAsync(this.LatestIgnoredVersion);
+            var updateChecker = this.updateCheckerFactory.CreateUpdateChecker(this.UpdateCheckApiUrl, this.Variant);
+            var checkResult = await updateChecker.CheckForAcceptableUpdateAsync(this.LatestIgnoredVersion);
 
             VersionPromptResult promptResult;
             if (this.applicationState.HasMainWindow)
@@ -165,17 +170,17 @@ namespace SyncTrayzor.Services.UpdateManagement
             switch (promptResult)
             {
                 case VersionPromptResult.Download:
-                    logger.Info("Proceeding to download URL {0}", checkResult.LatestVersionDownloadUrl);
-                    this.processStartProvider.Start(checkResult.LatestVersionDownloadUrl);
+                    logger.Info("Proceeding to download URL {0}", checkResult.DownloadUrl);
+                    this.processStartProvider.Start(checkResult.DownloadUrl);
                     break;
 
                 case VersionPromptResult.Ignore:
-                    logger.Info("Ignoring version {0}", checkResult.LatestVersion);
-                    this.OnVersionIgnored(checkResult.LatestVersion);
+                    logger.Info("Ignoring version {0}", checkResult.NewVersion);
+                    this.OnVersionIgnored(checkResult.NewVersion);
                     break;
 
                 case VersionPromptResult.RemindLater:
-                    logger.Info("Not installing version {0}, but will remind later", checkResult.LatestVersion);
+                    logger.Info("Not installing version {0}, but will remind later", checkResult.NewVersion);
                     break;
 
                 default:

+ 34 - 0
src/SyncTrayzor/Services/UpdateManagement/UpdateNotificationClient.cs

@@ -0,0 +1,34 @@
+using NLog;
+using Refit;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SyncTrayzor.Services.UpdateManagement
+{
+    public interface IUpdateNotificationClient
+    {
+        Task<UpdateNotificationResponse> FetchUpdateAsync(string version, string arch, string variant);
+    }
+
+    public class UpdateNotificationClient : IUpdateNotificationClient
+    {
+        private static readonly Logger logger = LogManager.GetCurrentClassLogger();
+
+        private readonly IUpdateNotificationApi api;
+
+        public UpdateNotificationClient(string url)
+        {
+            this.api = RestService.For<IUpdateNotificationApi>(url);
+        }
+
+        public async Task<UpdateNotificationResponse> FetchUpdateAsync(string version, string arch, string variant)
+        {
+            var updates = await this.api.FetchUpdateAsync(version, arch, variant);
+            logger.Debug("Fetched updates response: {0}", updates);
+            return updates;
+        }
+    }
+}

+ 21 - 0
src/SyncTrayzor/Services/UpdateManagement/UpdateNotificationClientFactory.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SyncTrayzor.Services.UpdateManagement
+{
+    public interface IUpdateNotificationClientFactory
+    {
+        IUpdateNotificationClient CreateUpdateNotificationClient(string url);
+    }
+    
+    public class UpdateNotificationClientFactory : IUpdateNotificationClientFactory
+    {
+        public IUpdateNotificationClient CreateUpdateNotificationClient(string url)
+        {
+            return new UpdateNotificationClient(url);
+        }
+    }
+}

+ 64 - 0
src/SyncTrayzor/Services/UpdateManagement/UpdateNotificationResponse.cs

@@ -0,0 +1,64 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SyncTrayzor.Services.UpdateManagement
+{
+    public class UpdateNotificationData
+    {
+        [JsonProperty("version")]
+        public string VersionRaw { get; set; }
+
+        public Version Version
+        {
+            get { return String.IsNullOrWhiteSpace(this.VersionRaw) ? null : new Version(this.VersionRaw); }
+            set { this.VersionRaw = value.ToString(3); }
+        }
+
+        [JsonProperty("direct_download_url")]
+        public string DirectDownloadUrl { get; set; }
+
+        [JsonProperty("release_page_url")]
+        public string ReleasePageUrl { get; set; }
+
+        [JsonProperty("release_notes")]
+        public string ReleaseNotes { get; set; }
+
+        public override string ToString()
+        {
+            return String.Format("<UpdateNotificationData version={0} direct_download_url={1} release_page_url={2} release_notes={3}>",
+                this.Version.ToString(3), this.DirectDownloadUrl, this.ReleasePageUrl, this.ReleaseNotes);
+        }
+    }
+
+    public class UpdateNotificationError
+    {
+        [JsonProperty("code")]
+        public int Code { get; set; }
+
+        [JsonProperty("message")]
+        public string Message { get; set; }
+
+        public override string ToString()
+        {
+            return String.Format("<UpdateNotificationError code={0} message={1}>", this.Code, this.Message);
+        }
+    }
+
+    public class UpdateNotificationResponse
+    {
+        [JsonProperty("data")]
+        public UpdateNotificationData Data { get; set; }
+
+        [JsonProperty("error")]
+        public UpdateNotificationError Error { get; set; }
+
+        public override string ToString()
+        {
+            return String.Format("<UpdateNotificationResponse data={0} error={1}>", this.Data, this.Error);
+        }
+    }
+}

+ 4 - 4
src/SyncTrayzor/Services/UpdateManagement/UpdatePromptProvider.cs

@@ -45,8 +45,8 @@ namespace SyncTrayzor.Services.UpdateManagement
         public VersionPromptResult ShowDialog(VersionCheckResults checkResults)
         {
             var vm = this.newVersionAlertViewModelFactory();
-            vm.Changelog = checkResults.LatestVersionChangelog;
-            vm.Version = checkResults.LatestVersion;
+            vm.Changelog = checkResults.ReleaseNotes;
+            vm.Version = checkResults.NewVersion;
             var dialogResult = this.windowManager.ShowDialog(vm);
 
             if (dialogResult == true)
@@ -59,8 +59,8 @@ namespace SyncTrayzor.Services.UpdateManagement
         public async Task<VersionPromptResult> ShowToast(VersionCheckResults checkResults, CancellationToken cancellationToken)
         {
             var vm = this.upgradeAvailableToastViewModelFactory();
-            vm.Changelog = checkResults.LatestVersionChangelog;
-            vm.Version = checkResults.LatestVersion;
+            vm.Changelog = checkResults.ReleaseNotes;
+            vm.Version = checkResults.NewVersion;
 
             var tcs = new TaskCompletionSource<VersionPromptResult>();
 

+ 6 - 3
src/SyncTrayzor/SyncTrayzor.csproj

@@ -120,8 +120,14 @@
       <DependentUpon>App.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Services\AssemblyProvider.cs" />
     <Compile Include="Services\ProcessStartProvider.cs" />
+    <Compile Include="Services\UpdateManagement\IUpdateNotificationApi.cs" />
+    <Compile Include="Services\UpdateManagement\UpdateCheckerFactory.cs" />
     <Compile Include="Services\UpdateManagement\UpdateManager.cs" />
+    <Compile Include="Services\UpdateManagement\UpdateNotificationClient.cs" />
+    <Compile Include="Services\UpdateManagement\UpdateNotificationClientFactory.cs" />
+    <Compile Include="Services\UpdateManagement\UpdateNotificationResponse.cs" />
     <Compile Include="Services\UpdateManagement\UpdatePromptProvider.cs" />
     <Compile Include="SyncThing\ApiClient\ISyncThingApiClient.cs" />
     <Compile Include="SyncThing\ApiClient\ISyncThingApiV0p11.cs" />
@@ -174,10 +180,7 @@
     <Compile Include="Services\MemoryUsageLogger.cs" />
     <Compile Include="Services\Config\PathConfiguration.cs" />
     <Compile Include="Services\UpdateManagement\UpdateChecker.cs" />
-    <Compile Include="Services\UpdateManagement\GithubApiClient.cs" />
-    <Compile Include="Services\UpdateManagement\IGithubApi.cs" />
     <Compile Include="Services\UpdateManagement\Release.cs" />
-    <Compile Include="Services\UpdateManagement\ReleaseResponse.cs" />
     <Compile Include="Services\WatchedFolderMonitor.cs" />
     <Compile Include="SyncThing\ApiClient\Config.cs" />
     <Compile Include="SyncThing\ApiClient\Connections.cs" />