Import functionality for wino accounts, calendar sync UI, bunch of shell improvements
This commit is contained in:
@@ -52,6 +52,9 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
System.Windows.Input.ICommand ICalendarShellClient.DateClickedCommand => DateClickedCommand;
|
||||
System.Windows.Input.ICommand ICalendarShellClient.PreviousDateRangeCommand => PreviousDateRangeCommand;
|
||||
System.Windows.Input.ICommand ICalendarShellClient.NextDateRangeCommand => NextDateRangeCommand;
|
||||
System.Windows.Input.ICommand ICalendarShellClient.SyncCommand => SyncCommand;
|
||||
|
||||
public bool CanSynchronizeCalendars => !AccountCalendarStateService.IsAnySynchronizationInProgress;
|
||||
|
||||
public MenuItemCollection MenuItems { get; private set; }
|
||||
public MenuItemCollection FooterItems { get; private set; }
|
||||
@@ -75,7 +78,6 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
private readonly SemaphoreSlim _accountCalendarUpdateSemaphoreSlim = new(1);
|
||||
private readonly CalendarPageViewModel _calendarPageViewModel;
|
||||
private readonly IMailDialogService _dialogService;
|
||||
private readonly IUpdateManager _updateManager;
|
||||
private readonly IStoreUpdateService _storeUpdateService;
|
||||
private readonly IAccountService _accountService;
|
||||
private readonly ICalendarService _calendarService;
|
||||
@@ -93,7 +95,6 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
INavigationService navigationService,
|
||||
CalendarPageViewModel calendarPageViewModel,
|
||||
IMailDialogService dialogService,
|
||||
IUpdateManager updateManager,
|
||||
IStoreUpdateService storeUpdateService,
|
||||
IDateContextProvider dateContextProvider)
|
||||
{
|
||||
@@ -105,11 +106,11 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
_calendarService = calendarService;
|
||||
_calendarPageViewModel = calendarPageViewModel;
|
||||
_dialogService = dialogService;
|
||||
_updateManager = updateManager;
|
||||
_storeUpdateService = storeUpdateService;
|
||||
_dateContextProvider = dateContextProvider;
|
||||
|
||||
_calendarPageViewModel.PropertyChanged += CalendarPageViewModelPropertyChanged;
|
||||
AccountCalendarStateService.PropertyChanged += AccountCalendarStateServicePropertyChanged;
|
||||
}
|
||||
|
||||
protected override void OnDispatcherAssigned()
|
||||
@@ -177,11 +178,6 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
await InitializeAccountCalendarsAsync();
|
||||
ValidateConfiguredNewEventCalendar();
|
||||
|
||||
if (shouldRunStartupFlows)
|
||||
{
|
||||
await ShowWhatIsNewIfNeededAsync();
|
||||
}
|
||||
|
||||
TodayClicked();
|
||||
}
|
||||
|
||||
@@ -218,6 +214,15 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
_calendarPageViewModel.CleanupForShellDeactivation();
|
||||
}
|
||||
|
||||
private void AccountCalendarStateServicePropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != nameof(IAccountCalendarStateService.IsAnySynchronizationInProgress))
|
||||
return;
|
||||
|
||||
OnPropertyChanged(nameof(CanSynchronizeCalendars));
|
||||
SyncCommand.NotifyCanExecuteChanged();
|
||||
}
|
||||
|
||||
private void AttachRuntimeSubscriptions()
|
||||
{
|
||||
if (_runtimeSubscriptionsAttached)
|
||||
@@ -240,18 +245,6 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
_runtimeSubscriptionsAttached = false;
|
||||
}
|
||||
|
||||
private async Task ShowWhatIsNewIfNeededAsync()
|
||||
{
|
||||
if (!_updateManager.ShouldShowUpdateNotes())
|
||||
return;
|
||||
|
||||
var notes = await _updateManager.GetLatestUpdateNotesAsync();
|
||||
if (notes.Sections.Count == 0)
|
||||
return;
|
||||
|
||||
await _dialogService.ShowWhatIsNewDialogAsync(notes);
|
||||
}
|
||||
|
||||
private async Task RefreshFooterItemsAsync(bool showNotification)
|
||||
{
|
||||
await ExecuteUIThread(() =>
|
||||
@@ -326,7 +319,7 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
_navigationDate = null;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
[RelayCommand(CanExecute = nameof(CanSynchronizeCalendars))]
|
||||
private async Task Sync()
|
||||
{
|
||||
var accounts = await _accountService.GetAccountsAsync().ConfigureAwait(false);
|
||||
@@ -335,7 +328,7 @@ public partial class CalendarAppShellViewModel : CalendarBaseViewModel,
|
||||
Messenger.Send(new NewCalendarSynchronizationRequested(new CalendarSynchronizationOptions
|
||||
{
|
||||
AccountId = account.Id,
|
||||
Type = CalendarSynchronizationType.CalendarEvents
|
||||
Type = CalendarSynchronizationType.Strict
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public partial class GroupedAccountCalendarViewModel : ObservableObject
|
||||
{
|
||||
Account = account;
|
||||
AccountCalendars = new ObservableCollection<AccountCalendarViewModel>(calendarViewModels);
|
||||
AccountColorHex = account.AccountColorHex;
|
||||
|
||||
ManageIsCheckedState();
|
||||
|
||||
@@ -74,6 +75,18 @@ public partial class GroupedAccountCalendarViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
public partial bool? IsCheckedState { get; set; } = true;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string AccountColorHex { get; set; } = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool IsSynchronizationInProgress { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string SynchronizationStatus { get; set; } = string.Empty;
|
||||
|
||||
public bool CanSynchronize => !IsSynchronizationInProgress;
|
||||
public bool IsSynchronizationProgressVisible => IsSynchronizationInProgress;
|
||||
|
||||
private bool _isExternalPropChangeBlocked = false;
|
||||
|
||||
private void ManageIsCheckedState()
|
||||
@@ -142,4 +155,24 @@ public partial class GroupedAccountCalendarViewModel : ObservableObject
|
||||
|
||||
CalendarSelectionStateChanged?.Invoke(this, accountCalendarViewModel);
|
||||
}
|
||||
|
||||
partial void OnIsSynchronizationInProgressChanged(bool value)
|
||||
{
|
||||
OnPropertyChanged(nameof(CanSynchronize));
|
||||
OnPropertyChanged(nameof(IsSynchronizationProgressVisible));
|
||||
}
|
||||
|
||||
public void UpdateAccount(MailAccount updatedAccount)
|
||||
{
|
||||
if (updatedAccount == null || updatedAccount.Id != Account.Id)
|
||||
return;
|
||||
|
||||
Account.Name = updatedAccount.Name;
|
||||
Account.Address = updatedAccount.Address;
|
||||
Account.AccountColorHex = updatedAccount.AccountColorHex;
|
||||
Account.AttentionReason = updatedAccount.AttentionReason;
|
||||
Account.MergedInboxId = updatedAccount.MergedInboxId;
|
||||
AccountColorHex = updatedAccount.AccountColorHex;
|
||||
OnPropertyChanged(nameof(Account));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,6 @@ public interface IAccountCalendarStateService : INotifyPropertyChanged
|
||||
/// </summary>
|
||||
IEnumerable<AccountCalendarViewModel> ActiveCalendars { get; }
|
||||
IEnumerable<AccountCalendarViewModel> AllCalendars { get; }
|
||||
bool IsAnySynchronizationInProgress { get; }
|
||||
ReadOnlyObservableGroupedCollection<MailAccount, AccountCalendarViewModel> GroupedCalendars { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user