diff --git a/Wino.Calendar.ViewModels/AccountManagementViewModel.cs b/Wino.Calendar.ViewModels/AccountManagementViewModel.cs index 24e46b47..58cebce5 100644 --- a/Wino.Calendar.ViewModels/AccountManagementViewModel.cs +++ b/Wino.Calendar.ViewModels/AccountManagementViewModel.cs @@ -1,13 +1,22 @@ -using System.Threading.Tasks; +using System; +using System.Threading; +using System.Threading.Tasks; +using CommunityToolkit.Mvvm.Input; +using Wino.Core.Domain; +using Wino.Core.Domain.Entities.Shared; +using Wino.Core.Domain.Enums; +using Wino.Core.Domain.Exceptions; 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.ViewModels; +using Wino.Messaging.Server; namespace Wino.Calendar.ViewModels { public partial class AccountManagementViewModel : AccountManagementPageViewModelBase { + private readonly IProviderService _providerService; + public AccountManagementViewModel(ICalendarDialogService dialogService, IWinoServerConnectionManager winoServerConnectionManager, INavigationService navigationService, @@ -18,20 +27,116 @@ namespace Wino.Calendar.ViewModels IPreferencesService preferencesService) : base(dialogService, winoServerConnectionManager, navigationService, accountService, providerService, storeManagementService, authenticationProvider, preferencesService) { CalendarDialogService = dialogService; + _providerService = providerService; } public ICalendarDialogService CalendarDialogService { get; } - public override Task InitializeAccountsAsync() + public override async Task InitializeAccountsAsync() { - return Task.CompletedTask; + Accounts.Clear(); + + var accounts = await AccountService.GetAccountsAsync().ConfigureAwait(false); + + await ExecuteUIThread(() => + { + foreach (var account in accounts) + { + var accountDetails = GetAccountProviderDetails(account); + + Accounts.Add(accountDetails); + } + }); + + await ManageStorePurchasesAsync().ConfigureAwait(false); } - public override async void OnNavigatedTo(NavigationMode mode, object parameters) + [RelayCommand] + private async Task AddNewAccountAsync() { - base.OnNavigatedTo(mode, parameters); + if (IsAccountCreationBlocked) + { + var isPurchaseClicked = await DialogService.ShowConfirmationDialogAsync(Translator.DialogMessage_AccountLimitMessage, Translator.DialogMessage_AccountLimitTitle, Translator.Buttons_Purchase); - var t = await StoreManagementService.HasProductAsync(StoreProductType.UnlimitedAccounts); + if (!isPurchaseClicked) return; + + await PurchaseUnlimitedAccountAsync(); + + return; + } + + var availableProviders = _providerService.GetAvailableProviders(); + + var accountCreationDialogResult = await DialogService.ShowAccountProviderSelectionDialogAsync(availableProviders); + + if (accountCreationDialogResult == null) return; + + var accountCreationCancellationTokenSource = new CancellationTokenSource(); + var accountCreationDialog = CalendarDialogService.GetAccountCreationDialog(accountCreationDialogResult.ProviderType); + + accountCreationDialog.ShowDialog(accountCreationCancellationTokenSource); + accountCreationDialog.State = AccountCreationDialogState.SigningIn; + + // For OAuth authentications, we just generate token and assign it to the MailAccount. + + var createdAccount = new MailAccount() + { + ProviderType = accountCreationDialogResult.ProviderType, + Name = accountCreationDialogResult.AccountName, + AccountColorHex = accountCreationDialogResult.AccountColorHex, + Id = Guid.NewGuid() + }; + + var tokenInformationResponse = await WinoServerConnectionManager + .GetResponseAsync(new AuthorizationRequested(accountCreationDialogResult.ProviderType, + createdAccount, + createdAccount.ProviderType == MailProviderType.Gmail), accountCreationCancellationTokenSource.Token); + + if (accountCreationDialog.State == AccountCreationDialogState.Canceled) + throw new AccountSetupCanceledException(); + + + tokenInformationResponse.ThrowIfFailed(); + + var tokenInformation = tokenInformationResponse.Data; + createdAccount.Address = tokenInformation.Address; + tokenInformation.AccountId = createdAccount.Id; + + await AccountService.CreateAccountAsync(createdAccount, tokenInformation, null); + + // Sync profile information if supported. + if (createdAccount.IsProfileInfoSyncSupported) + { + // Start profile information synchronization. + // It's only available for Outlook and Gmail synchronizers. + + var profileSyncOptions = new SynchronizationOptions() + { + AccountId = createdAccount.Id, + Type = SynchronizationType.UpdateProfile + }; + + var profileSynchronizationResponse = await WinoServerConnectionManager.GetResponseAsync(new NewSynchronizationRequested(profileSyncOptions, SynchronizationSource.Client)); + + var profileSynchronizationResult = profileSynchronizationResponse.Data; + + if (profileSynchronizationResult.CompletedState != SynchronizationCompletedState.Success) + throw new Exception(Translator.Exception_FailedToSynchronizeProfileInformation); + + createdAccount.SenderName = profileSynchronizationResult.ProfileInformation.SenderName; + createdAccount.Base64ProfilePictureData = profileSynchronizationResult.ProfileInformation.Base64ProfilePictureData; + + await AccountService.UpdateProfileInformationAsync(createdAccount.Id, profileSynchronizationResult.ProfileInformation); + } + + accountCreationDialog.State = AccountCreationDialogState.FetchingEvents; + + // Start synchronizing events. + var eventsSyncOptions = new SynchronizationOptions() + { + AccountId = createdAccount.Id, + Type = SynchronizationType.Events + }; } } } diff --git a/Wino.Calendar/App.xaml.cs b/Wino.Calendar/App.xaml.cs index 7ff40a35..4690eea5 100644 --- a/Wino.Calendar/App.xaml.cs +++ b/Wino.Calendar/App.xaml.cs @@ -51,6 +51,7 @@ namespace Wino.Calendar services.AddSingleton(); services.AddSingleton(); services.AddTransient(); + services.AddTransient(); } private void RegisterViewModels(IServiceCollection services) diff --git a/Wino.Calendar/Services/ApplicationResourceManager.cs b/Wino.Calendar/Services/ApplicationResourceManager.cs deleted file mode 100644 index fdd3776d..00000000 --- a/Wino.Calendar/Services/ApplicationResourceManager.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Wino.Calendar.Services -{ - internal class ApplicationResourceManager - { - } -} diff --git a/Wino.Calendar/Services/ProviderService.cs b/Wino.Calendar/Services/ProviderService.cs new file mode 100644 index 00000000..23df7a52 --- /dev/null +++ b/Wino.Calendar/Services/ProviderService.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Linq; +using Wino.Core.Domain.Enums; +using Wino.Core.Domain.Interfaces; +using Wino.Core.Domain.Models.Accounts; + +namespace Wino.Calendar.Services +{ + public class ProviderService : IProviderService + { + public IProviderDetail GetProviderDetail(MailProviderType type) + { + var details = GetAvailableProviders(); + + return details.FirstOrDefault(a => a.Type == type); + } + + public List GetAvailableProviders() + { + var providerList = new List(); + + var providers = new MailProviderType[] + { + MailProviderType.Outlook, + MailProviderType.Gmail + }; + + foreach (var type in providers) + { + providerList.Add(new ProviderDetail(type)); + } + + return providerList; + } + } +} diff --git a/Wino.Calendar/Views/Account/AccountManagementPage.xaml b/Wino.Calendar/Views/Account/AccountManagementPage.xaml index 7748bf0a..8c6997a6 100644 --- a/Wino.Calendar/Views/Account/AccountManagementPage.xaml +++ b/Wino.Calendar/Views/Account/AccountManagementPage.xaml @@ -4,9 +4,175 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:abstract="using:Wino.Calendar.Views.Abstract" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:domain="using:Wino.Core.Domain" xmlns:local="using:Wino.Calendar.Views.Account" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:muxc="using:Microsoft.UI.Xaml.Controls" + xmlns:winuiControls="using:CommunityToolkit.WinUI.Controls" mc:Ignorable="d"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Wino.Calendar/Wino.Calendar.csproj b/Wino.Calendar/Wino.Calendar.csproj index 211f4eca..2b82548a 100644 --- a/Wino.Calendar/Wino.Calendar.csproj +++ b/Wino.Calendar/Wino.Calendar.csproj @@ -152,9 +152,9 @@ - + diff --git a/Wino.Core.Domain/Enums/AccountCreationDialogState.cs b/Wino.Core.Domain/Enums/AccountCreationDialogState.cs index e7eb47d8..17393e26 100644 --- a/Wino.Core.Domain/Enums/AccountCreationDialogState.cs +++ b/Wino.Core.Domain/Enums/AccountCreationDialogState.cs @@ -11,6 +11,7 @@ AutoDiscoverySetup, AutoDiscoveryInProgress, FetchingProfileInformation, - Canceled + Canceled, + FetchingEvents } } diff --git a/Wino.Core.Domain/Enums/SynchronizationType.cs b/Wino.Core.Domain/Enums/SynchronizationType.cs index a8cfba1d..031f5c55 100644 --- a/Wino.Core.Domain/Enums/SynchronizationType.cs +++ b/Wino.Core.Domain/Enums/SynchronizationType.cs @@ -2,12 +2,16 @@ { public enum SynchronizationType { - FoldersOnly, // Only synchronize folder metadata. - ExecuteRequests, // Run the queued requests, and then synchronize if needed. - Inbox, // Only Inbox, Sent and Draft folders. - Custom, // Only sync folders that are specified in the options. - Full, // Synchronize all folders. This won't update profile or alias information. + // Shared UpdateProfile, // Only update profile information + ExecuteRequests, // Run the queued requests, and then synchronize if needed. + // Wino Mail + FoldersOnly, // Only synchronize folder metadata. + InboxOnly, // Only Inbox, Sent and Draft folders. + CustomFolders, // Only sync folders that are specified in the options. + FullFolders, // Synchronize all folders. This won't update profile or alias information. Alias, // Only update alias information + // Calendar + Events } } diff --git a/Wino.Core.Domain/Interfaces/IDialogServiceBase.cs b/Wino.Core.Domain/Interfaces/IDialogServiceBase.cs index 15b2c140..075616dd 100644 --- a/Wino.Core.Domain/Interfaces/IDialogServiceBase.cs +++ b/Wino.Core.Domain/Interfaces/IDialogServiceBase.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using Wino.Core.Domain.Enums; +using Wino.Core.Domain.Models.Accounts; namespace Wino.Core.Domain.Interfaces { @@ -21,5 +23,7 @@ namespace Wino.Core.Domain.Interfaces string cancelButtonText = "", string dontAskAgainConfigurationKey = ""); Task ShowCustomThemeBuilderDialogAsync(); + Task ShowAccountProviderSelectionDialogAsync(List availableProviders); + IAccountCreationDialog GetAccountCreationDialog(MailProviderType type); } } diff --git a/Wino.Core.Domain/Interfaces/IMailDialogService.cs b/Wino.Core.Domain/Interfaces/IMailDialogService.cs index b4e22d5e..4f7c8350 100644 --- a/Wino.Core.Domain/Interfaces/IMailDialogService.cs +++ b/Wino.Core.Domain/Interfaces/IMailDialogService.cs @@ -5,7 +5,6 @@ using System.Threading.Tasks; using Wino.Core.Domain.Entities.Mail; using Wino.Core.Domain.Entities.Shared; using Wino.Core.Domain.Enums; -using Wino.Core.Domain.Models.Accounts; using Wino.Core.Domain.Models.Folders; namespace Wino.Core.Domain.Interfaces @@ -17,9 +16,6 @@ namespace Wino.Core.Domain.Interfaces // Custom dialogs Task ShowMoveMailFolderDialogAsync(List availableFolders); - Task ShowNewAccountMailProviderDialogAsync(List availableProviders); - IAccountCreationDialog GetAccountCreationDialog(MailProviderType type); - Task ShowEditAccountDialogAsync(MailAccount account); Task ShowAccountPickerDialogAsync(List availableAccounts); diff --git a/Wino.Core.Domain/Interfaces/IProviderService.cs b/Wino.Core.Domain/Interfaces/IProviderService.cs index f961b0ea..14dc301c 100644 --- a/Wino.Core.Domain/Interfaces/IProviderService.cs +++ b/Wino.Core.Domain/Interfaces/IProviderService.cs @@ -5,7 +5,7 @@ namespace Wino.Core.Domain.Interfaces { public interface IProviderService { - List GetProviderDetails(); + List GetAvailableProviders(); IProviderDetail GetProviderDetail(MailProviderType type); } } diff --git a/Wino.Core.Domain/Translations/en_US/resources.json b/Wino.Core.Domain/Translations/en_US/resources.json index 6120ad5b..87f6e188 100644 --- a/Wino.Core.Domain/Translations/en_US/resources.json +++ b/Wino.Core.Domain/Translations/en_US/resources.json @@ -4,6 +4,7 @@ "AccountCreationDialog_PreparingFolders": "We are getting folder information at the moment.", "AccountCreationDialog_SigninIn": "Account information is being saved.", "AccountCreationDialog_FetchingProfileInformation": "Fetching profile details.", + "AccountCreationDialog_FetchingEvents": "Fetching calendar events.", "AccountCreationDialog_GoogleAuthHelpClipboardText_Row0": "If your browser did not launch automatically to complete authentication:", "AccountCreationDialog_GoogleAuthHelpClipboardText_Row1": "1) Click the button below to copy the authentication address", "AccountCreationDialog_GoogleAuthHelpClipboardText_Row2": "2) Launch your web browser (Edge, Chrome, Firefox etc...)", diff --git a/Wino.Core.UWP/CoreGeneric.xaml b/Wino.Core.UWP/CoreGeneric.xaml index 167005ca..0c20d1d8 100644 --- a/Wino.Core.UWP/CoreGeneric.xaml +++ b/Wino.Core.UWP/CoreGeneric.xaml @@ -14,6 +14,7 @@ + diff --git a/Wino.Core.UWP/Dialogs/AccountCreationDialog.xaml b/Wino.Core.UWP/Dialogs/AccountCreationDialog.xaml index 351cf0ae..42e8cc3d 100644 --- a/Wino.Core.UWP/Dialogs/AccountCreationDialog.xaml +++ b/Wino.Core.UWP/Dialogs/AccountCreationDialog.xaml @@ -108,6 +108,14 @@ + + + + + + + + diff --git a/Wino.Mail/Dialogs/NewAccountDialog.xaml b/Wino.Core.UWP/Dialogs/NewAccountDialog.xaml similarity index 98% rename from Wino.Mail/Dialogs/NewAccountDialog.xaml rename to Wino.Core.UWP/Dialogs/NewAccountDialog.xaml index 6bbe5e35..8e67e15b 100644 --- a/Wino.Mail/Dialogs/NewAccountDialog.xaml +++ b/Wino.Core.UWP/Dialogs/NewAccountDialog.xaml @@ -1,5 +1,5 @@  PickWindowsFileContentAsync(params object[] typeFilters) { var file = await PickFileAsync(typeFilters); @@ -201,5 +212,18 @@ namespace Wino.Core.UWP.Services return dialogResult == ContentDialogResult.Primary; } + + public async Task ShowAccountProviderSelectionDialogAsync(List availableProviders) + { + var dialog = new NewAccountDialog + { + Providers = availableProviders, + RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme() + }; + + await HandleDialogPresentationAsync(dialog); + + return dialog.Result; + } } } diff --git a/Wino.Core.UWP/Services/WinoServerConnectionManager.cs b/Wino.Core.UWP/Services/WinoServerConnectionManager.cs index 36153072..fc8981cf 100644 --- a/Wino.Core.UWP/Services/WinoServerConnectionManager.cs +++ b/Wino.Core.UWP/Services/WinoServerConnectionManager.cs @@ -288,6 +288,8 @@ namespace Wino.Core.UWP.Services if (Status != WinoServerConnectionStatus.Connected) await ConnectAsync(); + if (Connection == null) return WinoServerResponse.CreateErrorResponse("Server connection is not established."); + string serializedMessage = string.Empty; try diff --git a/Wino.Core.UWP/Styles/SharedStyles.xaml b/Wino.Core.UWP/Styles/SharedStyles.xaml new file mode 100644 index 00000000..6c479cb4 --- /dev/null +++ b/Wino.Core.UWP/Styles/SharedStyles.xaml @@ -0,0 +1,106 @@ + + + + + + + diff --git a/Wino.Core.UWP/Wino.Core.UWP.csproj b/Wino.Core.UWP/Wino.Core.UWP.csproj index 1db07894..d51f5a04 100644 --- a/Wino.Core.UWP/Wino.Core.UWP.csproj +++ b/Wino.Core.UWP/Wino.Core.UWP.csproj @@ -96,6 +96,9 @@ + + NewAccountDialog.xaml + @@ -194,7 +197,6 @@ 8.1.240916 - 8.1.240916 @@ -338,6 +340,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -374,6 +380,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -398,4 +408,4 @@ --> - + \ No newline at end of file diff --git a/Wino.Core/CoreContainerSetup.cs b/Wino.Core/CoreContainerSetup.cs index 6f2533fe..4c6d7fe2 100644 --- a/Wino.Core/CoreContainerSetup.cs +++ b/Wino.Core/CoreContainerSetup.cs @@ -29,7 +29,6 @@ namespace Wino.Core services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/Wino.Core/Services/FolderService.cs b/Wino.Core/Services/FolderService.cs index cb5852c2..7ab178aa 100644 --- a/Wino.Core/Services/FolderService.cs +++ b/Wino.Core/Services/FolderService.cs @@ -550,7 +550,7 @@ namespace Wino.Core.Services { var folders = new List(); - if (options.Type == SynchronizationType.Full) + if (options.Type == SynchronizationType.FullFolders) { // Only get sync enabled folders. @@ -568,11 +568,11 @@ namespace Wino.Core.Services var mustHaveFolders = await GetInboxSynchronizationFoldersAsync(options.AccountId); - if (options.Type == SynchronizationType.Inbox) + if (options.Type == SynchronizationType.InboxOnly) { return mustHaveFolders; } - else if (options.Type == SynchronizationType.Custom) + else if (options.Type == SynchronizationType.CustomFolders) { // Only get the specified and enabled folders. diff --git a/Wino.Core/Synchronizers/BaseMailSynchronizer.cs b/Wino.Core/Synchronizers/BaseMailSynchronizer.cs index 0dc975d3..1843a035 100644 --- a/Wino.Core/Synchronizers/BaseMailSynchronizer.cs +++ b/Wino.Core/Synchronizers/BaseMailSynchronizer.cs @@ -397,13 +397,13 @@ namespace Wino.Core.Synchronizers { // Gather FolderIds to synchronize. - options.Type = SynchronizationType.Custom; + options.Type = SynchronizationType.CustomFolders; options.SynchronizationFolderIds = synchronizationFolderIds; } else { // At this point it's a mix of everything. Do full sync. - options.Type = SynchronizationType.Full; + options.Type = SynchronizationType.FullFolders; } return options; diff --git a/Wino.Core/Synchronizers/Mail/GmailSynchronizer.cs b/Wino.Core/Synchronizers/Mail/GmailSynchronizer.cs index da026048..74afc361 100644 --- a/Wino.Core/Synchronizers/Mail/GmailSynchronizer.cs +++ b/Wino.Core/Synchronizers/Mail/GmailSynchronizer.cs @@ -956,7 +956,7 @@ namespace Wino.Core.Synchronizers.Mail var options = new SynchronizationOptions() { AccountId = Account.Id, - Type = SynchronizationType.Full + Type = SynchronizationType.FullFolders }; await SynchronizeInternalAsync(options, cancellationToken); diff --git a/Wino.Core/Synchronizers/Mail/ImapSynchronizer.cs b/Wino.Core/Synchronizers/Mail/ImapSynchronizer.cs index 3cd58580..399b72a3 100644 --- a/Wino.Core/Synchronizers/Mail/ImapSynchronizer.cs +++ b/Wino.Core/Synchronizers/Mail/ImapSynchronizer.cs @@ -437,7 +437,7 @@ namespace Wino.Core.Synchronizers.Mail PublishSynchronizationProgress(1); - bool shouldDoFolderSync = options.Type == SynchronizationType.Full || options.Type == SynchronizationType.FoldersOnly; + bool shouldDoFolderSync = options.Type == SynchronizationType.FullFolders || options.Type == SynchronizationType.FoldersOnly; if (shouldDoFolderSync) { diff --git a/Wino.Mail.ViewModels/AccountManagementViewModel.cs b/Wino.Mail.ViewModels/AccountManagementViewModel.cs index de975694..86b296d9 100644 --- a/Wino.Mail.ViewModels/AccountManagementViewModel.cs +++ b/Wino.Mail.ViewModels/AccountManagementViewModel.cs @@ -83,10 +83,10 @@ namespace Wino.Mail.ViewModels try { - var providers = ProviderService.GetProviderDetails(); + var providers = ProviderService.GetAvailableProviders(); // Select provider. - var accountCreationDialogResult = await MailDialogService.ShowNewAccountMailProviderDialogAsync(providers); + var accountCreationDialogResult = await MailDialogService.ShowAccountProviderSelectionDialogAsync(providers); var accountCreationCancellationTokenSource = new CancellationTokenSource(); diff --git a/Wino.Mail.ViewModels/AppShellViewModel.cs b/Wino.Mail.ViewModels/AppShellViewModel.cs index cd8c8167..a4b81d9b 100644 --- a/Wino.Mail.ViewModels/AppShellViewModel.cs +++ b/Wino.Mail.ViewModels/AppShellViewModel.cs @@ -316,7 +316,7 @@ namespace Wino.Mail.ViewModels var options = new SynchronizationOptions() { AccountId = account.Id, - Type = SynchronizationType.Full + Type = SynchronizationType.FullFolders }; Messenger.Send(new NewSynchronizationRequested(options, SynchronizationSource.Client)); @@ -889,7 +889,7 @@ namespace Wino.Mail.ViewModels var options = new SynchronizationOptions() { AccountId = createdAccount.Id, - Type = SynchronizationType.Full, + Type = SynchronizationType.FullFolders, }; Messenger.Send(new NewSynchronizationRequested(options, SynchronizationSource.Client)); diff --git a/Wino.Mail.ViewModels/MailListPageViewModel.cs b/Wino.Mail.ViewModels/MailListPageViewModel.cs index 9b28ab24..3af61c37 100644 --- a/Wino.Mail.ViewModels/MailListPageViewModel.cs +++ b/Wino.Mail.ViewModels/MailListPageViewModel.cs @@ -470,7 +470,7 @@ namespace Wino.Mail.ViewModels var options = new SynchronizationOptions() { AccountId = folder.MailAccountId, - Type = SynchronizationType.Custom, + Type = SynchronizationType.CustomFolders, SynchronizationFolderIds = [folder.Id], GroupedSynchronizationTrackingId = trackingSynchronizationId }; diff --git a/Wino.Mail/App.xaml.cs b/Wino.Mail/App.xaml.cs index 37e3bf36..ec6c6997 100644 --- a/Wino.Mail/App.xaml.cs +++ b/Wino.Mail/App.xaml.cs @@ -21,6 +21,7 @@ using Wino.Core.Domain.Interfaces; using Wino.Core.Domain.Models.MailItem; using Wino.Core.Domain.Models.Synchronization; using Wino.Core.UWP; +using Wino.Mail.Services; using Wino.Mail.ViewModels; using Wino.Messaging.Client.Connection; using Wino.Messaging.Client.Navigation; @@ -94,6 +95,8 @@ namespace Wino services.AddSingleton(); services.AddSingleton(); services.AddTransient(); + services.AddTransient(); + } private void RegisterViewModels(IServiceCollection services) diff --git a/Wino.Mail/Services/DialogService.cs b/Wino.Mail/Services/DialogService.cs index d555e065..775714e8 100644 --- a/Wino.Mail/Services/DialogService.cs +++ b/Wino.Mail/Services/DialogService.cs @@ -10,7 +10,6 @@ using Wino.Core.Domain.Entities.Mail; using Wino.Core.Domain.Entities.Shared; using Wino.Core.Domain.Enums; using Wino.Core.Domain.Interfaces; -using Wino.Core.Domain.Models.Accounts; using Wino.Core.Domain.Models.Folders; using Wino.Core.Domain.Models.Synchronization; using Wino.Core.UWP.Extensions; @@ -27,41 +26,22 @@ namespace Wino.Services IConfigurationService configurationService, IApplicationResourceManager applicationResourceManager) : base(themeService, configurationService, applicationResourceManager) { + } - public async Task ShowNewAccountMailProviderDialogAsync(List availableProviders) + public override IAccountCreationDialog GetAccountCreationDialog(MailProviderType type) { - var dialog = new NewAccountDialog - { - Providers = availableProviders, - RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme() - }; - - await HandleDialogPresentationAsync(dialog); - - return dialog.Result; - } - - public IAccountCreationDialog GetAccountCreationDialog(MailProviderType type) - { - IAccountCreationDialog dialog = null; - if (type == MailProviderType.IMAP4) { - dialog = new NewImapSetupDialog + return new NewImapSetupDialog { RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme() }; } else { - dialog = new AccountCreationDialog - { - RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme() - }; + return base.GetAccountCreationDialog(type); } - - return dialog; } public async Task ShowEditAccountDialogAsync(MailAccount account) @@ -114,7 +94,7 @@ namespace Wino.Services var options = new SynchronizationOptions() { AccountId = accountId, - Type = SynchronizationType.Full, + Type = SynchronizationType.FullFolders, }; WeakReferenceMessenger.Default.Send(new NewSynchronizationRequested(options, SynchronizationSource.Client)); diff --git a/Wino.Core/Services/ProviderService.cs b/Wino.Mail/Services/ProviderService.cs similarity index 86% rename from Wino.Core/Services/ProviderService.cs rename to Wino.Mail/Services/ProviderService.cs index aba85d8f..e8f2249a 100644 --- a/Wino.Core/Services/ProviderService.cs +++ b/Wino.Mail/Services/ProviderService.cs @@ -4,7 +4,7 @@ using Wino.Core.Domain.Enums; using Wino.Core.Domain.Interfaces; using Wino.Core.Domain.Models.Accounts; -namespace Wino.Core.Services +namespace Wino.Mail.Services { /// /// Service that is returning available provider details. @@ -13,12 +13,12 @@ namespace Wino.Core.Services { public IProviderDetail GetProviderDetail(MailProviderType type) { - var details = GetProviderDetails(); + var details = GetAvailableProviders(); return details.FirstOrDefault(a => a.Type == type); } - public List GetProviderDetails() + public List GetAvailableProviders() { var providerList = new List(); diff --git a/Wino.Mail/Styles/ItemContainerStyles.xaml b/Wino.Mail/Styles/ItemContainerStyles.xaml index 87d6d1e3..38fab538 100644 --- a/Wino.Mail/Styles/ItemContainerStyles.xaml +++ b/Wino.Mail/Styles/ItemContainerStyles.xaml @@ -5,104 +5,6 @@ xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives" xmlns:winoControls="using:Wino.Controls"> - -