Calendar metadata fetch after creating account.
This commit is contained in:
@@ -5,6 +5,7 @@ public enum AccountCreationDialogState
|
||||
Idle,
|
||||
SigningIn,
|
||||
PreparingFolders,
|
||||
CalendarMetadataFetch,
|
||||
Completed,
|
||||
ManuelSetupWaiting,
|
||||
TestingConnection,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"AccountCacheReset_Message": "This account requires full re-sychronization to continue working. Please wait while Wino re-synchronizes your messages...",
|
||||
"AccountContactNameYou": "You",
|
||||
"AccountCreationDialog_Completed": "all done",
|
||||
"AccountCreationDialog_FetchingCalendarMetadata": "Fetching calendar details.",
|
||||
"AccountCreationDialog_FetchingEvents": "Fetching calendar events.",
|
||||
"AccountCreationDialog_FetchingProfileInformation": "Fetching profile details.",
|
||||
"AccountCreationDialog_GoogleAuthHelpClipboardText_Row0": "If your browser did not launch automatically to complete authentication:",
|
||||
@@ -242,6 +243,7 @@
|
||||
"Exception_CustomThemeMissingName": "You must provide a name.",
|
||||
"Exception_CustomThemeMissingWallpaper": "You must provide a custom background image.",
|
||||
"Exception_FailedToSynchronizeAliases": "Failed to synchronize aliases",
|
||||
"Exception_FailedToSynchronizeCalendarMetadata": "Failed to synchronize calendar details",
|
||||
"Exception_FailedToSynchronizeFolders": "Failed to synchronize folders",
|
||||
"Exception_FailedToSynchronizeProfileInformation": "Failed to synchronize profile information",
|
||||
"Exception_GoogleAuthCallbackNull": "Callback uri is null on activation.",
|
||||
|
||||
@@ -495,6 +495,9 @@ public class GmailSynchronizer : WinoSynchronizer<IClientServiceRequest, Message
|
||||
|
||||
await SynchronizeCalendarsAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (options?.Type == CalendarSynchronizationType.CalendarMetadata)
|
||||
return CalendarSynchronizationResult.Empty;
|
||||
|
||||
bool isInitialSync = string.IsNullOrEmpty(Account.SynchronizationDeltaIdentifier);
|
||||
|
||||
_logger.Debug("Is initial synchronization: {IsInitialSync}", isInitialSync);
|
||||
|
||||
@@ -1163,6 +1163,9 @@ public class ImapSynchronizer : WinoSynchronizer<ImapRequest, ImapMessageCreatio
|
||||
|
||||
await SynchronizeCalendarMetadataAsync(remoteCalendars).ConfigureAwait(false);
|
||||
|
||||
if (options?.Type == CalendarSynchronizationType.CalendarMetadata)
|
||||
return CalendarSynchronizationResult.Empty;
|
||||
|
||||
var localCalendars = await _imapChangeProcessor.GetAccountCalendarsAsync(Account.Id).ConfigureAwait(false);
|
||||
var remoteCalendarsById = remoteCalendars.ToDictionary(c => c.RemoteCalendarId, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
||||
@@ -1988,6 +1988,9 @@ public class OutlookSynchronizer : WinoSynchronizer<RequestInformation, Message,
|
||||
|
||||
await SynchronizeCalendarsAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (options?.Type == CalendarSynchronizationType.CalendarMetadata)
|
||||
return CalendarSynchronizationResult.Empty;
|
||||
|
||||
var localCalendars = (await _outlookChangeProcessor.GetAccountCalendarsAsync(Account.Id).ConfigureAwait(false))
|
||||
.Where(c => c.IsSynchronizationEnabled)
|
||||
.ToList();
|
||||
|
||||
@@ -14,6 +14,7 @@ using Wino.Core.Domain.Exceptions;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Calendar;
|
||||
using Wino.Core.Domain.Models.Navigation;
|
||||
using Wino.Core.Domain.Models.Synchronization;
|
||||
using Wino.Core.Services;
|
||||
using Wino.Core.ViewModels;
|
||||
using Wino.Core.ViewModels.Data;
|
||||
@@ -87,6 +88,7 @@ public partial class AccountManagementViewModel : AccountManagementPageViewModel
|
||||
|
||||
MailAccount createdAccount = null;
|
||||
IAccountCreationDialog creationDialog = null;
|
||||
bool creationDialogClosed = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -225,6 +227,21 @@ public partial class AccountManagementViewModel : AccountManagementPageViewModel
|
||||
if (folderSynchronizationResult == null || folderSynchronizationResult.CompletedState != SynchronizationCompletedState.Success)
|
||||
throw new Exception(Translator.Exception_FailedToSynchronizeFolders);
|
||||
|
||||
if (createdAccount.IsCalendarAccessGranted)
|
||||
{
|
||||
if (creationDialog != null)
|
||||
await ExecuteUIThread(() => creationDialog.State = AccountCreationDialogState.CalendarMetadataFetch);
|
||||
|
||||
var calendarMetadataSynchronizationResult = await SynchronizationManager.Instance.SynchronizeCalendarAsync(new CalendarSynchronizationOptions
|
||||
{
|
||||
AccountId = createdAccount.Id,
|
||||
Type = CalendarSynchronizationType.CalendarMetadata
|
||||
});
|
||||
|
||||
if (calendarMetadataSynchronizationResult == null || calendarMetadataSynchronizationResult.CompletedState != SynchronizationCompletedState.Success)
|
||||
throw new Exception(Translator.Exception_FailedToSynchronizeCalendarMetadata);
|
||||
}
|
||||
|
||||
// Sync aliases if supported.
|
||||
if (createdAccount.IsAliasSyncSupported)
|
||||
{
|
||||
@@ -242,6 +259,12 @@ public partial class AccountManagementViewModel : AccountManagementPageViewModel
|
||||
await AccountService.CreateRootAliasAsync(createdAccount.Id, createdAccount.Address);
|
||||
}
|
||||
|
||||
if (creationDialog != null)
|
||||
{
|
||||
await ExecuteUIThread(() => creationDialog.Complete(false));
|
||||
creationDialogClosed = true;
|
||||
}
|
||||
|
||||
// Send changes to listeners.
|
||||
await ExecuteUIThread(() => ReportUIChange(new AccountCreatedMessage(createdAccount)));
|
||||
|
||||
@@ -299,7 +322,12 @@ public partial class AccountManagementViewModel : AccountManagementPageViewModel
|
||||
}
|
||||
finally
|
||||
{
|
||||
await ExecuteUIThread(() => { creationDialog?.Complete(false); });
|
||||
if (creationDialog != null && !creationDialogClosed)
|
||||
{
|
||||
bool isCanceled = false;
|
||||
await ExecuteUIThread(() => isCanceled = creationDialog.State == AccountCreationDialogState.Canceled);
|
||||
await ExecuteUIThread(() => creationDialog.Complete(isCanceled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1095,6 +1095,17 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
|
||||
|
||||
Messenger.Send(new NewMailSynchronizationRequested(options));
|
||||
|
||||
if (createdAccount.IsCalendarAccessGranted)
|
||||
{
|
||||
var calendarOptions = new CalendarSynchronizationOptions()
|
||||
{
|
||||
AccountId = createdAccount.Id,
|
||||
Type = CalendarSynchronizationType.CalendarEvents
|
||||
};
|
||||
|
||||
Messenger.Send(new NewCalendarSynchronizationRequested(calendarOptions));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _nativeAppService.PinAppToTaskbarAsync();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user