Go back to welcome page when the last account is removed.

This commit is contained in:
Burak Kaan Köse
2026-03-09 14:18:13 +01:00
parent 859a5bb117
commit 9b567c4bac
9 changed files with 39 additions and 233 deletions
+11 -4
View File
@@ -427,7 +427,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
{
if (PreferencesService.StartupEntityId == null)
{
NavigationService.Navigate(WinoPage.WelcomePage);
NavigateToWelcomeWizard();
}
else
{
@@ -451,8 +451,8 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
}
else
{
// Fallback to welcome page if startup entity is not found.
NavigationService.Navigate(WinoPage.WelcomePage);
// Fallback to the welcome wizard if startup entity is not found.
NavigateToWelcomeWizard();
}
}
}
@@ -1038,10 +1038,17 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
else
{
await ExecuteUIThread(() => SelectedMenuItem = null);
NavigationService.Navigate(WinoPage.WelcomePage);
NavigateToWelcomeWizard();
}
}
private void NavigateToWelcomeWizard()
=> NavigationService.Navigate(
WinoPage.WelcomeHostPage,
null,
NavigationReferenceFrame.ShellFrame,
NavigationTransitionType.None);
private bool IsAccountCurrentlyLoaded(Guid accountId)
{
return latestSelectedAccountMenuItem?.HoldingAccounts?.Any(a => a.Id == accountId) == true;
@@ -1,69 +0,0 @@
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
{
private readonly IUpdateManager _updateManager;
private readonly INativeAppService _nativeAppService;
private readonly INavigationService _navigationService;
[ObservableProperty]
public partial string VersionDisplay { get; set; } = string.Empty;
[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)
{
_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
{
var updateNotes = await _updateManager.GetLatestUpdateNotesAsync();
UpdateSections = updateNotes.Sections;
}
catch (Exception)
{
UpdateSections = [];
}
try
{
FeatureSections = await _updateManager.GetFeaturesAsync();
}
catch (Exception)
{
FeatureSections = [];
}
}
[RelayCommand]
private void NavigateManageAccounts()
=> _navigationService.Navigate(WinoPage.ManageAccountsPage, null, NavigationReferenceFrame.ShellFrame, NavigationTransitionType.DrillIn);
}