Skip to content

Commit

Permalink
Replace old markdown and remove redundant events (#389)
Browse files Browse the repository at this point in the history
* Remove redundant messages

* Replaced old markdown with preview.
Added nuget config to add preview feed

* Fix old extensions usage

* Scrollbar margin for the markdown.

---------

Co-authored-by: Burak Kaan Köse <[email protected]>
  • Loading branch information
Tiktack and bkaankose authored Sep 26, 2024
1 parent 118e9bf commit 939b395
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 97 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ PublishScripts/
*.nuget.props
*.nuget.targets

# Nuget personal access tokens and Credentials
nuget.config

# Microsoft Azure Build Output
csx/
*.build.csdef
Expand Down
2 changes: 0 additions & 2 deletions Wino.Core.UWP/Services/StatePersistenceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public bool IsReadingMail
if (SetProperty(ref isReadingMail, value))
{
OnPropertyChanged(nameof(IsBackButtonVisible));
WeakReferenceMessenger.Default.Send(new ShellStateUpdated());
}
}
}
Expand All @@ -63,7 +62,6 @@ public bool IsReaderNarrowed
if (SetProperty(ref isReaderNarrowed, value))
{
OnPropertyChanged(nameof(IsBackButtonVisible));
WeakReferenceMessenger.Default.Send(new ShellStateUpdated());
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions Wino.Mail.ViewModels/MailListPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using Wino.Mail.ViewModels.Data;
using Wino.Mail.ViewModels.Messages;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Client.Shell;
using Wino.Messaging.Server;
using Wino.Messaging.UI;

Expand Down Expand Up @@ -283,8 +282,6 @@ private async void ActiveMailItemChanged(MailItemViewModel selectedMailItemViewM

if (isMultiSelecting && StatePersistenceService.IsReaderNarrowed)
{
// Don't change the active mail item if the reader is narrowed, but just update the shell.
Messenger.Send(new ShellStateUpdated());
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Wino.Mail.ViewModels/MailRenderingPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ await ExecuteUIThread(() =>
FromAddress = message.From.Mailboxes.FirstOrDefault()?.Address ?? Translator.UnknownAddress;
FromName = message.From.Mailboxes.FirstOrDefault()?.Name ?? Translator.UnknownSender;
CreationDate = message.Date.DateTime;
ContactPicture = initializedMailItemViewModel.SenderContact?.Base64ContactPicture;
ContactPicture = initializedMailItemViewModel?.SenderContact?.Base64ContactPicture;

// Automatically disable images for Junk folder to prevent pixel tracking.
// This can only work for selected mail item rendering, not for EML file rendering.
Expand Down
19 changes: 0 additions & 19 deletions Wino.Mail.ViewModels/Messages/ResetSingleMailItemSelectionEvent.cs

This file was deleted.

1 change: 0 additions & 1 deletion Wino.Mail/AppShell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ private void BackButtonClicked(Controls.Advanced.WinoAppTitleBar sender, RoutedE
{
WeakReferenceMessenger.Default.Send(new ClearMailSelectionsRequested());
WeakReferenceMessenger.Default.Send(new DisposeRenderingFrameRequested());
WeakReferenceMessenger.Default.Send(new ShellStateUpdated());
}

private async void MenuItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
Expand Down
9 changes: 4 additions & 5 deletions Wino.Mail/Views/MailListPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:selectors="using:Wino.Selectors"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
xmlns:toolkitExt="using:CommunityToolkit.WinUI"
xmlns:viewModelData="using:Wino.Mail.ViewModels.Data"
xmlns:wino="using:Wino"
x:Name="root"
Expand Down Expand Up @@ -176,7 +176,7 @@
<controls:WinoExpander.Content>
<listview:WinoListView
x:Name="ThreadItemsList"
ui:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
toolkitExt:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
IsThreadListView="True"
ItemTemplate="{StaticResource ThreadSingleMailItemTemplate}"
ItemsSource="{x:Bind ThreadItems}"
Expand Down Expand Up @@ -431,9 +431,8 @@
x:Name="MailListView"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
ui:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
ui:ScrollViewerExtensions.EnableMiddleClickScrolling="True"
ui:ScrollViewerExtensions.VerticalScrollBarMargin="0"
toolkitExt:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
toolkitExt:ScrollViewerExtensions.VerticalScrollBarMargin="0"
ItemDeletedCommand="{x:Bind ViewModel.ExecuteMailOperationCommand}"
ItemTemplateSelector="{StaticResource MailItemDisplaySelector}"
ItemsSource="{x:Bind MailCollectionViewSource.View, Mode=OneWay}"
Expand Down
22 changes: 0 additions & 22 deletions Wino.Mail/Views/MailListPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@
using Wino.Mail.ViewModels.Messages;
using Wino.MenuFlyouts.Context;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Client.Shell;
using Wino.Views.Abstract;

namespace Wino.Views
{
public sealed partial class MailListPage : MailListPageAbstract,
IRecipient<ResetSingleMailItemSelectionEvent>,
IRecipient<ClearMailSelectionsRequested>,
IRecipient<ActiveMailItemChangedEvent>,
IRecipient<ActiveMailFolderChangedEvent>,
IRecipient<SelectMailItemContainerEvent>,
IRecipient<ShellStateUpdated>,
IRecipient<DisposeRenderingFrameRequested>
{
private const double RENDERING_COLUMN_MIN_WIDTH = 375;
Expand Down Expand Up @@ -144,14 +140,6 @@ private void SelectAllCheckboxUnchecked(object sender, RoutedEventArgs e)
MailListView.ClearSelections();
}

void IRecipient<ResetSingleMailItemSelectionEvent>.Receive(ResetSingleMailItemSelectionEvent message)
{
// Single item in thread selected.
// Force main list view to unselect all items, except for the one provided.

MailListView.ClearSelections(message.SelectedViewModel);
}

private async void MailItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
{
// Context is requested from a single mail point, but we might have multiple selected items.
Expand Down Expand Up @@ -303,11 +291,6 @@ private WebView2 GetComposerPageWebView()

#endregion

public void Receive(ActiveMailFolderChangedEvent message)
{
UpdateAdaptiveness();
}

public async void Receive(SelectMailItemContainerEvent message)
{
if (message.SelectedMailViewModel == null) return;
Expand Down Expand Up @@ -354,11 +337,6 @@ await ViewModel.ExecuteUIThread(async () =>
});
}

public void Receive(ShellStateUpdated message)
{
UpdateAdaptiveness();
}

private void SearchBoxFocused(object sender, RoutedEventArgs e)
{
SearchBar.PlaceholderText = string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions Wino.Mail/Views/Settings/AliasManagementPage.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<abstract:AliasManagementPageAbstract x:Class="Wino.Views.Settings.AliasManagementPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
xmlns:toolkitExt="using:CommunityToolkit.WinUI"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:Wino.Controls"
Expand Down Expand Up @@ -76,7 +76,7 @@

<ListView ItemTemplate="{StaticResource AccountAliasTemplate}"
ItemsSource="{x:Bind ViewModel.AccountAliases, Mode=OneWay}"
ui:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
toolkitExt:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
SelectionMode="None">
<ListView.ItemContainerTransitions>
<TransitionCollection>
Expand Down
12 changes: 6 additions & 6 deletions Wino.Mail/Views/Settings/PersonalizationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
xmlns:controls1="using:Wino.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
x:Name="root"
xmlns:enums="using:Wino.Core.Domain.Enums"
xmlns:helpers="using:Wino.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:personalization="using:Wino.Core.UWP.Models.Personalization"
xmlns:selectors="using:Wino.Selectors"
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
xmlns:toolkitExt="using:CommunityToolkit.WinUI"
xmlns:viewModelData="using:Wino.Mail.ViewModels.Data"
x:Name="root"
Title="Personalization"
mc:Ignorable="d">

Expand Down Expand Up @@ -149,8 +149,8 @@
<DataTemplate x:Key="MediumDisplayModePreviewTemplate" x:DataType="enums:MailListDisplayMode">
<controls1:MailItemDisplayInformationControl
DisplayMode="Medium"
ShowPreviewText="True"
MailItem="{Binding ElementName=root, Path=ViewModel.DemoPreviewMailCopy}" />
MailItem="{Binding ElementName=root, Path=ViewModel.DemoPreviewMailCopy}"
ShowPreviewText="True" />
</DataTemplate>

<DataTemplate x:Key="SpaciousDisplayModePreviewTemplate" x:DataType="enums:MailListDisplayMode">
Expand Down Expand Up @@ -255,7 +255,7 @@

<!-- TODO: Group by custom/wino -->
<GridView
ui:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
toolkitExt:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
ItemTemplateSelector="{StaticResource AppThemePreviewTemplateSelector}"
ItemsSource="{x:Bind ViewModel.AppThemes, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SelectedAppTheme, Mode=TwoWay}" />
Expand All @@ -276,7 +276,7 @@
ContentAlignment="Vertical">
<ListView
Margin="-18,0"
ui:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
toolkitExt:ListViewExtensions.ItemContainerStretchDirection="Horizontal"
ItemTemplateSelector="{StaticResource MailItemDisplayModePreviewTemplateSelector}"
ItemsSource="{x:Bind ViewModel.InformationDisplayModes}"
SelectedItem="{x:Bind ViewModel.SelectedInfoDisplayMode, Mode=TwoWay}" />
Expand Down
23 changes: 6 additions & 17 deletions Wino.Mail/Views/WelcomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,19 @@
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:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Wino.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkitmd="using:CommunityToolkit.Labs.WinUI.MarkdownTextBlock"
mc:Ignorable="d">

<Border
Margin="0,0,7,7"
Background="{ThemeResource WinoContentZoneBackgroud}"
BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="7">
<Grid Padding="24">
<Border Style="{StaticResource PageRootBorderStyle}">
<Grid Padding="15">
<ScrollViewer>
<controls:MarkdownTextBlock
x:Name="MarkdownControl"
Background="Transparent"
<toolkitmd:MarkdownTextBlock
Margin="0,0,16,0"
CharacterSpacing="12"
Config="{x:Bind _config, Mode=OneTime}"
FontSize="16"
Header1FontSize="30"
Header2FontSize="22"
ImageStretch="UniformToFill"
LinkClicked="HyperlinkClicked"
ListBulletSpacing="10"
Text="{x:Bind ViewModel.CurrentVersionNotes, Mode=OneWay}" />
</ScrollViewer>
</Grid>
Expand Down
10 changes: 4 additions & 6 deletions Wino.Mail/Views/WelcomePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
using System;
using Windows.System;
using CommunityToolkit.Labs.WinUI.MarkdownTextBlock;
using Wino.Views.Abstract;

namespace Wino.Views
{
public sealed partial class WelcomePage : WelcomePageAbstract
{
private readonly MarkdownConfig _config;

public WelcomePage()
{
InitializeComponent();
}

private async void HyperlinkClicked(object sender, Microsoft.Toolkit.Uwp.UI.Controls.LinkClickedEventArgs e)
{
await Launcher.LaunchUriAsync(new System.Uri(e.Link));
_config = new MarkdownConfig();
}
}
}
6 changes: 3 additions & 3 deletions Wino.Mail/Wino.Mail.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
<PackageReference Include="CommunityToolkit.Diagnostics">
<Version>8.2.2</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Labs.Uwp.Controls.MarkdownTextBlock">
<Version>0.1.240917-build.1755</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm">
<Version>8.2.2</Version>
</PackageReference>
Expand Down Expand Up @@ -177,9 +180,6 @@
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Markdown">
<Version>7.1.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.8.6</Version>
</PackageReference>
Expand Down
7 changes: 0 additions & 7 deletions Wino.Messages/Client/Shell/ShellStateUpdated.cs

This file was deleted.

9 changes: 9 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="ToolkitLabsFeed" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>

0 comments on commit 939b395

Please sign in to comment.