New startup window.
This commit is contained in:
@@ -1,37 +1,69 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Wino.Core.Domain;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.Navigation;
|
||||
using Wino.Core.Domain.Models.Updates;
|
||||
|
||||
namespace Wino.Mail.ViewModels;
|
||||
|
||||
public partial class WelcomePageViewModel : MailBaseViewModel
|
||||
{
|
||||
public const string VersionFile = "vnext.md";
|
||||
private readonly IMailDialogService _dialogService;
|
||||
private readonly IFileService _fileService;
|
||||
private readonly IUpdateManager _updateManager;
|
||||
private readonly INativeAppService _nativeAppService;
|
||||
private readonly INavigationService _navigationService;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string CurrentVersionNotes { get; set; } = string.Empty;
|
||||
public partial string VersionDisplay { get; set; } = string.Empty;
|
||||
|
||||
public WelcomePageViewModel(IMailDialogService dialogService, IFileService fileService)
|
||||
[ObservableProperty]
|
||||
public partial List<UpdateNoteSection> UpdateSections { get; set; } = [];
|
||||
|
||||
[ObservableProperty]
|
||||
public partial List<UpdateNoteSection> FeatureSections { get; set; } = [];
|
||||
|
||||
public string GitHubUrl => "https://github.com/bkaankose/Wino-Mail/";
|
||||
public string PaypalUrl => "https://paypal.me/bkaankose?country.x=PL&locale.x=en_US";
|
||||
|
||||
public WelcomePageViewModel(IUpdateManager updateManager,
|
||||
INativeAppService nativeAppService,
|
||||
INavigationService navigationService)
|
||||
{
|
||||
_dialogService = dialogService;
|
||||
_fileService = fileService;
|
||||
_updateManager = updateManager;
|
||||
_nativeAppService = nativeAppService;
|
||||
_navigationService = navigationService;
|
||||
}
|
||||
|
||||
public override async void OnNavigatedTo(NavigationMode mode, object parameters)
|
||||
{
|
||||
base.OnNavigatedTo(mode, parameters);
|
||||
|
||||
VersionDisplay = $"{Translator.SettingsAboutVersion}{_nativeAppService.GetFullAppVersion()}";
|
||||
|
||||
try
|
||||
{
|
||||
CurrentVersionNotes = await _fileService.GetFileContentByApplicationUriAsync($"ms-appx:///Assets/ReleaseNotes/{VersionFile}");
|
||||
var updateNotes = await _updateManager.GetLatestUpdateNotesAsync();
|
||||
UpdateSections = updateNotes.Sections;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_dialogService.InfoBarMessage(Translator.GeneralTitle_Error, "Can't find the patch notes.", Core.Domain.Enums.InfoBarMessageType.Information);
|
||||
UpdateSections = [];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
FeatureSections = await _updateManager.GetFeaturesAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
FeatureSections = [];
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateManageAccounts()
|
||||
=> _navigationService.Navigate(WinoPage.ManageAccountsPage, null, NavigationReferenceFrame.ShellFrame, NavigationTransitionType.DrillIn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user