Go back to welcome page when the last account is removed.
This commit is contained in:
@@ -11,7 +11,6 @@ public enum WinoPage
|
|||||||
SettingsPage,
|
SettingsPage,
|
||||||
ContactsPage,
|
ContactsPage,
|
||||||
MailRenderingPage,
|
MailRenderingPage,
|
||||||
WelcomePage,
|
|
||||||
AccountDetailsPage,
|
AccountDetailsPage,
|
||||||
MergedAccountDetailsPage,
|
MergedAccountDetailsPage,
|
||||||
ManageAccountsPage,
|
ManageAccountsPage,
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
{
|
{
|
||||||
if (PreferencesService.StartupEntityId == null)
|
if (PreferencesService.StartupEntityId == null)
|
||||||
{
|
{
|
||||||
NavigationService.Navigate(WinoPage.WelcomePage);
|
NavigateToWelcomeWizard();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -451,8 +451,8 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fallback to welcome page if startup entity is not found.
|
// Fallback to the welcome wizard if startup entity is not found.
|
||||||
NavigationService.Navigate(WinoPage.WelcomePage);
|
NavigateToWelcomeWizard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1038,10 +1038,17 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
await ExecuteUIThread(() => SelectedMenuItem = null);
|
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)
|
private bool IsAccountCurrentlyLoaded(Guid accountId)
|
||||||
{
|
{
|
||||||
return latestSelectedAccountMenuItem?.HoldingAccounts?.Any(a => a.Id == accountId) == true;
|
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);
|
|
||||||
}
|
|
||||||
@@ -35,6 +35,7 @@ using Wino.Messaging.Client.Navigation;
|
|||||||
using Wino.Messaging.Server;
|
using Wino.Messaging.Server;
|
||||||
using Wino.Messaging.UI;
|
using Wino.Messaging.UI;
|
||||||
using Wino.Services;
|
using Wino.Services;
|
||||||
|
using Wino.Views;
|
||||||
using WinUIEx;
|
using WinUIEx;
|
||||||
namespace Wino.Mail.WinUI;
|
namespace Wino.Mail.WinUI;
|
||||||
|
|
||||||
@@ -145,7 +146,6 @@ public partial class App : WinoApplication,
|
|||||||
services.AddTransient(typeof(MailListPageViewModel));
|
services.AddTransient(typeof(MailListPageViewModel));
|
||||||
services.AddTransient(typeof(MailRenderingPageViewModel));
|
services.AddTransient(typeof(MailRenderingPageViewModel));
|
||||||
services.AddTransient(typeof(AccountManagementViewModel));
|
services.AddTransient(typeof(AccountManagementViewModel));
|
||||||
services.AddTransient(typeof(WelcomePageViewModel));
|
|
||||||
services.AddTransient(typeof(WelcomePageV2ViewModel));
|
services.AddTransient(typeof(WelcomePageV2ViewModel));
|
||||||
services.AddTransient(typeof(ProviderSelectionPageViewModel));
|
services.AddTransient(typeof(ProviderSelectionPageViewModel));
|
||||||
services.AddTransient(typeof(AccountSetupProgressPageViewModel));
|
services.AddTransient(typeof(AccountSetupProgressPageViewModel));
|
||||||
@@ -606,12 +606,22 @@ public partial class App : WinoApplication,
|
|||||||
var windowManager = Services.GetRequiredService<IWinoWindowManager>();
|
var windowManager = Services.GetRequiredService<IWinoWindowManager>();
|
||||||
MainWindow = windowManager.CreateWindow(WinoWindowKind.Welcome, () => new WelcomeWindow());
|
MainWindow = windowManager.CreateWindow(WinoWindowKind.Welcome, () => new WelcomeWindow());
|
||||||
if (MainWindow is WelcomeWindow welcomeWindow)
|
if (MainWindow is WelcomeWindow welcomeWindow)
|
||||||
windowManager.SetPrimaryNavigationFrame(WinoWindowKind.Welcome, welcomeWindow.GetRootFrame());
|
{
|
||||||
|
var rootFrame = welcomeWindow.GetRootFrame();
|
||||||
|
windowManager.SetPrimaryNavigationFrame(WinoWindowKind.Welcome, rootFrame);
|
||||||
|
|
||||||
|
if (rootFrame.Content is WelcomeHostPage welcomeHostPage)
|
||||||
|
{
|
||||||
|
welcomeHostPage.ResetWizard();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Services.GetRequiredService<INavigationService>()
|
||||||
|
.Navigate(WinoPage.WelcomeHostPage, null, NavigationReferenceFrame.ShellFrame, NavigationTransitionType.None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InitializeNavigationDispatcher();
|
InitializeNavigationDispatcher();
|
||||||
|
|
||||||
Services.GetRequiredService<INavigationService>()
|
|
||||||
.Navigate(WinoPage.WelcomeHostPage, null, NavigationReferenceFrame.ShellFrame, NavigationTransitionType.None);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeNavigationDispatcher()
|
private void InitializeNavigationDispatcher()
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class NavigationService : NavigationServiceBase, INavigationService
|
|||||||
WinoPage.MailRenderingPage,
|
WinoPage.MailRenderingPage,
|
||||||
WinoPage.ComposePage,
|
WinoPage.ComposePage,
|
||||||
WinoPage.IdlePage,
|
WinoPage.IdlePage,
|
||||||
WinoPage.WelcomePage,
|
|
||||||
WinoPage.WelcomePageV2,
|
WinoPage.WelcomePageV2,
|
||||||
WinoPage.WelcomeHostPage,
|
WinoPage.WelcomeHostPage,
|
||||||
WinoPage.ProviderSelectionPage,
|
WinoPage.ProviderSelectionPage,
|
||||||
@@ -109,7 +108,6 @@ public class NavigationService : NavigationServiceBase, INavigationService
|
|||||||
WinoPage.ComposePage => typeof(ComposePage),
|
WinoPage.ComposePage => typeof(ComposePage),
|
||||||
WinoPage.MailListPage => typeof(MailListPage),
|
WinoPage.MailListPage => typeof(MailListPage),
|
||||||
WinoPage.SettingsPage => typeof(SettingsPage),
|
WinoPage.SettingsPage => typeof(SettingsPage),
|
||||||
WinoPage.WelcomePage => typeof(WelcomePage),
|
|
||||||
WinoPage.WelcomePageV2 => typeof(WelcomePageV2),
|
WinoPage.WelcomePageV2 => typeof(WelcomePageV2),
|
||||||
WinoPage.SettingOptionsPage => typeof(SettingOptionsPage),
|
WinoPage.SettingOptionsPage => typeof(SettingOptionsPage),
|
||||||
WinoPage.AppPreferencesPage => typeof(AppPreferencesPage),
|
WinoPage.AppPreferencesPage => typeof(AppPreferencesPage),
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
using Wino.Mail.WinUI;
|
|
||||||
using Wino.Mail.ViewModels;
|
|
||||||
|
|
||||||
namespace Wino.Views.Abstract;
|
|
||||||
|
|
||||||
public abstract class WelcomePageAbstract : BasePage<WelcomePageViewModel>
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -29,10 +29,7 @@ public sealed partial class WelcomeHostPage : WelcomeHostPageAbstract,
|
|||||||
WeakReferenceMessenger.Default.Register<BreadcrumbNavigationRequested>(this);
|
WeakReferenceMessenger.Default.Register<BreadcrumbNavigationRequested>(this);
|
||||||
WeakReferenceMessenger.Default.Register<BackBreadcrumNavigationRequested>(this);
|
WeakReferenceMessenger.Default.Register<BackBreadcrumNavigationRequested>(this);
|
||||||
|
|
||||||
// Navigate to the welcome/get-started page without adding it to the wizard breadcrumb.
|
ResetWizard();
|
||||||
// Breadcrumb steps only start after the user clicks "Get Started".
|
|
||||||
var welcomePageType = ViewModel.NavigationService.GetPageType(WinoPage.WelcomePageV2);
|
|
||||||
WizardFrame.Navigate(welcomePageType, null, new SuppressNavigationTransitionInfo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
|
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
|
||||||
@@ -53,6 +50,18 @@ public sealed partial class WelcomeHostPage : WelcomeHostPageAbstract,
|
|||||||
GoBackFrame();
|
GoBackFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetWizard()
|
||||||
|
{
|
||||||
|
PageHistory.Clear();
|
||||||
|
WizardFrame.BackStack.Clear();
|
||||||
|
WizardFrame.ForwardStack.Clear();
|
||||||
|
|
||||||
|
// Navigate to the welcome/get-started page without adding it to the wizard breadcrumb.
|
||||||
|
// Breadcrumb steps only start after the user clicks "Get Started".
|
||||||
|
var welcomePageType = ViewModel.NavigationService.GetPageType(WinoPage.WelcomePageV2);
|
||||||
|
WizardFrame.Navigate(welcomePageType, null, new SuppressNavigationTransitionInfo());
|
||||||
|
}
|
||||||
|
|
||||||
private void GoBackFrame()
|
private void GoBackFrame()
|
||||||
{
|
{
|
||||||
BreadcrumbNavigationHelper.GoBack(WizardFrame, PageHistory, NavigationTransitionEffect.FromLeft);
|
BreadcrumbNavigationHelper.GoBack(WizardFrame, PageHistory, NavigationTransitionEffect.FromLeft);
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
<abstract:WelcomePageAbstract
|
|
||||||
x:Class="Wino.Views.WelcomePage"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:abstract="using:Wino.Views.Abstract"
|
|
||||||
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
|
||||||
xmlns:localControls="using:Wino.Mail.WinUI.Controls"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
Style="{StaticResource PageStyle}"
|
|
||||||
mc:Ignorable="d">
|
|
||||||
|
|
||||||
<Grid Padding="32,24" RowSpacing="16">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<!-- Header -->
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<!-- CTA Button -->
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<!-- Segmented Tabs + FlipView content -->
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<!-- Footer -->
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<!-- Header -->
|
|
||||||
<StackPanel Grid.Row="0" Spacing="4">
|
|
||||||
<TextBlock
|
|
||||||
FontSize="28"
|
|
||||||
FontWeight="SemiBold"
|
|
||||||
Text="{x:Bind domain:Translator.WelcomeWindow_Title}" />
|
|
||||||
<TextBlock
|
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
|
||||||
Text="{x:Bind domain:Translator.WelcomeWindow_Subtitle}"
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<!-- Get Started CTA -->
|
|
||||||
<Button
|
|
||||||
Grid.Row="1"
|
|
||||||
Padding="24,12"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Command="{x:Bind ViewModel.NavigateManageAccountsCommand}"
|
|
||||||
Style="{StaticResource AccentButtonStyle}">
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock
|
|
||||||
FontSize="14"
|
|
||||||
FontWeight="SemiBold"
|
|
||||||
HorizontalTextAlignment="Center"
|
|
||||||
Text="{x:Bind domain:Translator.WelcomeWindow_GetStartedButton}" />
|
|
||||||
<TextBlock
|
|
||||||
FontSize="12"
|
|
||||||
Foreground="{ThemeResource TextOnAccentFillColorPrimaryBrush}"
|
|
||||||
Opacity="0.8"
|
|
||||||
Text="{x:Bind domain:Translator.WelcomeWindow_GetStartedDescription}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<!-- Tabs + Content -->
|
|
||||||
<Grid Grid.Row="2" RowSpacing="12">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<!-- Segmented Control -->
|
|
||||||
<controls:Segmented
|
|
||||||
x:Name="TabSegmented"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
SelectionChanged="OnTabSelectionChanged">
|
|
||||||
<controls:SegmentedItem Content="{x:Bind domain:Translator.WelcomeWindow_FeaturesTab}" />
|
|
||||||
<controls:SegmentedItem Content="{x:Bind domain:Translator.WelcomeWindow_WhatsNewTab}" />
|
|
||||||
</controls:Segmented>
|
|
||||||
|
|
||||||
<!-- Features FlipView -->
|
|
||||||
<localControls:UpdateNotesFlipViewControl
|
|
||||||
x:Name="FeaturesFlipView"
|
|
||||||
Grid.Row="1"
|
|
||||||
Sections="{x:Bind ViewModel.FeatureSections, Mode=OneWay}"
|
|
||||||
Visibility="Visible" />
|
|
||||||
|
|
||||||
<!-- What's New FlipView -->
|
|
||||||
<localControls:UpdateNotesFlipViewControl
|
|
||||||
x:Name="WhatsNewFlipView"
|
|
||||||
Grid.Row="1"
|
|
||||||
Sections="{x:Bind ViewModel.UpdateSections, Mode=OneWay}"
|
|
||||||
Visibility="Collapsed" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<Grid Grid.Row="3" Padding="0,8,0,0">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<TextBlock
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Foreground="{ThemeResource TextFillColorTertiaryBrush}"
|
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
|
||||||
Text="{x:Bind ViewModel.VersionDisplay, Mode=OneWay}" />
|
|
||||||
|
|
||||||
<StackPanel
|
|
||||||
Grid.Column="1"
|
|
||||||
Orientation="Horizontal"
|
|
||||||
Spacing="8">
|
|
||||||
<HyperlinkButton Content="{x:Bind domain:Translator.SettingsAboutGithub_Title}" NavigateUri="{x:Bind ViewModel.GitHubUrl, Mode=OneWay}" />
|
|
||||||
<HyperlinkButton Content="{x:Bind domain:Translator.SettingsPaypal_Title}" NavigateUri="{x:Bind ViewModel.PaypalUrl, Mode=OneWay}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
</abstract:WelcomePageAbstract>
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Microsoft.UI.Xaml.Controls;
|
|
||||||
using CommunityToolkit.WinUI.Controls;
|
|
||||||
using Wino.Views.Abstract;
|
|
||||||
|
|
||||||
namespace Wino.Views;
|
|
||||||
|
|
||||||
public sealed partial class WelcomePage : WelcomePageAbstract
|
|
||||||
{
|
|
||||||
public WelcomePage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTabSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is not Segmented segmented)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool isFeaturesTab = segmented.SelectedIndex == 0;
|
|
||||||
|
|
||||||
FeaturesFlipView.Visibility = isFeaturesTab ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
WhatsNewFlipView.Visibility = isFeaturesTab ? Visibility.Collapsed : Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user