-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #370 from Fooxboy/369-вернуть-обратно-кнопку-прове…
…рки-обновлений #369 вернуть обратно кнопку проверки обновлений
- Loading branch information
Showing
5 changed files
with
60 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Threading.Tasks; | ||
using MusicX.ViewModels.Modals; | ||
using MusicX.Views.Modals; | ||
using Velopack; | ||
using Velopack.Sources; | ||
|
||
namespace MusicX.Services; | ||
|
||
public class UpdateService | ||
{ | ||
private readonly ConfigService _configService; | ||
private readonly NavigationService _navigationService; | ||
|
||
public UpdateService(ConfigService configService, NavigationService navigationService) | ||
{ | ||
_configService = configService; | ||
_navigationService = navigationService; | ||
} | ||
|
||
public async Task<bool> CheckForUpdates() | ||
{ | ||
var getBetaUpdates = _configService.Config.GetBetaUpdates.GetValueOrDefault(); | ||
var manager = new UpdateManager(new GithubSource("https://github.com/Fooxboy/MusicX-WPF", | ||
string.Empty, getBetaUpdates, new HttpClientFileDownloader()), new() | ||
{ | ||
ExplicitChannel = getBetaUpdates ? "win-beta" : "win" | ||
}); | ||
|
||
var updateInfo = await manager.CheckForUpdatesAsync(); | ||
|
||
if (updateInfo is null) | ||
return false; | ||
|
||
var viewModel = new AvailableNewUpdateModalViewModel(manager, updateInfo); | ||
|
||
_navigationService.OpenModal<AvailableNewUpdateModal>(viewModel); | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters