Fix merge conflicts

This commit is contained in:
Aleh Khantsevich
2024-06-13 01:42:19 +02:00
31 changed files with 484 additions and 33 deletions

View File

@@ -215,7 +215,7 @@ namespace Wino.Core.Services
public async Task<List<MailAccount>> GetAccountsAsync()
{
var accounts = await Connection.Table<MailAccount>().ToListAsync();
var accounts = await Connection.Table<MailAccount>().OrderBy(a => a.Order).ToListAsync();
foreach (var account in accounts)
{
@@ -299,12 +299,21 @@ namespace Wino.Core.Services
{
var account = await Connection.Table<MailAccount>().FirstOrDefaultAsync(a => a.Id == accountId);
if (account?.ProviderType == MailProviderType.IMAP4)
account.ServerInformation = await GetAccountCustomServerInformationAsync(account.Id);
if (account == null)
{
_logger.Error("Could not find account with id {AccountId}", accountId);
}
else
{
if (account.ProviderType == MailProviderType.IMAP4)
account.ServerInformation = await GetAccountCustomServerInformationAsync(account.Id);
account.Preferences = await GetAccountPreferencesAsync(account.Id);
account.Preferences = await GetAccountPreferencesAsync(account.Id);
return account;
return account;
}
return null;
}
public Task<CustomServerInformation> GetAccountCustomServerInformationAsync(Guid accountId)
@@ -334,6 +343,12 @@ namespace Wino.Core.Services
{
_preferencesService.StartupEntityId = account.Id;
}
else
{
// Set the order of the account.
// This can be changed by the user later in manage accounts page.
account.Order = accountCount;
}
await Connection.InsertAsync(account);
@@ -350,6 +365,8 @@ namespace Wino.Core.Services
// Outlook & Office 365 supports Focused inbox. Enabled by default.
bool isMicrosoftProvider = account.ProviderType == MailProviderType.Outlook || account.ProviderType == MailProviderType.Office365;
// TODO: This should come from account settings API.
// Wino doesn't have MailboxSettings yet.
if (isMicrosoftProvider)
account.Preferences.IsFocusedInboxEnabled = true;
@@ -397,5 +414,25 @@ namespace Wino.Core.Services
return account.SynchronizationDeltaIdentifier;
}
public async Task UpdateAccountOrdersAsync(Dictionary<Guid, int> accountIdOrderPair)
{
foreach (var pair in accountIdOrderPair)
{
var account = await GetAccountAsync(pair.Key);
if (account == null)
{
_logger.Information("Could not find account with id {Key} for reordering. It may be a linked account.", pair.Key);
continue;
}
account.Order = pair.Value;
await Connection.UpdateAsync(account);
}
Messenger.Send(new AccountMenuItemsReordered(accountIdOrderPair));
}
}
}

View File

@@ -21,7 +21,7 @@ namespace Wino.Core.Services
{
public class MailService : BaseDatabaseService, IMailService
{
private const int ItemLoadCount = 20;
private const int ItemLoadCount = 100;
private readonly IFolderService _folderService;
private readonly IContactService _contactService;
@@ -415,6 +415,14 @@ namespace Wino.Core.Services
await Connection.DeleteAsync(mailCopy).ConfigureAwait(false);
// If there are no more copies exists of the same mail, delete the MIME file as well.
var isMailExists = await IsMailExistsAsync(mailCopy.Id).ConfigureAwait(false);
if (!isMailExists)
{
await _mimeFileService.DeleteMimeMessageAsync(mailCopy.AssignedAccount.Id, mailCopy.FileId).ConfigureAwait(false);
}
ReportUIChange(new MailRemovedMessage(mailCopy));
}