1 Commits

Author SHA1 Message Date
Aleh Khantsevich
815295e548 fix save imap settings and progress ring.
Added notification that settings saved.
2025-07-04 00:48:34 +02:00
5 changed files with 29 additions and 19 deletions

View File

@@ -170,4 +170,5 @@ public interface IAccountService
/// <param name="accountId">Account id.</param> /// <param name="accountId">Account id.</param>
/// <returns>Whether the notifications should be created after sync or not.</returns> /// <returns>Whether the notifications should be created after sync or not.</returns>
Task<bool> IsNotificationsEnabled(Guid accountId); Task<bool> IsNotificationsEnabled(Guid accountId);
Task UpdateAccountCustomServerInformationAsync(CustomServerInformation customServerInformation);
} }

View File

@@ -262,6 +262,8 @@
"IMAPSetupDialog_AccountType": "Account type", "IMAPSetupDialog_AccountType": "Account type",
"IMAPSetupDialog_ValidationSuccess_Title": "Success", "IMAPSetupDialog_ValidationSuccess_Title": "Success",
"IMAPSetupDialog_ValidationSuccess_Message": "Validation successful", "IMAPSetupDialog_ValidationSuccess_Message": "Validation successful",
"IMAPSetupDialog_SaveImapSuccess_Title": "Success",
"IMAPSetupDialog_SaveImapSuccess_Message": "IMAP settings saved successfuly.",
"IMAPSetupDialog_ValidationFailed_Title": "IMAP Server validation failed.", "IMAPSetupDialog_ValidationFailed_Title": "IMAP Server validation failed.",
"IMAPSetupDialog_CertificateAllowanceRequired_Row0": "This server is requesting a SSL handshake to continue. Please confirm the certificate details below.", "IMAPSetupDialog_CertificateAllowanceRequired_Row0": "This server is requesting a SSL handshake to continue. Please confirm the certificate details below.",
"IMAPSetupDialog_CertificateAllowanceRequired_Row1": "Allow the handshake to continue setting up your account.", "IMAPSetupDialog_CertificateAllowanceRequired_Row1": "Allow the handshake to continue setting up your account.",

View File

@@ -98,19 +98,13 @@ public partial class EditAccountDetailsPageViewModel : MailBaseViewModel
Messenger.Send(new BackBreadcrumNavigationRequested()); Messenger.Send(new BackBreadcrumNavigationRequested());
} }
[RelayCommand]
private Task SaveWithoutGoBackAsync()
{
return UpdateAccountAsync();
}
[RelayCommand] [RelayCommand]
private async Task ValidateImapSettingsAsync() private async Task ValidateImapSettingsAsync()
{ {
try try
{ {
await _imapTestService.TestImapConnectionAsync(ServerInformation, true); await _imapTestService.TestImapConnectionAsync(ServerInformation, true);
_mailDialogService.InfoBarMessage(Translator.IMAPSetupDialog_ValidationSuccess_Title, Translator.IMAPSetupDialog_ValidationSuccess_Message, Core.Domain.Enums.InfoBarMessageType.Success); ; _mailDialogService.InfoBarMessage(Translator.IMAPSetupDialog_ValidationSuccess_Title, Translator.IMAPSetupDialog_ValidationSuccess_Message, Core.Domain.Enums.InfoBarMessageType.Success);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -118,12 +112,9 @@ public partial class EditAccountDetailsPageViewModel : MailBaseViewModel
} }
} }
private Task UpdateAccountAsync() [RelayCommand]
private async Task UpdateCustomServerInformationAsync()
{ {
Account.Name = AccountName;
Account.SenderName = SenderName;
Account.AccountColorHex = SelectedColor == null ? string.Empty : SelectedColor.Hex;
if (ServerInformation != null) if (ServerInformation != null)
{ {
ServerInformation.IncomingAuthenticationMethod = AvailableAuthenticationMethods[SelectedIncomingServerAuthenticationMethodIndex].ImapAuthenticationMethod; ServerInformation.IncomingAuthenticationMethod = AvailableAuthenticationMethods[SelectedIncomingServerAuthenticationMethodIndex].ImapAuthenticationMethod;
@@ -135,6 +126,17 @@ public partial class EditAccountDetailsPageViewModel : MailBaseViewModel
Account.ServerInformation = ServerInformation; Account.ServerInformation = ServerInformation;
} }
await _accountService.UpdateAccountCustomServerInformationAsync(Account.ServerInformation);
_mailDialogService.InfoBarMessage(Translator.IMAPSetupDialog_SaveImapSuccess_Title, Translator.IMAPSetupDialog_SaveImapSuccess_Message, Core.Domain.Enums.InfoBarMessageType.Success);
}
private Task UpdateAccountAsync()
{
Account.Name = AccountName;
Account.SenderName = SenderName;
Account.AccountColorHex = SelectedColor == null ? string.Empty : SelectedColor.Hex;
return _accountService.UpdateAccountAsync(Account); return _accountService.UpdateAccountAsync(Account);
} }

View File

@@ -11,7 +11,7 @@
xmlns:helpers="using:Wino.Helpers" xmlns:helpers="using:Wino.Helpers"
xmlns:imapsetup="using:Wino.Views.ImapSetup" xmlns:imapsetup="using:Wino.Views.ImapSetup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:picker="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"> mc:Ignorable="d">
<ScrollViewer> <ScrollViewer>
@@ -118,7 +118,7 @@
Header="{x:Bind domain:Translator.IMAPSetupDialog_IncomingMailServer}" Header="{x:Bind domain:Translator.IMAPSetupDialog_IncomingMailServer}"
Text="{x:Bind ViewModel.ServerInformation.IncomingServer, Mode=TwoWay}" /> Text="{x:Bind ViewModel.ServerInformation.IncomingServer, Mode=TwoWay}" />
<picker:NumberBox <muxc:NumberBox
Grid.Row="2" Grid.Row="2"
Header="{x:Bind domain:Translator.IMAPSetupDialog_IncomingMailServerPort}" Header="{x:Bind domain:Translator.IMAPSetupDialog_IncomingMailServerPort}"
Maximum="65535" Maximum="65535"
@@ -169,7 +169,7 @@
Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServer}" Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServer}"
Text="{x:Bind ViewModel.ServerInformation.OutgoingServer, Mode=TwoWay}" /> Text="{x:Bind ViewModel.ServerInformation.OutgoingServer, Mode=TwoWay}" />
<picker:NumberBox <muxc:NumberBox
Grid.Row="2" Grid.Row="2"
Grid.Column="2" Grid.Column="2"
Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServerPort}" Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServerPort}"
@@ -215,13 +215,13 @@
Orientation="Horizontal" Orientation="Horizontal"
Spacing="12"> Spacing="12">
<ProgressRing <muxc:ProgressRing
Width="5" Width="20"
Height="5" Height="20"
IsActive="{x:Bind ViewModel.ValidateImapSettingsCommand.IsRunning, Mode=OneWay}" /> IsActive="{x:Bind ViewModel.ValidateImapSettingsCommand.IsRunning, Mode=OneWay}" />
<Button Command="{x:Bind ViewModel.ValidateImapSettingsCommand}" Content="Test" /> <Button Command="{x:Bind ViewModel.ValidateImapSettingsCommand}" Content="Test" />
<Button <Button
Command="{x:Bind ViewModel.SaveWithoutGoBackCommand}" Command="{x:Bind ViewModel.UpdateCustomServerInformationCommand}"
Content="{x:Bind domain:Translator.Buttons_Save}" Content="{x:Bind domain:Translator.Buttons_Save}"
Style="{ThemeResource AccentButtonStyle}" /> Style="{ThemeResource AccentButtonStyle}" />
</StackPanel> </StackPanel>

View File

@@ -408,6 +408,11 @@ public class AccountService : BaseDatabaseService, IAccountService
ReportUIChange(new AccountUpdatedMessage(account)); ReportUIChange(new AccountUpdatedMessage(account));
} }
public async Task UpdateAccountCustomServerInformationAsync(CustomServerInformation customServerInformation)
{
await Connection.UpdateAsync(customServerInformation).ConfigureAwait(false);
}
public async Task UpdateAccountAliasesAsync(Guid accountId, List<MailAccountAlias> aliases) public async Task UpdateAccountAliasesAsync(Guid accountId, List<MailAccountAlias> aliases)
{ {
// Delete existing ones. // Delete existing ones.