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