Removed IWinoSynchronizerFactory from UWP project.
This commit is contained in:
@@ -12,6 +12,8 @@ namespace Wino.Core.Domain.Interfaces
|
|||||||
WinoServerConnectionStatus Status { get; }
|
WinoServerConnectionStatus Status { get; }
|
||||||
event EventHandler<WinoServerConnectionStatus> StatusChanged;
|
event EventHandler<WinoServerConnectionStatus> StatusChanged;
|
||||||
void DisposeConnection();
|
void DisposeConnection();
|
||||||
|
|
||||||
|
void QueueRequest(IRequestBase request, Guid accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IWinoServerConnectionManager<TAppServiceConnection> : IWinoServerConnectionManager, IInitializeAsync
|
public interface IWinoServerConnectionManager<TAppServiceConnection> : IWinoServerConnectionManager, IInitializeAsync
|
||||||
|
|||||||
@@ -7,6 +7,5 @@ namespace Wino.Core.Domain.Interfaces
|
|||||||
{
|
{
|
||||||
IBaseSynchronizer GetAccountSynchronizer(Guid accountId);
|
IBaseSynchronizer GetAccountSynchronizer(Guid accountId);
|
||||||
IBaseSynchronizer CreateNewSynchronizer(MailAccount account);
|
IBaseSynchronizer CreateNewSynchronizer(MailAccount account);
|
||||||
void DeleteSynchronizer(MailAccount account);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
<LangVersion>12.0</LangVersion>
|
<LangVersion>12.0</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Interfaces\IWinoSynchronizerFactory.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Translations\ca_ES\resources.json" />
|
<None Remove="Translations\ca_ES\resources.json" />
|
||||||
<None Remove="Translations\cs_CZ\resources.json" />
|
<None Remove="Translations\cs_CZ\resources.json" />
|
||||||
|
|||||||
@@ -195,5 +195,10 @@ namespace Wino.Core.UWP.Services
|
|||||||
{
|
{
|
||||||
if (Connection == null) return;
|
if (Connection == null) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void QueueRequest(IRequestBase request, Guid accountId)
|
||||||
|
{
|
||||||
|
// TODO: Queue this request to corresponding account's synchronizer request queue.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace Wino.Core
|
|||||||
|
|
||||||
services.AddSingleton<ITranslationService, TranslationService>();
|
services.AddSingleton<ITranslationService, TranslationService>();
|
||||||
services.AddSingleton<IDatabaseService, DatabaseService>();
|
services.AddSingleton<IDatabaseService, DatabaseService>();
|
||||||
services.AddSingleton<IWinoSynchronizerFactory, WinoSynchronizerFactory>();
|
|
||||||
services.AddSingleton<IThreadingStrategyProvider, ThreadingStrategyProvider>();
|
services.AddSingleton<IThreadingStrategyProvider, ThreadingStrategyProvider>();
|
||||||
services.AddSingleton<IMimeFileService, MimeFileService>();
|
services.AddSingleton<IMimeFileService, MimeFileService>();
|
||||||
|
|
||||||
|
|||||||
@@ -19,19 +19,18 @@ namespace Wino.Core.Services
|
|||||||
public class WinoRequestDelegator : IWinoRequestDelegator
|
public class WinoRequestDelegator : IWinoRequestDelegator
|
||||||
{
|
{
|
||||||
private readonly IWinoRequestProcessor _winoRequestProcessor;
|
private readonly IWinoRequestProcessor _winoRequestProcessor;
|
||||||
private readonly IWinoSynchronizerFactory _winoSynchronizerFactory;
|
private readonly IWinoServerConnectionManager _winoServerConnectionManager;
|
||||||
|
|
||||||
private readonly IFolderService _folderService;
|
private readonly IFolderService _folderService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly ILogger _logger = Log.ForContext<WinoRequestDelegator>();
|
private readonly ILogger _logger = Log.ForContext<WinoRequestDelegator>();
|
||||||
|
|
||||||
public WinoRequestDelegator(IWinoRequestProcessor winoRequestProcessor,
|
public WinoRequestDelegator(IWinoRequestProcessor winoRequestProcessor,
|
||||||
IWinoSynchronizerFactory winoSynchronizerFactory,
|
IWinoServerConnectionManager winoServerConnectionManager,
|
||||||
IFolderService folderService,
|
IFolderService folderService,
|
||||||
IDialogService dialogService)
|
IDialogService dialogService)
|
||||||
{
|
{
|
||||||
_winoRequestProcessor = winoRequestProcessor;
|
_winoRequestProcessor = winoRequestProcessor;
|
||||||
_winoSynchronizerFactory = winoSynchronizerFactory;
|
_winoServerConnectionManager = winoServerConnectionManager;
|
||||||
_folderService = folderService;
|
_folderService = folderService;
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
}
|
}
|
||||||
@@ -133,19 +132,7 @@ namespace Wino.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void QueueRequest(IRequestBase request, Guid accountId)
|
private void QueueRequest(IRequestBase request, Guid accountId)
|
||||||
{
|
=> _winoServerConnectionManager.QueueRequest(request, accountId);
|
||||||
var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(accountId);
|
|
||||||
|
|
||||||
if (synchronizer == null)
|
|
||||||
{
|
|
||||||
_logger.Warning("Synchronizer not found for account {AccountId}.", accountId);
|
|
||||||
_logger.Warning("Skipping queueing request {Operation}.", request.Operation);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronizer.QueueRequest(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void QueueSynchronization(Guid accountId)
|
private void QueueSynchronization(Guid accountId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
<LangVersion>12</LangVersion>
|
<LangVersion>12</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="WinoSynchronizerFactory.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
|
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
{
|
{
|
||||||
public partial class AccountDetailsPageViewModel : BaseViewModel
|
public partial class AccountDetailsPageViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
private readonly IWinoSynchronizerFactory _synchronizerFactory;
|
|
||||||
private readonly IAccountService _accountService;
|
private readonly IAccountService _accountService;
|
||||||
private readonly IFolderService _folderService;
|
private readonly IFolderService _folderService;
|
||||||
|
|
||||||
@@ -44,11 +43,9 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
|
|
||||||
public AccountDetailsPageViewModel(IDialogService dialogService,
|
public AccountDetailsPageViewModel(IDialogService dialogService,
|
||||||
IWinoSynchronizerFactory synchronizerFactory,
|
|
||||||
IAccountService accountService,
|
IAccountService accountService,
|
||||||
IFolderService folderService) : base(dialogService)
|
IFolderService folderService) : base(dialogService)
|
||||||
{
|
{
|
||||||
_synchronizerFactory = synchronizerFactory;
|
|
||||||
_accountService = accountService;
|
_accountService = accountService;
|
||||||
_folderService = folderService;
|
_folderService = folderService;
|
||||||
}
|
}
|
||||||
@@ -98,10 +95,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
await _accountService.DeleteAccountAsync(Account);
|
await _accountService.DeleteAccountAsync(Account);
|
||||||
|
|
||||||
_synchronizerFactory.DeleteSynchronizer(Account);
|
// TODO: Server: Cancel ongoing calls from server for this account.
|
||||||
|
|
||||||
// TODO: Clear existing requests.
|
|
||||||
// _synchronizationWorker.ClearRequests(Account.Id);
|
|
||||||
|
|
||||||
DialogService.InfoBarMessage(Translator.Info_AccountDeletedTitle, string.Format(Translator.Info_AccountDeletedMessage, Account.Name), InfoBarMessageType.Success);
|
DialogService.InfoBarMessage(Translator.Info_AccountDeletedTitle, string.Format(Translator.Info_AccountDeletedMessage, Account.Name), InfoBarMessageType.Success);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ using Wino.Core.Domain.Exceptions;
|
|||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models.Navigation;
|
using Wino.Core.Domain.Models.Navigation;
|
||||||
using Wino.Core.Domain.Models.Store;
|
using Wino.Core.Domain.Models.Store;
|
||||||
using Wino.Core.Domain.Models.Synchronization;
|
|
||||||
using Wino.Core.Messages.Authorization;
|
using Wino.Core.Messages.Authorization;
|
||||||
using Wino.Core.Messages.Navigation;
|
using Wino.Core.Messages.Navigation;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
@@ -35,7 +34,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
private readonly IStoreManagementService _storeManagementService;
|
private readonly IStoreManagementService _storeManagementService;
|
||||||
private readonly IPreferencesService _preferencesService;
|
private readonly IPreferencesService _preferencesService;
|
||||||
private readonly IAuthenticationProvider _authenticationProvider;
|
private readonly IAuthenticationProvider _authenticationProvider;
|
||||||
private readonly IWinoSynchronizerFactory _synchronizerFactory;
|
|
||||||
|
|
||||||
public ObservableCollection<IAccountProviderDetailViewModel> Accounts { get; set; } = [];
|
public ObservableCollection<IAccountProviderDetailViewModel> Accounts { get; set; } = [];
|
||||||
|
|
||||||
@@ -60,7 +58,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
public AccountManagementViewModel(IDialogService dialogService,
|
public AccountManagementViewModel(IDialogService dialogService,
|
||||||
IWinoNavigationService navigationService,
|
IWinoNavigationService navigationService,
|
||||||
IWinoSynchronizerFactory synchronizerFactory,
|
|
||||||
IAccountService accountService,
|
IAccountService accountService,
|
||||||
IProviderService providerService,
|
IProviderService providerService,
|
||||||
IFolderService folderService,
|
IFolderService folderService,
|
||||||
@@ -69,7 +66,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
IAuthenticationProvider authenticationProvider) : base(dialogService)
|
IAuthenticationProvider authenticationProvider) : base(dialogService)
|
||||||
{
|
{
|
||||||
_accountService = accountService;
|
_accountService = accountService;
|
||||||
_synchronizerFactory = synchronizerFactory;
|
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
_providerService = providerService;
|
_providerService = providerService;
|
||||||
_folderService = folderService;
|
_folderService = folderService;
|
||||||
@@ -205,29 +201,31 @@ namespace Wino.Mail.ViewModels
|
|||||||
// Local account has been created.
|
// Local account has been created.
|
||||||
// Create new synchronizer and start synchronization.
|
// Create new synchronizer and start synchronization.
|
||||||
|
|
||||||
var synchronizer = _synchronizerFactory.CreateNewSynchronizer(createdAccount);
|
// TODO: Server: Make sure that server synchronizes folders and sends back the result.
|
||||||
|
|
||||||
if (creationDialog is ICustomServerAccountCreationDialog customServerAccountCreationDialog)
|
//var synchronizer = _synchronizerFactory.CreateNewSynchronizer(createdAccount);
|
||||||
customServerAccountCreationDialog.ShowPreparingFolders();
|
|
||||||
else
|
|
||||||
creationDialog.State = AccountCreationDialogState.PreparingFolders;
|
|
||||||
|
|
||||||
var options = new SynchronizationOptions()
|
//if (creationDialog is ICustomServerAccountCreationDialog customServerAccountCreationDialog)
|
||||||
{
|
// customServerAccountCreationDialog.ShowPreparingFolders();
|
||||||
AccountId = createdAccount.Id,
|
//else
|
||||||
Type = SynchronizationType.FoldersOnly
|
// creationDialog.State = AccountCreationDialogState.PreparingFolders;
|
||||||
};
|
|
||||||
|
|
||||||
var synchronizationResult = await synchronizer.SynchronizeAsync(options);
|
//var options = new SynchronizationOptions()
|
||||||
|
//{
|
||||||
|
// AccountId = createdAccount.Id,
|
||||||
|
// Type = SynchronizationType.FoldersOnly
|
||||||
|
//};
|
||||||
|
|
||||||
if (synchronizationResult.CompletedState != SynchronizationCompletedState.Success)
|
//var synchronizationResult = await synchronizer.SynchronizeAsync(options);
|
||||||
throw new Exception(Translator.Exception_FailedToSynchronizeFolders);
|
|
||||||
|
|
||||||
// Check if Inbox folder is available for the account after synchronization.
|
//if (synchronizationResult.CompletedState != SynchronizationCompletedState.Success)
|
||||||
var isInboxAvailable = await _folderService.IsInboxAvailableForAccountAsync(createdAccount.Id);
|
// throw new Exception(Translator.Exception_FailedToSynchronizeFolders);
|
||||||
|
|
||||||
if (!isInboxAvailable)
|
//// Check if Inbox folder is available for the account after synchronization.
|
||||||
throw new Exception(Translator.Exception_InboxNotAvailable);
|
//var isInboxAvailable = await _folderService.IsInboxAvailableForAccountAsync(createdAccount.Id);
|
||||||
|
|
||||||
|
//if (!isInboxAvailable)
|
||||||
|
// throw new Exception(Translator.Exception_InboxNotAvailable);
|
||||||
|
|
||||||
// Send changes to listeners.
|
// Send changes to listeners.
|
||||||
ReportUIChange(new AccountCreatedMessage(createdAccount));
|
ReportUIChange(new AccountCreatedMessage(createdAccount));
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
private readonly INotificationBuilder _notificationBuilder;
|
private readonly INotificationBuilder _notificationBuilder;
|
||||||
private readonly IWinoRequestDelegator _winoRequestDelegator;
|
private readonly IWinoRequestDelegator _winoRequestDelegator;
|
||||||
|
|
||||||
private readonly IWinoSynchronizerFactory _synchronizerFactory;
|
|
||||||
private readonly IBackgroundTaskService _backgroundTaskService;
|
private readonly IBackgroundTaskService _backgroundTaskService;
|
||||||
private readonly IMimeFileService _mimeFileService;
|
private readonly IMimeFileService _mimeFileService;
|
||||||
|
|
||||||
@@ -88,7 +87,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
public AppShellViewModel(IDialogService dialogService,
|
public AppShellViewModel(IDialogService dialogService,
|
||||||
IWinoNavigationService navigationService,
|
IWinoNavigationService navigationService,
|
||||||
IWinoSynchronizerFactory synchronizerFactory,
|
|
||||||
IBackgroundTaskService backgroundTaskService,
|
IBackgroundTaskService backgroundTaskService,
|
||||||
IMimeFileService mimeFileService,
|
IMimeFileService mimeFileService,
|
||||||
INativeAppService nativeAppService,
|
INativeAppService nativeAppService,
|
||||||
@@ -118,7 +116,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
PreferencesService = preferencesService;
|
PreferencesService = preferencesService;
|
||||||
NavigationService = navigationService;
|
NavigationService = navigationService;
|
||||||
|
|
||||||
_synchronizerFactory = synchronizerFactory;
|
|
||||||
_backgroundTaskService = backgroundTaskService;
|
_backgroundTaskService = backgroundTaskService;
|
||||||
_mimeFileService = mimeFileService;
|
_mimeFileService = mimeFileService;
|
||||||
_nativeAppService = nativeAppService;
|
_nativeAppService = nativeAppService;
|
||||||
@@ -791,65 +788,65 @@ namespace Wino.Mail.ViewModels
|
|||||||
await _winoRequestDelegator.ExecuteAsync(draftPreperationRequest);
|
await _winoRequestDelegator.ExecuteAsync(draftPreperationRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async void Receive(NewSynchronizationRequested message)
|
public async void Receive(NewSynchronizationRequested message)
|
||||||
{
|
{
|
||||||
|
// TODO: Queue new synchronization for an account.
|
||||||
|
|
||||||
// Don't send message for sync completion when we execute requests.
|
// Don't send message for sync completion when we execute requests.
|
||||||
// People are usually interested in seeing the notification after they trigger the synchronization.
|
// People are usually interested in seeing the notification after they trigger the synchronization.
|
||||||
|
|
||||||
bool shouldReportSynchronizationResult = message.Options.Type != SynchronizationType.ExecuteRequests;
|
//bool shouldReportSynchronizationResult = message.Options.Type != SynchronizationType.ExecuteRequests;
|
||||||
|
|
||||||
var synchronizer = _synchronizerFactory.GetAccountSynchronizer(message.Options.AccountId);
|
//var synchronizer = _synchronizerFactory.GetAccountSynchronizer(message.Options.AccountId);
|
||||||
|
|
||||||
if (synchronizer == null) return;
|
//if (synchronizer == null) return;
|
||||||
|
|
||||||
var accountId = message.Options.AccountId;
|
//var accountId = message.Options.AccountId;
|
||||||
|
|
||||||
message.Options.ProgressListener = this;
|
//message.Options.ProgressListener = this;
|
||||||
|
|
||||||
bool isSynchronizationSucceeded = false;
|
//bool isSynchronizationSucceeded = false;
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
// TODO: Cancellation Token
|
// // TODO: Cancellation Token
|
||||||
var synchronizationResult = await synchronizer.SynchronizeAsync(message.Options);
|
// var synchronizationResult = await synchronizer.SynchronizeAsync(message.Options);
|
||||||
|
|
||||||
isSynchronizationSucceeded = synchronizationResult.CompletedState == SynchronizationCompletedState.Success;
|
// isSynchronizationSucceeded = synchronizationResult.CompletedState == SynchronizationCompletedState.Success;
|
||||||
|
|
||||||
// Create notification for synchronization result.
|
// // Create notification for synchronization result.
|
||||||
if (synchronizationResult.DownloadedMessages.Any())
|
// if (synchronizationResult.DownloadedMessages.Any())
|
||||||
{
|
// {
|
||||||
var accountInboxFolder = await _folderService.GetSpecialFolderByAccountIdAsync(message.Options.AccountId, SpecialFolderType.Inbox);
|
// var accountInboxFolder = await _folderService.GetSpecialFolderByAccountIdAsync(message.Options.AccountId, SpecialFolderType.Inbox);
|
||||||
|
|
||||||
if (accountInboxFolder == null) return;
|
// if (accountInboxFolder == null) return;
|
||||||
|
|
||||||
await _notificationBuilder.CreateNotificationsAsync(accountInboxFolder.Id, synchronizationResult.DownloadedMessages);
|
// await _notificationBuilder.CreateNotificationsAsync(accountInboxFolder.Id, synchronizationResult.DownloadedMessages);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
catch (AuthenticationAttentionException)
|
//catch (AuthenticationAttentionException)
|
||||||
{
|
//{
|
||||||
await SetAccountAttentionAsync(accountId, AccountAttentionReason.InvalidCredentials);
|
// await SetAccountAttentionAsync(accountId, AccountAttentionReason.InvalidCredentials);
|
||||||
}
|
//}
|
||||||
catch (SystemFolderConfigurationMissingException)
|
//catch (SystemFolderConfigurationMissingException)
|
||||||
{
|
//{
|
||||||
await SetAccountAttentionAsync(accountId, AccountAttentionReason.MissingSystemFolderConfiguration);
|
// await SetAccountAttentionAsync(accountId, AccountAttentionReason.MissingSystemFolderConfiguration);
|
||||||
}
|
//}
|
||||||
catch (OperationCanceledException)
|
//catch (OperationCanceledException)
|
||||||
{
|
//{
|
||||||
DialogService.InfoBarMessage(Translator.Info_SyncCanceledMessage, Translator.Info_SyncCanceledMessage, InfoBarMessageType.Warning);
|
// DialogService.InfoBarMessage(Translator.Info_SyncCanceledMessage, Translator.Info_SyncCanceledMessage, InfoBarMessageType.Warning);
|
||||||
}
|
//}
|
||||||
catch (Exception ex)
|
//catch (Exception ex)
|
||||||
{
|
//{
|
||||||
DialogService.InfoBarMessage(Translator.Info_SyncFailedTitle, ex.Message, InfoBarMessageType.Error);
|
// DialogService.InfoBarMessage(Translator.Info_SyncFailedTitle, ex.Message, InfoBarMessageType.Error);
|
||||||
}
|
//}
|
||||||
finally
|
//finally
|
||||||
{
|
//{
|
||||||
if (shouldReportSynchronizationResult)
|
// if (shouldReportSynchronizationResult)
|
||||||
Messenger.Send(new AccountSynchronizationCompleted(accountId,
|
// Messenger.Send(new AccountSynchronizationCompleted(accountId,
|
||||||
isSynchronizationSucceeded ? SynchronizationCompletedState.Success : SynchronizationCompletedState.Failed,
|
// isSynchronizationSucceeded ? SynchronizationCompletedState.Success : SynchronizationCompletedState.Failed,
|
||||||
message.Options.GroupedSynchronizationTrackingId));
|
// message.Options.GroupedSynchronizationTrackingId));
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
private readonly IMailService _mailService;
|
private readonly IMailService _mailService;
|
||||||
private readonly IFolderService _folderService;
|
private readonly IFolderService _folderService;
|
||||||
private readonly IWinoSynchronizerFactory _winoSynchronizerFactory;
|
|
||||||
private readonly IThreadingStrategyProvider _threadingStrategyProvider;
|
private readonly IThreadingStrategyProvider _threadingStrategyProvider;
|
||||||
private readonly IContextMenuItemService _contextMenuItemService;
|
private readonly IContextMenuItemService _contextMenuItemService;
|
||||||
private readonly IWinoRequestDelegator _winoRequestDelegator;
|
private readonly IWinoRequestDelegator _winoRequestDelegator;
|
||||||
@@ -143,7 +142,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
IMailService mailService,
|
IMailService mailService,
|
||||||
IStatePersistanceService statePersistanceService,
|
IStatePersistanceService statePersistanceService,
|
||||||
IFolderService folderService,
|
IFolderService folderService,
|
||||||
IWinoSynchronizerFactory winoSynchronizerFactory,
|
|
||||||
IThreadingStrategyProvider threadingStrategyProvider,
|
IThreadingStrategyProvider threadingStrategyProvider,
|
||||||
IContextMenuItemService contextMenuItemService,
|
IContextMenuItemService contextMenuItemService,
|
||||||
IWinoRequestDelegator winoRequestDelegator,
|
IWinoRequestDelegator winoRequestDelegator,
|
||||||
@@ -156,7 +154,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
_mailService = mailService;
|
_mailService = mailService;
|
||||||
_folderService = folderService;
|
_folderService = folderService;
|
||||||
_winoSynchronizerFactory = winoSynchronizerFactory;
|
|
||||||
_threadingStrategyProvider = threadingStrategyProvider;
|
_threadingStrategyProvider = threadingStrategyProvider;
|
||||||
_contextMenuItemService = contextMenuItemService;
|
_contextMenuItemService = contextMenuItemService;
|
||||||
_winoRequestDelegator = winoRequestDelegator;
|
_winoRequestDelegator = winoRequestDelegator;
|
||||||
@@ -977,17 +974,19 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
foreach (var accountId in accountIds)
|
foreach (var accountId in accountIds)
|
||||||
{
|
{
|
||||||
var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(accountId);
|
// TODO: Server: Check whether account is already synchronizing from the server.
|
||||||
|
|
||||||
if (synchronizer == null) continue;
|
//var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(accountId);
|
||||||
|
|
||||||
bool isAccountSynchronizing = synchronizer.State != AccountSynchronizerState.Idle;
|
//if (synchronizer == null) continue;
|
||||||
|
|
||||||
if (isAccountSynchronizing)
|
//bool isAccountSynchronizing = synchronizer.State != AccountSynchronizerState.Idle;
|
||||||
{
|
|
||||||
isAnyAccountSynchronizing = true;
|
//if (isAccountSynchronizing)
|
||||||
break;
|
//{
|
||||||
}
|
// isAnyAccountSynchronizing = true;
|
||||||
|
// break;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
private readonly IMimeFileService _mimeFileService;
|
private readonly IMimeFileService _mimeFileService;
|
||||||
private readonly Core.Domain.Interfaces.IMailService _mailService;
|
private readonly Core.Domain.Interfaces.IMailService _mailService;
|
||||||
private readonly IFileService _fileService;
|
private readonly IFileService _fileService;
|
||||||
private readonly IWinoSynchronizerFactory _winoSynchronizerFactory;
|
|
||||||
private readonly IWinoRequestDelegator _requestDelegator;
|
private readonly IWinoRequestDelegator _requestDelegator;
|
||||||
private readonly IClipboardService _clipboardService;
|
private readonly IClipboardService _clipboardService;
|
||||||
private readonly IUnsubscriptionService _unsubscriptionService;
|
private readonly IUnsubscriptionService _unsubscriptionService;
|
||||||
@@ -124,7 +123,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
IMimeFileService mimeFileService,
|
IMimeFileService mimeFileService,
|
||||||
Core.Domain.Interfaces.IMailService mailService,
|
Core.Domain.Interfaces.IMailService mailService,
|
||||||
IFileService fileService,
|
IFileService fileService,
|
||||||
IWinoSynchronizerFactory winoSynchronizerFactory,
|
|
||||||
IWinoRequestDelegator requestDelegator,
|
IWinoRequestDelegator requestDelegator,
|
||||||
IStatePersistanceService statePersistanceService,
|
IStatePersistanceService statePersistanceService,
|
||||||
IClipboardService clipboardService,
|
IClipboardService clipboardService,
|
||||||
@@ -141,7 +139,6 @@ namespace Wino.Mail.ViewModels
|
|||||||
_mimeFileService = mimeFileService;
|
_mimeFileService = mimeFileService;
|
||||||
_mailService = mailService;
|
_mailService = mailService;
|
||||||
_fileService = fileService;
|
_fileService = fileService;
|
||||||
_winoSynchronizerFactory = winoSynchronizerFactory;
|
|
||||||
_requestDelegator = requestDelegator;
|
_requestDelegator = requestDelegator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,30 +341,31 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task HandleSingleItemDownloadAsync(MailItemViewModel mailItemViewModel)
|
private async Task HandleSingleItemDownloadAsync(MailItemViewModel mailItemViewModel)
|
||||||
{
|
{
|
||||||
var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(mailItemViewModel.AssignedAccount.Id);
|
// TODO: Server: Download single mime and report back the item here.
|
||||||
|
|
||||||
try
|
//var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(mailItemViewModel.AssignedAccount.Id);
|
||||||
{
|
|
||||||
// To show the progress on the UI.
|
|
||||||
CurrentDownloadPercentage = 1;
|
|
||||||
|
|
||||||
await synchronizer.DownloadMissingMimeMessageAsync(mailItemViewModel.MailCopy, this, renderCancellationTokenSource.Token);
|
//try
|
||||||
}
|
//{
|
||||||
catch (OperationCanceledException)
|
// // To show the progress on the UI.
|
||||||
{
|
// CurrentDownloadPercentage = 1;
|
||||||
Log.Information("MIME download is canceled.");
|
|
||||||
}
|
// await synchronizer.DownloadMissingMimeMessageAsync(mailItemViewModel.MailCopy, this, renderCancellationTokenSource.Token);
|
||||||
catch (Exception ex)
|
//}
|
||||||
{
|
//catch (OperationCanceledException)
|
||||||
DialogService.InfoBarMessage(Translator.GeneralTitle_Error, ex.Message, InfoBarMessageType.Error);
|
//{
|
||||||
}
|
// Log.Information("MIME download is canceled.");
|
||||||
finally
|
//}
|
||||||
{
|
//catch (Exception ex)
|
||||||
ResetProgress();
|
//{
|
||||||
}
|
// DialogService.InfoBarMessage(Translator.GeneralTitle_Error, ex.Message, InfoBarMessageType.Error);
|
||||||
|
//}
|
||||||
|
//finally
|
||||||
|
//{
|
||||||
|
// ResetProgress();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RenderAsync(MailItemViewModel mailItemViewModel, CancellationToken cancellationToken = default)
|
private async Task RenderAsync(MailItemViewModel mailItemViewModel, CancellationToken cancellationToken = default)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using Wino.Core.Domain;
|
|||||||
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.MailItem;
|
using Wino.Core.Domain.Models.MailItem;
|
||||||
using Wino.Core.Domain.Models.Synchronization;
|
|
||||||
using Wino.Core.UWP.Services;
|
using Wino.Core.UWP.Services;
|
||||||
|
|
||||||
namespace Wino.Activation
|
namespace Wino.Activation
|
||||||
@@ -20,7 +19,7 @@ namespace Wino.Activation
|
|||||||
private readonly IWinoRequestDelegator _winoRequestDelegator;
|
private readonly IWinoRequestDelegator _winoRequestDelegator;
|
||||||
private readonly INativeAppService _nativeAppService;
|
private readonly INativeAppService _nativeAppService;
|
||||||
private readonly IWinoRequestProcessor _winoRequestProcessor;
|
private readonly IWinoRequestProcessor _winoRequestProcessor;
|
||||||
private readonly IWinoSynchronizerFactory _winoSynchronizerFactory;
|
private readonly IWinoServerConnectionManager _winoServerConnectionManager;
|
||||||
private readonly IMailService _mailService;
|
private readonly IMailService _mailService;
|
||||||
private ToastArguments _toastArguments;
|
private ToastArguments _toastArguments;
|
||||||
|
|
||||||
@@ -28,13 +27,13 @@ namespace Wino.Activation
|
|||||||
public BackgroundActivationHandler(IWinoRequestDelegator winoRequestDelegator,
|
public BackgroundActivationHandler(IWinoRequestDelegator winoRequestDelegator,
|
||||||
INativeAppService nativeAppService,
|
INativeAppService nativeAppService,
|
||||||
IWinoRequestProcessor winoRequestProcessor,
|
IWinoRequestProcessor winoRequestProcessor,
|
||||||
IWinoSynchronizerFactory winoSynchronizerFactory,
|
IWinoServerConnectionManager winoServerConnectionManager,
|
||||||
IMailService mailService)
|
IMailService mailService)
|
||||||
{
|
{
|
||||||
_winoRequestDelegator = winoRequestDelegator;
|
_winoRequestDelegator = winoRequestDelegator;
|
||||||
_nativeAppService = nativeAppService;
|
_nativeAppService = nativeAppService;
|
||||||
_winoRequestProcessor = winoRequestProcessor;
|
_winoRequestProcessor = winoRequestProcessor;
|
||||||
_winoSynchronizerFactory = winoSynchronizerFactory;
|
_winoServerConnectionManager = winoServerConnectionManager;
|
||||||
_mailService = mailService;
|
_mailService = mailService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,23 +77,25 @@ namespace Wino.Activation
|
|||||||
{
|
{
|
||||||
// We need to synchronize changes without reflection the UI changes.
|
// We need to synchronize changes without reflection the UI changes.
|
||||||
|
|
||||||
var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(mailItem.AssignedAccount.Id);
|
// var synchronizer = _winoSynchronizerFactory.GetAccountSynchronizer(mailItem.AssignedAccount.Id);
|
||||||
var prepRequest = new MailOperationPreperationRequest(action, mailItem);
|
var prepRequest = new MailOperationPreperationRequest(action, mailItem);
|
||||||
|
|
||||||
var requests = await _winoRequestProcessor.PrepareRequestsAsync(prepRequest);
|
var requests = await _winoRequestProcessor.PrepareRequestsAsync(prepRequest);
|
||||||
|
|
||||||
foreach (var request in requests)
|
foreach (var request in requests)
|
||||||
{
|
{
|
||||||
synchronizer.QueueRequest(request);
|
_winoServerConnectionManager.QueueRequest(request, mailItem.AssignedAccount.Id);
|
||||||
|
|
||||||
|
// synchronizer.QueueRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = new SynchronizationOptions()
|
//var options = new SynchronizationOptions()
|
||||||
{
|
//{
|
||||||
Type = SynchronizationType.ExecuteRequests,
|
// Type = SynchronizationType.ExecuteRequests,
|
||||||
AccountId = mailItem.AssignedAccount.Id
|
// AccountId = mailItem.AssignedAccount.Id
|
||||||
};
|
//};
|
||||||
|
|
||||||
await synchronizer.SynchronizeAsync(options);
|
//await synchronizer.SynchronizeAsync(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ namespace Wino
|
|||||||
private readonly IThemeService _themeService;
|
private readonly IThemeService _themeService;
|
||||||
private readonly IDatabaseService _databaseService;
|
private readonly IDatabaseService _databaseService;
|
||||||
private readonly IAppInitializerService _appInitializerService;
|
private readonly IAppInitializerService _appInitializerService;
|
||||||
private readonly IWinoSynchronizerFactory _synchronizerFactory;
|
|
||||||
private readonly ITranslationService _translationService;
|
private readonly ITranslationService _translationService;
|
||||||
|
|
||||||
// Order matters.
|
// Order matters.
|
||||||
@@ -56,7 +55,6 @@ namespace Wino
|
|||||||
_appServiceConnectionManager,
|
_appServiceConnectionManager,
|
||||||
_translationService,
|
_translationService,
|
||||||
_themeService,
|
_themeService,
|
||||||
_synchronizerFactory
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public App()
|
public App()
|
||||||
@@ -83,7 +81,6 @@ namespace Wino
|
|||||||
_themeService = Services.GetService<IThemeService>();
|
_themeService = Services.GetService<IThemeService>();
|
||||||
_databaseService = Services.GetService<IDatabaseService>();
|
_databaseService = Services.GetService<IDatabaseService>();
|
||||||
_appInitializerService = Services.GetService<IAppInitializerService>();
|
_appInitializerService = Services.GetService<IAppInitializerService>();
|
||||||
_synchronizerFactory = Services.GetService<IWinoSynchronizerFactory>();
|
|
||||||
_translationService = Services.GetService<ITranslationService>();
|
_translationService = Services.GetService<ITranslationService>();
|
||||||
|
|
||||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
|
|||||||
Reference in New Issue
Block a user