Main app aot compatibility.

This commit is contained in:
Burak Kaan Köse
2025-11-14 18:51:48 +01:00
parent ae64094feb
commit b356af8eb4
41 changed files with 220 additions and 327 deletions
+11 -6
View File
@@ -41,7 +41,7 @@ public sealed partial class ComposePage : ComposePageAbstract,
InitializeComponent();
}
private async void GlobalFocusManagerGotFocus(object sender, FocusManagerGotFocusEventArgs e)
private async void GlobalFocusManagerGotFocus(object? sender, FocusManagerGotFocusEventArgs e)
{
// In order to delegate cursor to the inner editor for WebView2.
// When the control got focus, we invoke script to focus the editor.
@@ -60,7 +60,7 @@ public sealed partial class ComposePage : ComposePageAbstract,
x => box.TextChanged += x,
x => box.TextChanged -= x)
.Throttle(TimeSpan.FromMilliseconds(120))
.ObserveOn(SynchronizationContext.Current)
.ObserveOn(SynchronizationContext.Current!)
.Subscribe(t =>
{
if (t.EventArgs.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
@@ -305,10 +305,15 @@ public sealed partial class ComposePage : ComposePageAbstract,
ImportanceFlyout.Hide();
ImportanceSplitButton.IsChecked = true;
if (sender is Button senderButton)
if (sender is Button senderButton && senderButton.Tag is MessageImportance importance)
{
ViewModel.SelectedMessageImportance = (MessageImportance)senderButton.Tag;
((ImportanceSplitButton.Content as Viewbox).Child as SymbolIcon).Symbol = (senderButton.Content as SymbolIcon).Symbol;
ViewModel.SelectedMessageImportance = importance;
if (ImportanceSplitButton.Content is Viewbox viewbox &&
viewbox.Child is SymbolIcon symbolIcon &&
senderButton.Content is SymbolIcon contentIcon)
{
symbolIcon.Symbol = contentIcon.Symbol;
}
}
}
@@ -332,7 +337,7 @@ public sealed partial class ComposePage : ComposePageAbstract,
_ => null
};
AccountContact addedItem = null;
AccountContact? addedItem = null;
if (addressCollection != null)
addedItem = await ViewModel.GetAddressInformationAsync(currentText, addressCollection);
@@ -200,15 +200,15 @@ public sealed partial class AdvancedImapSetupPage : Page
IncomingServerPassword = PasswordBox.Password,
IncomingServerType = Core.Domain.Enums.CustomIncomingServerType.IMAP4,
IncomingServerUsername = UsernameBox.Text,
IncomingAuthenticationMethod = (IncomingAuthenticationMethod.SelectedItem as ImapAuthenticationMethodModel).ImapAuthenticationMethod,
IncomingServerSocketOption = (IncomingConnectionSecurity.SelectedItem as ImapConnectionSecurityModel).ImapConnectionSecurity,
IncomingAuthenticationMethod = (IncomingAuthenticationMethod.SelectedItem as ImapAuthenticationMethodModel)!.ImapAuthenticationMethod,
IncomingServerSocketOption = (IncomingConnectionSecurity.SelectedItem as ImapConnectionSecurityModel)!.ImapConnectionSecurity,
IncomingServerPort = IncomingServerPortBox.Text,
OutgoingServer = GetServerWithoutPort(OutgoingServerBox.Text),
OutgoingServerPort = OutgoingServerPort.Text,
OutgoingServerPassword = OutgoingPasswordBox.Password,
OutgoingAuthenticationMethod = (OutgoingAuthenticationMethod.SelectedItem as ImapAuthenticationMethodModel).ImapAuthenticationMethod,
OutgoingServerSocketOption = (OutgoingConnectionSecurity.SelectedItem as ImapConnectionSecurityModel).ImapConnectionSecurity,
OutgoingAuthenticationMethod = (OutgoingAuthenticationMethod.SelectedItem as ImapAuthenticationMethodModel)!.ImapAuthenticationMethod,
OutgoingServerSocketOption = (OutgoingConnectionSecurity.SelectedItem as ImapConnectionSecurityModel)!.ImapConnectionSecurity,
OutgoingServerUsername = OutgoingUsernameBox.Text,
ProxyServer = ProxyServerBox.Text,
@@ -13,10 +13,10 @@ namespace Wino.Views.ImapSetup;
public sealed partial class ImapConnectionFailedPage : Page
{
private string _protocolLog;
private string? _protocolLog;
private readonly IClipboardService _clipboardService = App.Current.Services.GetService<IClipboardService>();
private readonly IMailDialogService _dialogService = App.Current.Services.GetService<IMailDialogService>();
private readonly IClipboardService _clipboardService = App.Current.Services.GetService<IClipboardService>()!;
private readonly IMailDialogService _dialogService = App.Current.Services.GetService<IMailDialogService>()!;
public ImapConnectionFailedPage()
{
@@ -15,8 +15,8 @@ namespace Wino.Views.ImapSetup;
public sealed partial class TestingImapConnectionPage : Page
{
private AutoDiscoverySettings autoDiscoverySettings;
private CustomServerInformation serverInformationToTest;
private AutoDiscoverySettings autoDiscoverySettings = null!;
private CustomServerInformation serverInformationToTest = null!;
public TestingImapConnectionPage()
{
@@ -19,7 +19,7 @@ namespace Wino.Views.ImapSetup;
public sealed partial class WelcomeImapSetupPage : Page
{
private readonly IAutoDiscoveryService _autoDiscoveryService = App.Current.Services.GetService<IAutoDiscoveryService>();
private readonly IAutoDiscoveryService _autoDiscoveryService = App.Current.Services.GetService<IAutoDiscoveryService>()!;
public WelcomeImapSetupPage()
{
+2 -7
View File
@@ -184,14 +184,9 @@
LostFocus="SearchBarUnfocused"
PlaceholderText="{x:Bind domain:Translator.SearchBarPlaceholder}"
QueryIcon="Find"
QuerySubmitted="SearchbarQuerySubmitted"
Text="{x:Bind ViewModel.SearchQuery, Mode=TwoWay}"
TextChanged="SearchBar_TextChanged">
<i:Interaction.Behaviors>
<i:EventTriggerBehavior EventName="QuerySubmitted">
<i:InvokeCommandAction Command="{x:Bind ViewModel.PerformSearchCommand}" />
</i:EventTriggerBehavior>
</i:Interaction.Behaviors>
</AutoSuggestBox>
TextChanged="SearchBar_TextChanged" />
</Grid>
</wino:BasePage.ShellContent>
+7 -1
View File
@@ -188,7 +188,7 @@ public sealed partial class MailListPage : MailListPageAbstract,
targetItems = ViewModel.MailCollection.SelectedItems;
var availableActions = ViewModel.GetAvailableMailActions(targetItems);
if (!availableActions?.Any() ?? false) return;
if (availableActions == null || !availableActions.Any()) return;
var clickedOperation = await GetMailOperationFromFlyoutAsync(availableActions, control, p.X, p.Y);
@@ -738,4 +738,10 @@ public sealed partial class MailListPage : MailListPageAbstract,
await WinoClickItemInternalAsync(e.ClickedItem);
}
private void SearchbarQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
if (ViewModel.PerformSearchCommand.CanExecute(null))
ViewModel.PerformSearchCommand.Execute(null);
}
}
@@ -28,8 +28,8 @@ public sealed partial class MailRenderingPage : MailRenderingPageAbstract,
IRecipient<CancelRenderingContentRequested>,
IRecipient<ApplicationThemeChanged>
{
private readonly IPreferencesService _preferencesService = App.Current.Services.GetService<IPreferencesService>();
private readonly IMailDialogService _dialogService = App.Current.Services.GetService<IMailDialogService>();
private readonly IPreferencesService _preferencesService = App.Current.Services.GetService<IPreferencesService>()!;
private readonly IMailDialogService _dialogService = App.Current.Services.GetService<IMailDialogService>()!;
private bool isRenderingInProgress = false;
private TaskCompletionSource<bool> DOMLoadedTask = new TaskCompletionSource<bool>();
@@ -232,7 +232,7 @@ public sealed partial class MailRenderingPage : MailRenderingPageAbstract,
// TODO: Check external link navigation setting is enabled.
// Open all external urls in launcher.
if (args.Cancel && Uri.TryCreate(args.Uri, UriKind.Absolute, out Uri newUri))
if (args.Cancel && Uri.TryCreate(args.Uri, UriKind.Absolute, out Uri? newUri) && newUri != null)
{
await Launcher.LaunchUriAsync(newUri);
}
@@ -242,7 +242,7 @@ public sealed partial class MailRenderingPage : MailRenderingPageAbstract,
{
if (e.ClickedItem is MailAttachmentViewModel attachmentViewModel)
{
ViewModel.OpenAttachmentCommand.Execute(attachmentViewModel);
ViewModel?.OpenAttachmentCommand.Execute(attachmentViewModel);
}
}