Full trust Wino Server implementation. (#295)

* Separation of messages. Introducing Wino.Messages library.

* Wino.Server and Wino.Packaging projects. Enabling full trust for UWP and app service connection manager basics.

* Remove debug code.

* Enable generating assembly info to deal with unsupported os platform warnings.

* Fix server-client connection.

* UIMessage communication. Single instancing for server and re-connection mechanism on suspension.

* Removed IWinoSynchronizerFactory from UWP project.

* Removal of background task service from core.

* Delegating changes to UI and triggering new background synchronization.

* Fix build error.

* Moved core lib messages to Messaging project.

* Better client-server communication. Handling of requests in the server. New synchronizer factory in the server.

* WAM broker and MSAL token caching for OutlookAuthenticator. Handling account creation for Outlook.

* WinoServerResponse basics.

* Delegating protocol activation for Gmail authenticator.

* Adding margin to searchbox to match action bar width.

* Move libraries into lib folder.

* Storing base64 encoded mime on draft creation instead of MimeMessage object. Fixes serialization/deserialization issue with S.T.Json

* Scrollbar adjustments

* WınoExpander for thread expander layout ıssue.

* Handling synchronizer state changes.

* Double init on background activation.

* FIxing packaging issues and new Wino Mail launcher protocol for activation from full thrust process.

* Remove debug deserialization.

* Remove debug code.

* Making sure the server connection is established when the app is launched.

* Thrust -> Trust string replacement...

* Rename package to Wino Mail

* Enable translated values in the server.

* Fixed an issue where toast activation can't find the clicked mail after the folder is initialized.

* Revert debug code.

* Change server background sync to every 3 minute and Inbox only synchronization.

* Revert google auth changes.

* App preferences page.

* Changing tray icon visibility on preference change.

* Start the server with invisible tray icon if set to invisible.

* Reconnect button on the title bar.

* Handling of toast actions.

* Enable x86 build for server during packaging.

* Get rid of old background tasks and v180 migration.

* Terminate client when Exit clicked in server.

* Introducing SynchronizationSource to prevent notifying UI after server tick synchronization.

* Remove confirmAppClose restricted capability and unused debug code in manifest.

* Closing the reconnect info popup when reconnect is clicked.

* Custom RetryHandler for OutlookSynchronizer and separating client/server logs.

* Running server on Windows startup.

* Fix startup exe.

* Fix for expander list view item paddings.

* Force full sync on app launch instead of Inbox.

* Fix draft creation.

* Fix an issue with custom folder sync logic.

* Reporting back account sync progress from server.

* Fix sending drafts and missing notifications for imap.

* Changing imap folder sync requirements.

* Retain file  count is set to 3.

* Disabled swipe gestures temporarily due to native crash
 with SwipeControl

* Save all attachments implementation.

* Localization for save all attachments button.

* Fix logging dates for logs.

* Fixing ARM64 build.

* Add ARM64 build config to packaging project.

* Comment out OutOfProcPDB for ARM64.

* Hnadling GONE response for Outlook folder synchronization.
This commit is contained in:
Burak Kaan Köse
2024-08-05 00:36:26 +02:00
committed by GitHub
parent 4dc225184d
commit ff77b2b3dc
275 changed files with 4986 additions and 2381 deletions

View File

@@ -17,10 +17,11 @@ using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Navigation;
using Wino.Core.Domain.Models.Store;
using Wino.Core.Domain.Models.Synchronization;
using Wino.Core.Messages.Authorization;
using Wino.Core.Messages.Navigation;
using Wino.Core.Requests;
using Wino.Mail.ViewModels.Data;
using Wino.Messaging.Client.Authorization;
using Wino.Messaging.Client.Navigation;
using Wino.Messaging.Server;
using Wino.Messaging.UI;
namespace Wino.Mail.ViewModels
{
@@ -35,7 +36,7 @@ namespace Wino.Mail.ViewModels
private readonly IStoreManagementService _storeManagementService;
private readonly IPreferencesService _preferencesService;
private readonly IAuthenticationProvider _authenticationProvider;
private readonly IWinoSynchronizerFactory _synchronizerFactory;
private readonly IWinoServerConnectionManager _winoServerConnectionManager;
public ObservableCollection<IAccountProviderDetailViewModel> Accounts { get; set; } = [];
@@ -60,22 +61,22 @@ namespace Wino.Mail.ViewModels
public AccountManagementViewModel(IDialogService dialogService,
IWinoNavigationService navigationService,
IWinoSynchronizerFactory synchronizerFactory,
IAccountService accountService,
IProviderService providerService,
IFolderService folderService,
IStoreManagementService storeManagementService,
IPreferencesService preferencesService,
IAuthenticationProvider authenticationProvider) : base(dialogService)
IAuthenticationProvider authenticationProvider,
IWinoServerConnectionManager winoServerConnectionManager) : base(dialogService)
{
_accountService = accountService;
_synchronizerFactory = synchronizerFactory;
_dialogService = dialogService;
_providerService = providerService;
_folderService = folderService;
_storeManagementService = storeManagementService;
_preferencesService = preferencesService;
_authenticationProvider = authenticationProvider;
_winoServerConnectionManager = winoServerConnectionManager;
}
[RelayCommand]
@@ -153,7 +154,7 @@ namespace Wino.Mail.ViewModels
{
creationDialog = _dialogService.GetAccountCreationDialog(accountCreationDialogResult.ProviderType);
_accountService.ExternalAuthenticationAuthenticator = _authenticationProvider.GetAuthenticator(accountCreationDialogResult.ProviderType);
// _accountService.ExternalAuthenticationAuthenticator = _authenticationProvider.GetAuthenticator(accountCreationDialogResult.ProviderType);
CustomServerInformation customServerInformation = null;
@@ -193,9 +194,13 @@ namespace Wino.Mail.ViewModels
{
// For OAuth authentications, we just generate token and assign it to the MailAccount.
tokenInformation = await _accountService.ExternalAuthenticationAuthenticator.GenerateTokenAsync(createdAccount, false)
?? throw new AuthenticationException(Translator.Exception_TokenInfoRetrivalFailed);
var tokenInformationResponse = await _winoServerConnectionManager.GetResponseAsync<TokenInformation, AuthorizationRequested>(new AuthorizationRequested(accountCreationDialogResult.ProviderType, createdAccount));
tokenInformationResponse.ThrowIfFailed();
// ?? throw new AuthenticationException(Translator.Exception_TokenInfoRetrivalFailed);
tokenInformation = tokenInformationResponse.Data;
createdAccount.Address = tokenInformation.Address;
tokenInformation.AccountId = createdAccount.Id;
}
@@ -205,8 +210,6 @@ namespace Wino.Mail.ViewModels
// Local account has been created.
// Create new synchronizer and start synchronization.
var synchronizer = _synchronizerFactory.CreateNewSynchronizer(createdAccount);
if (creationDialog is ICustomServerAccountCreationDialog customServerAccountCreationDialog)
customServerAccountCreationDialog.ShowPreparingFolders();
else
@@ -218,8 +221,9 @@ namespace Wino.Mail.ViewModels
Type = SynchronizationType.FoldersOnly
};
var synchronizationResult = await synchronizer.SynchronizeAsync(options);
var synchronizationResultResponse = await _winoServerConnectionManager.GetResponseAsync<SynchronizationResult, NewSynchronizationRequested>(new NewSynchronizationRequested(options, SynchronizationSource.Client));
var synchronizationResult = synchronizationResultResponse.Data;
if (synchronizationResult.CompletedState != SynchronizationCompletedState.Success)
throw new Exception(Translator.Exception_FailedToSynchronizeFolders);
@@ -377,11 +381,10 @@ namespace Wino.Mail.ViewModels
return new AccountProviderDetailViewModel(provider, account);
}
public void Receive(ProtocolAuthorizationCallbackReceived message)
public async void Receive(ProtocolAuthorizationCallbackReceived message)
{
// Authorization must be completed in account service.
_accountService.ExternalAuthenticationAuthenticator?.ContinueAuthorization(message.AuthorizationResponseUri);
// Authorization must be completed in the server.
await _winoServerConnectionManager.GetResponseAsync<bool, ProtocolAuthorizationCallbackReceived>(message);
}
}
}