Hide email address for calendar only accounts and fix startup crash.

This commit is contained in:
Burak Kaan Köse
2026-04-20 23:19:53 +02:00
parent 877fb0dbd4
commit 66c556b587
3 changed files with 16 additions and 14 deletions
@@ -98,6 +98,7 @@ public partial class GroupedAccountCalendarViewModel : ObservableObject
public bool CanSynchronize => !IsSynchronizationInProgress; public bool CanSynchronize => !IsSynchronizationInProgress;
public bool IsSynchronizationProgressVisible => IsSynchronizationInProgress; public bool IsSynchronizationProgressVisible => IsSynchronizationInProgress;
public bool IsProgressIndeterminate => IsSynchronizationInProgress && TotalItemsToSync <= 0; public bool IsProgressIndeterminate => IsSynchronizationInProgress && TotalItemsToSync <= 0;
public string AccountAddressDisplay => string.IsNullOrWhiteSpace(Account?.Address) ? string.Empty : $" ({Account.Address})";
public double SynchronizationProgress public double SynchronizationProgress
{ {
@@ -201,5 +202,6 @@ public partial class GroupedAccountCalendarViewModel : ObservableObject
Account.MergedInboxId = updatedAccount.MergedInboxId; Account.MergedInboxId = updatedAccount.MergedInboxId;
AccountColorHex = updatedAccount.AccountColorHex; AccountColorHex = updatedAccount.AccountColorHex;
OnPropertyChanged(nameof(Account)); OnPropertyChanged(nameof(Account));
OnPropertyChanged(nameof(AccountAddressDisplay));
} }
} }
+13 -13
View File
@@ -190,7 +190,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
// First clear all account menu items. // First clear all account menu items.
MenuItems.RemoveRange(MenuItems.Where(a => a is IAccountMenuItem)); MenuItems.RemoveRange(MenuItems.Where(a => a is IAccountMenuItem));
var accounts = await GetMailEnabledAccountsAsync().ConfigureAwait(false); var accounts = await GetMailEnabledAccountsAsync();
List<Guid> initializedAccountIds = new(); List<Guid> initializedAccountIds = new();
@@ -375,7 +375,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
private async Task ForceAllAccountSynchronizationsAsync() private async Task ForceAllAccountSynchronizationsAsync()
{ {
// Run Inbox synchronization for all accounts on startup. // Run Inbox synchronization for all accounts on startup.
var accounts = await GetMailEnabledAccountsAsync().ConfigureAwait(false); var accounts = await GetMailEnabledAccountsAsync();
foreach (var account in accounts) foreach (var account in accounts)
{ {
@@ -403,7 +403,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
if (_launchProtocolService.LaunchParameter is AccountMenuItemExtended accountExtendedMessage) if (_launchProtocolService.LaunchParameter is AccountMenuItemExtended accountExtendedMessage)
{ {
// Find the account that this folder and mail belongs to. // Find the account that this folder and mail belongs to.
var account = await _mailService.GetMailAccountByUniqueIdAsync(accountExtendedMessage.NavigateMailItem.UniqueId).ConfigureAwait(false); var account = await _mailService.GetMailAccountByUniqueIdAsync(accountExtendedMessage.NavigateMailItem.UniqueId);
if (account != null && MenuItems.TryGetAccountMenuItem(account.Id, out IAccountMenuItem accountMenuItem)) if (account != null && MenuItems.TryGetAccountMenuItem(account.Id, out IAccountMenuItem accountMenuItem))
{ {
@@ -444,7 +444,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
private async Task ProcessLaunchDefaultAsync() private async Task ProcessLaunchDefaultAsync()
{ {
if (await NavigateToMailEmptyStateIfNeededAsync().ConfigureAwait(false)) if (await NavigateToMailEmptyStateIfNeededAsync())
return; return;
if (PreferencesService.StartupEntityId == null) if (PreferencesService.StartupEntityId == null)
@@ -974,7 +974,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
// No selected account. // No selected account.
// List all accounts and let user pick one. // List all accounts and let user pick one.
var accounts = await GetMailEnabledAccountsAsync().ConfigureAwait(false); var accounts = await GetMailEnabledAccountsAsync();
if (!accounts.Any()) if (!accounts.Any())
{ {
@@ -1099,7 +1099,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
public async void Receive(MailtoProtocolMessageRequested message) public async void Receive(MailtoProtocolMessageRequested message)
{ {
var accounts = await GetMailEnabledAccountsAsync().ConfigureAwait(false); var accounts = await GetMailEnabledAccountsAsync();
MailAccount targetAccount = null; MailAccount targetAccount = null;
@@ -1132,7 +1132,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
if (shareRequest?.Files == null || shareRequest.Files.Count == 0) if (shareRequest?.Files == null || shareRequest.Files.Count == 0)
return; return;
var accounts = await GetMailEnabledAccountsAsync().ConfigureAwait(false); var accounts = await GetMailEnabledAccountsAsync();
if (!accounts.Any()) if (!accounts.Any())
return; return;
@@ -1156,7 +1156,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
private async Task RecreateMenuItemsAsync() private async Task RecreateMenuItemsAsync()
{ {
await _menuRefreshSemaphore.WaitAsync().ConfigureAwait(false); await _menuRefreshSemaphore.WaitAsync();
try try
{ {
await ExecuteUIThread(() => await ExecuteUIThread(() =>
@@ -1206,7 +1206,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
else else
{ {
await ExecuteUIThread(() => SelectedMenuItem = null); await ExecuteUIThread(() => SelectedMenuItem = null);
if (!await NavigateToMailEmptyStateIfNeededAsync().ConfigureAwait(false)) if (!await NavigateToMailEmptyStateIfNeededAsync())
{ {
NavigateToWelcomeWizard(); NavigateToWelcomeWizard();
} }
@@ -1225,7 +1225,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
private async Task<List<MailAccount>> GetAccountsByCapabilityAsync(bool requireMail = false, bool requireCalendar = false) private async Task<List<MailAccount>> GetAccountsByCapabilityAsync(bool requireMail = false, bool requireCalendar = false)
{ {
var accounts = await _accountService.GetAccountsAsync().ConfigureAwait(false); var accounts = await _accountService.GetAccountsAsync();
return accounts return accounts
.Where(account => (!requireMail || account.IsMailAccessGranted) && .Where(account => (!requireMail || account.IsMailAccessGranted) &&
@@ -1235,7 +1235,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
private async Task<bool> NavigateToMailEmptyStateIfNeededAsync() private async Task<bool> NavigateToMailEmptyStateIfNeededAsync()
{ {
var accounts = await _accountService.GetAccountsAsync().ConfigureAwait(false); var accounts = await _accountService.GetAccountsAsync();
if (!accounts.Any() || accounts.Any(account => account.IsMailAccessGranted)) if (!accounts.Any() || accounts.Any(account => account.IsMailAccessGranted))
return false; return false;
@@ -1451,7 +1451,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
if (remainingAccounts.Any()) if (remainingAccounts.Any())
{ {
await NavigateToMailEmptyStateIfNeededAsync().ConfigureAwait(false); await NavigateToMailEmptyStateIfNeededAsync();
} }
return; return;
@@ -1475,7 +1475,7 @@ public partial class MailAppShellViewModel : MailBaseViewModel,
if (!createdAccount.IsMailAccessGranted) if (!createdAccount.IsMailAccessGranted)
{ {
await NavigateToMailEmptyStateIfNeededAsync().ConfigureAwait(false); await NavigateToMailEmptyStateIfNeededAsync();
} }
if (!MenuItems.TryGetAccountMenuItem(createdAccount.Id, out IAccountMenuItem createdMenuItem)) if (!MenuItems.TryGetAccountMenuItem(createdAccount.Id, out IAccountMenuItem createdMenuItem))
+1 -1
View File
@@ -644,7 +644,7 @@
Spacing="2"> Spacing="2">
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap"> <TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Run FontWeight="SemiBold" Text="{x:Bind Account.Name}" /> <Run FontWeight="SemiBold" Text="{x:Bind Account.Name}" />
<Run FontSize="12" Text=" (" /><Run FontSize="12" Text="{x:Bind Account.Address}" /><Run FontSize="12" Text=")" /> <Run FontSize="12" Text="{x:Bind AccountAddressDisplay, Mode=OneWay}" />
</TextBlock> </TextBlock>
<TextBlock <TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}" Foreground="{ThemeResource TextFillColorSecondaryBrush}"