Sender name implementation.
This commit is contained in:
@@ -11,6 +11,10 @@ namespace Wino.Core.Domain.Entities
|
|||||||
|
|
||||||
public Guid AccountId { get; set; }
|
public Guid AccountId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This field is ignored. DisplayName is stored in MailAccount as SenderName from now.
|
||||||
|
/// </summary>
|
||||||
|
[Ignore]
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
public string IncomingServer { get; set; }
|
public string IncomingServer { get; set; }
|
||||||
@@ -39,7 +43,7 @@ namespace Wino.Core.Domain.Entities
|
|||||||
|
|
||||||
public string ProxyServer { get; set; }
|
public string ProxyServer { get; set; }
|
||||||
public string ProxyServerPort { get; set; }
|
public string ProxyServerPort { get; set; }
|
||||||
|
|
||||||
[Obsolete("As 1.7.0")]
|
[Obsolete("As 1.7.0")]
|
||||||
public bool IncomingRequiresSSL { get; set; }
|
public bool IncomingRequiresSSL { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Wino.Core.Domain.Entities
|
|||||||
/// IMAP is populated by user on setup dialog.
|
/// IMAP is populated by user on setup dialog.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public string ProfileName { get; set; }
|
public string SenderName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Account e-mail address.
|
/// Account e-mail address.
|
||||||
@@ -39,6 +39,11 @@ namespace Wino.Core.Domain.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string SynchronizationDeltaIdentifier { get; set; }
|
public string SynchronizationDeltaIdentifier { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// TODO: Gets or sets the custom account identifier color in hex.
|
||||||
|
/// </summary>
|
||||||
|
public string AccountColorHex { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the signature to be used for this account.
|
/// Gets or sets the signature to be used for this account.
|
||||||
/// Null if no signature should be used.
|
/// Null if no signature should be used.
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ namespace Wino.Core.Domain.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsNotificationsEnabled { get; set; }
|
public bool IsNotificationsEnabled { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the custom account identifier color in hex.
|
|
||||||
/// </summary>
|
|
||||||
public string AccountColorHex { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether the account has Focused inbox support.
|
/// Gets or sets whether the account has Focused inbox support.
|
||||||
/// Null if the account provider type doesn't support Focused inbox.
|
/// Null if the account provider type doesn't support Focused inbox.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wino.Core.Domain.Entities;
|
using Wino.Core.Domain.Entities;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
|
using Wino.Core.Domain.Models.Accounts;
|
||||||
using Wino.Core.Domain.Models.Folders;
|
using Wino.Core.Domain.Models.Folders;
|
||||||
|
|
||||||
namespace Wino.Core.Domain.Interfaces
|
namespace Wino.Core.Domain.Interfaces
|
||||||
@@ -25,7 +26,7 @@ namespace Wino.Core.Domain.Interfaces
|
|||||||
|
|
||||||
// Custom dialogs
|
// Custom dialogs
|
||||||
Task<IMailItemFolder> ShowMoveMailFolderDialogAsync(List<IMailItemFolder> availableFolders);
|
Task<IMailItemFolder> ShowMoveMailFolderDialogAsync(List<IMailItemFolder> availableFolders);
|
||||||
Task<Tuple<string, MailProviderType>> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders);
|
Task<AccountCreationDialogResult> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders);
|
||||||
IAccountCreationDialog GetAccountCreationDialog(MailProviderType type);
|
IAccountCreationDialog GetAccountCreationDialog(MailProviderType type);
|
||||||
Task<string> ShowTextInputDialogAsync(string currentInput, string dialogTitle, string dialogDescription);
|
Task<string> ShowTextInputDialogAsync(string currentInput, string dialogTitle, string dialogDescription);
|
||||||
Task<MailAccount> ShowEditAccountDialogAsync(MailAccount account);
|
Task<MailAccount> ShowEditAccountDialogAsync(MailAccount account);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using Wino.Core.Domain.Enums;
|
||||||
|
|
||||||
|
namespace Wino.Core.Domain.Models.Accounts
|
||||||
|
{
|
||||||
|
public record AccountCreationDialogResult(MailProviderType ProviderType, string AccountName, string SenderName, string AccountColorHex = "");
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
"AccountEditDialog_Message": "Account Name",
|
"AccountEditDialog_Message": "Account Name",
|
||||||
"AccountEditDialog_Title": "Edit Account",
|
"AccountEditDialog_Title": "Edit Account",
|
||||||
"AccountPickerDialog_Title": "Pick an account",
|
"AccountPickerDialog_Title": "Pick an account",
|
||||||
|
"AccountSettingsDialog_AccountName": "Sender Display Name",
|
||||||
|
"AccountSettingsDialog_AccountNamePlaceholder": "eg. John Doe",
|
||||||
"AddHyperlink": "Add",
|
"AddHyperlink": "Add",
|
||||||
"AutoDiscoveryProgressMessage": "Searching for mail settings...",
|
"AutoDiscoveryProgressMessage": "Searching for mail settings...",
|
||||||
"BasicIMAPSetupDialog_AdvancedConfiguration": "Advanced Configuration",
|
"BasicIMAPSetupDialog_AdvancedConfiguration": "Advanced Configuration",
|
||||||
|
|||||||
522
Wino.Core.Domain/Translator.Designer.cs
generated
522
Wino.Core.Domain/Translator.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -58,14 +58,7 @@ namespace Wino.Core.Services
|
|||||||
|
|
||||||
string fromName;
|
string fromName;
|
||||||
|
|
||||||
if (isImapAccount)
|
fromName = composerAccount.SenderName;
|
||||||
fromName = composerAccount.ServerInformation.DisplayName;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var composerContact = await _contactService.GetAddressInformationByAddressAsync(composerAccount.Address);
|
|
||||||
|
|
||||||
fromName = composerContact?.Name ?? composerAccount.Address;
|
|
||||||
}
|
|
||||||
|
|
||||||
var draftFolder = await _folderService.GetSpecialFolderByAccountIdAsync(composerAccount.Id, SpecialFolderType.Draft);
|
var draftFolder = await _folderService.GetSpecialFolderByAccountIdAsync(composerAccount.Id, SpecialFolderType.Draft);
|
||||||
|
|
||||||
@@ -629,19 +622,7 @@ namespace Wino.Core.Services
|
|||||||
var reason = draftCreationOptions.Reason;
|
var reason = draftCreationOptions.Reason;
|
||||||
var referenceMessage = draftCreationOptions.ReferenceMimeMessage;
|
var referenceMessage = draftCreationOptions.ReferenceMimeMessage;
|
||||||
|
|
||||||
// For API synchronizers we should get this from contacts.
|
message.From.Add(new MailboxAddress(account.SenderName, account.Address));
|
||||||
if (account.ServerInformation == null)
|
|
||||||
{
|
|
||||||
var fromContact = await _contactService.GetAddressInformationByAddressAsync(account.Address).ConfigureAwait(false)
|
|
||||||
?? new AddressInformation() { Name = account.Address, Address = account.Address };
|
|
||||||
|
|
||||||
message.From.Add(new MailboxAddress(fromContact.Name, fromContact.Address));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// For IMAP synchronizer, we have already Display Name in the settings.
|
|
||||||
message.From.Add(new MailboxAddress(account.ServerInformation.DisplayName, account.ServerInformation.Address));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manage "To"
|
// Manage "To"
|
||||||
if (reason == DraftCreationReason.Reply || reason == DraftCreationReason.ReplyAll)
|
if (reason == DraftCreationReason.Reply || reason == DraftCreationReason.ReplyAll)
|
||||||
|
|||||||
@@ -146,23 +146,22 @@ namespace Wino.Mail.ViewModels
|
|||||||
var providers = _providerService.GetProviderDetails();
|
var providers = _providerService.GetProviderDetails();
|
||||||
|
|
||||||
// Select provider.
|
// Select provider.
|
||||||
var accountInformationTuple = await _dialogService.ShowNewAccountMailProviderDialogAsync(providers);
|
var accountCreationDialogResult = await _dialogService.ShowNewAccountMailProviderDialogAsync(providers);
|
||||||
|
|
||||||
if (accountInformationTuple != null)
|
if (accountCreationDialogResult != null)
|
||||||
{
|
{
|
||||||
creationDialog = _dialogService.GetAccountCreationDialog(accountInformationTuple.Item2);
|
creationDialog = _dialogService.GetAccountCreationDialog(accountCreationDialogResult.ProviderType);
|
||||||
|
|
||||||
var accountName = accountInformationTuple.Item1;
|
_accountService.ExternalAuthenticationAuthenticator = _authenticationProvider.GetAuthenticator(accountCreationDialogResult.ProviderType);
|
||||||
var providerType = accountInformationTuple.Item2;
|
|
||||||
|
|
||||||
_accountService.ExternalAuthenticationAuthenticator = _authenticationProvider.GetAuthenticator(providerType);
|
|
||||||
|
|
||||||
CustomServerInformation customServerInformation = null;
|
CustomServerInformation customServerInformation = null;
|
||||||
|
|
||||||
createdAccount = new MailAccount()
|
createdAccount = new MailAccount()
|
||||||
{
|
{
|
||||||
ProviderType = providerType,
|
ProviderType = accountCreationDialogResult.ProviderType,
|
||||||
Name = accountName,
|
Name = accountCreationDialogResult.AccountName,
|
||||||
|
SenderName = accountCreationDialogResult.SenderName,
|
||||||
|
AccountColorHex = accountCreationDialogResult.AccountColorHex,
|
||||||
Id = Guid.NewGuid()
|
Id = Guid.NewGuid()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -184,6 +183,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
createdAccount.Address = customServerInformation.Address;
|
createdAccount.Address = customServerInformation.Address;
|
||||||
createdAccount.ServerInformation = customServerInformation;
|
createdAccount.ServerInformation = customServerInformation;
|
||||||
|
createdAccount.SenderName = customServerInformation.DisplayName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
clickedBaseAccountMenuItem.IsSelected = true;
|
clickedBaseAccountMenuItem.IsSelected = true;
|
||||||
|
|
||||||
|
|
||||||
latestSelectedAccountMenuItem = clickedBaseAccountMenuItem;
|
latestSelectedAccountMenuItem = clickedBaseAccountMenuItem;
|
||||||
|
|
||||||
|
|||||||
@@ -42,22 +42,32 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ContentDialog.Resources>
|
</ContentDialog.Resources>
|
||||||
|
|
||||||
<Grid MinWidth="400">
|
<Grid MinWidth="400" RowSpacing="12">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Info panel -->
|
<!-- Account Name -->
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="AccountNameTextbox"
|
x:Name="AccountNameTextbox"
|
||||||
Header="{x:Bind domain:Translator.NewAccountDialog_AccountName}"
|
Header="{x:Bind domain:Translator.NewAccountDialog_AccountName}"
|
||||||
Text="{x:Bind domain:Translator.NewAccountDialog_AccountNameDefaultValue}"
|
|
||||||
PlaceholderText="{x:Bind domain:Translator.NewAccountDialog_AccountNamePlaceholder}"
|
PlaceholderText="{x:Bind domain:Translator.NewAccountDialog_AccountNamePlaceholder}"
|
||||||
TextChanged="AccountNameChanged" />
|
TextChanged="AccountNameChanged" />
|
||||||
|
|
||||||
<!-- TODO -->
|
<!-- Sender Name -->
|
||||||
|
<TextBox
|
||||||
|
x:Name="SenderNameTextbox"
|
||||||
|
Grid.Row="1"
|
||||||
|
Header="{x:Bind domain:Translator.AccountSettingsDialog_AccountName}"
|
||||||
|
PlaceholderText="{x:Bind domain:Translator.AccountSettingsDialog_AccountNamePlaceholder}"
|
||||||
|
TextChanged="SenderNameChanged" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
TODO: Move Name, Sender Name and Color Picker to another Frame.
|
||||||
|
Provider selection should be first, then account details.
|
||||||
|
-->
|
||||||
<!--<Grid Grid.Row="1">
|
<!--<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain.Enums;
|
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models.Accounts;
|
using Wino.Core.Domain.Models.Accounts;
|
||||||
|
|
||||||
@@ -25,7 +23,7 @@ namespace Wino.Dialogs
|
|||||||
|
|
||||||
public List<IProviderDetail> Providers { get; set; }
|
public List<IProviderDetail> Providers { get; set; }
|
||||||
|
|
||||||
public Tuple<string, MailProviderType> AccountInformationTuple = null;
|
public AccountCreationDialogResult Result = null;
|
||||||
|
|
||||||
public NewAccountDialog()
|
public NewAccountDialog()
|
||||||
{
|
{
|
||||||
@@ -51,22 +49,21 @@ namespace Wino.Dialogs
|
|||||||
|
|
||||||
if (IsSecondaryButtonEnabled)
|
if (IsSecondaryButtonEnabled)
|
||||||
{
|
{
|
||||||
AccountInformationTuple = new Tuple<string, MailProviderType>(AccountNameTextbox.Text.Trim(), SelectedMailProvider.Type);
|
Result = new AccountCreationDialogResult(SelectedMailProvider.Type, AccountNameTextbox.Text.Trim(), SenderNameTextbox.Text.Trim());
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AccountNameChanged(object sender, TextChangedEventArgs e)
|
private void AccountNameChanged(object sender, TextChangedEventArgs e) => ValidateCreateButton();
|
||||||
{
|
private void SenderNameChanged(object sender, TextChangedEventArgs e) => ValidateCreateButton();
|
||||||
ValidateCreateButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns whether we can create account or not.
|
// Returns whether we can create account or not.
|
||||||
private void ValidateCreateButton()
|
private void ValidateCreateButton()
|
||||||
{
|
{
|
||||||
bool shouldEnable = SelectedMailProvider != null
|
bool shouldEnable = SelectedMailProvider != null
|
||||||
&& SelectedMailProvider.IsSupported
|
&& SelectedMailProvider.IsSupported
|
||||||
&& !string.IsNullOrEmpty(AccountNameTextbox.Text);
|
&& !string.IsNullOrEmpty(AccountNameTextbox.Text)
|
||||||
|
&& !string.IsNullOrWhiteSpace(SenderNameTextbox.Text);
|
||||||
|
|
||||||
IsPrimaryButtonEnabled = shouldEnable;
|
IsPrimaryButtonEnabled = shouldEnable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Wino.Core.Domain;
|
|||||||
using Wino.Core.Domain.Entities;
|
using Wino.Core.Domain.Entities;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
|
using Wino.Core.Domain.Models.Accounts;
|
||||||
using Wino.Core.Domain.Models.Folders;
|
using Wino.Core.Domain.Models.Folders;
|
||||||
using Wino.Core.Domain.Models.Synchronization;
|
using Wino.Core.Domain.Models.Synchronization;
|
||||||
using Wino.Core.Messages.Shell;
|
using Wino.Core.Messages.Shell;
|
||||||
@@ -108,7 +109,7 @@ namespace Wino.Services
|
|||||||
return await HandleDialogPresentation(() => dialog.ShowDialogAsync(title, question, confirmationButtonTitle));
|
return await HandleDialogPresentation(() => dialog.ShowDialogAsync(title, question, confirmationButtonTitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tuple<string, MailProviderType>> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders)
|
public async Task<AccountCreationDialogResult> ShowNewAccountMailProviderDialogAsync(List<IProviderDetail> availableProviders)
|
||||||
{
|
{
|
||||||
var dialog = new NewAccountDialog
|
var dialog = new NewAccountDialog
|
||||||
{
|
{
|
||||||
@@ -118,7 +119,7 @@ namespace Wino.Services
|
|||||||
|
|
||||||
await HandleDialogPresentationAsync(dialog);
|
await HandleDialogPresentationAsync(dialog);
|
||||||
|
|
||||||
return dialog.AccountInformationTuple;
|
return dialog.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAccountCreationDialog GetAccountCreationDialog(MailProviderType type)
|
public IAccountCreationDialog GetAccountCreationDialog(MailProviderType type)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ using Microsoft.AppCenter.Analytics;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using Wino.Core.Domain.Interfaces;
|
|
||||||
using Wino.Core.Domain.Entities;
|
using Wino.Core.Domain.Entities;
|
||||||
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models.AutoDiscovery;
|
using Wino.Core.Domain.Models.AutoDiscovery;
|
||||||
using Wino.Core.Messages.Mails;
|
using Wino.Core.Messages.Mails;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
|
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
|
||||||
<GenerateTestArtifacts>True</GenerateTestArtifacts>
|
<GenerateTestArtifacts>True</GenerateTestArtifacts>
|
||||||
<AppxBundle>Always</AppxBundle>
|
<AppxBundle>Always</AppxBundle>
|
||||||
<AppxBundlePlatforms>arm64</AppxBundlePlatforms>
|
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
|
||||||
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
|
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
|
||||||
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
|
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
|
||||||
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
|
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
|
||||||
@@ -880,4 +880,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user