Skip to content

Commit

Permalink
Updated to pass in the VelopackAsset to ApplyUpdatesAndRestart.
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomEngy committed May 19, 2024
1 parent f925cf8 commit 828906c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions VidCoder/Services/Interfaces/IUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace VidCoder.Services;

using Model;
using Velopack;

public interface IUpdater
{
Expand All @@ -15,5 +16,7 @@ public interface IUpdater

UpdateState State { get; }
Version LatestVersion { get; }
VelopackAsset LatestAsset { get; }

int UpdateDownloadProgressPercent { get; set; }
}
5 changes: 4 additions & 1 deletion VidCoder/Services/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public int UpdateDownloadProgressPercent

public Version LatestVersion { get; set; }

public VelopackAsset LatestAsset { get; set; }

public bool PromptToApplyUpdate()
{
if (Utilities.SupportsUpdates)
Expand All @@ -42,7 +44,7 @@ public bool PromptToApplyUpdate()
if (updateConfirmation.Accepted)
{
var updateManager = new UpdateManager(Utilities.VelopackUpdateUrl);
updateManager.ApplyUpdatesAndRestart(null, null);
updateManager.ApplyUpdatesAndRestart(this.LatestAsset);

return true;
}
Expand Down Expand Up @@ -101,6 +103,7 @@ private async void StartBackgroundUpdate(bool isManualCheck)
{
// Save latest version (just major and minor)
this.LatestVersion = new Version(updateInfo.TargetFullRelease.Version.Major, updateInfo.TargetFullRelease.Version.Minor);
this.LatestAsset = updateInfo.TargetFullRelease;

this.State = UpdateState.Downloading;
await updateManager.DownloadUpdatesAsync(updateInfo, (progressPercent) =>
Expand Down
2 changes: 1 addition & 1 deletion VidCoder/ViewModel/OptionsDialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ public ICommand ApplyUpdate
() =>
{
var updateManager = new UpdateManager(Utilities.VelopackUpdateUrl);
updateManager.ApplyUpdatesAndRestart(null, null);
updateManager.ApplyUpdatesAndRestart(this.Updater.LatestAsset);
}));
}
}
Expand Down

0 comments on commit 828906c

Please sign in to comment.