Fix focus-other toggle for Live accounts.

This commit is contained in:
Burak Kaan Köse
2024-12-22 00:59:59 +01:00
parent 8390a868ba
commit da2a58a88b
3 changed files with 14 additions and 7 deletions

View File

@@ -155,6 +155,6 @@ namespace Wino.Core.Domain.Interfaces
/// <param name="accountId">Account id.</param>
/// <returns>Primary alias for the account.</returns>
Task<MailAccountAlias> GetPrimaryAccountAliasAsync(Guid accountId);
Task<bool> IsAccountFocusedEnabledAsync(Guid accountId);
}
}

View File

@@ -72,6 +72,7 @@ namespace Wino.Mail.ViewModels
public IPreferencesService PreferencesService { get; }
public IThemeService ThemeService { get; }
private readonly IAccountService _accountService;
private readonly IMailService _mailService;
private readonly IFolderService _folderService;
private readonly IThreadingStrategyProvider _threadingStrategyProvider;
@@ -147,6 +148,7 @@ namespace Wino.Mail.ViewModels
public MailListPageViewModel(IMailDialogService dialogService,
INavigationService navigationService,
IAccountService accountService,
IMailService mailService,
IStatePersistanceService statePersistenceService,
IFolderService folderService,
@@ -163,7 +165,7 @@ namespace Wino.Mail.ViewModels
_winoServerConnectionManager = winoServerConnectionManager;
StatePersistenceService = statePersistenceService;
NavigationService = navigationService;
_accountService = accountService;
_mailService = mailService;
_folderService = folderService;
_threadingStrategyProvider = threadingStrategyProvider;
@@ -376,7 +378,7 @@ namespace Wino.Mail.ViewModels
SetupTopBarActions();
}
private void UpdateFolderPivots()
private async Task UpdateFolderPivotsAsync()
{
PivotFolders.Clear();
SelectedFolderPivot = null;
@@ -393,8 +395,7 @@ namespace Wino.Mail.ViewModels
{
var parentAccount = singleFolderMenuItem.ParentAccount;
bool isAccountSupportsFocusedInbox = parentAccount.Preferences.IsFocusedInboxEnabled != null;
bool isFocusedInboxEnabled = isAccountSupportsFocusedInbox && parentAccount.Preferences.IsFocusedInboxEnabled.GetValueOrDefault();
bool isFocusedInboxEnabled = await _accountService.IsAccountFocusedEnabledAsync(parentAccount.Id);
bool isInboxFolder = ActiveFolder.SpecialFolderType == SpecialFolderType.Inbox;
// Folder supports Focused - Other
@@ -515,7 +516,7 @@ namespace Wino.Mail.ViewModels
{
if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode)
{
UpdateFolderPivots();
UpdateFolderPivotsAsync();
IsInSearchMode = false;
await InitializeFolderAsync();
}
@@ -891,7 +892,7 @@ namespace Wino.Mail.ViewModels
OnPropertyChanged(nameof(IsArchiveSpecialFolder));
// Prepare Focused - Other or folder name tabs.
UpdateFolderPivots();
UpdateFolderPivotsAsync();
// Reset filters and sorting options.
ResetFilters();

View File

@@ -578,5 +578,11 @@ namespace Wino.Services
return aliases.FirstOrDefault(a => a.IsPrimary) ?? aliases.First();
}
public async Task<bool> IsAccountFocusedEnabledAsync(Guid accountId)
{
var account = await GetAccountAsync(accountId);
return account.Preferences.IsFocusedInboxEnabled.GetValueOrDefault();
}
}
}