diff --git a/Wino.Core.Domain/Entities/MailAccountPreferences.cs b/Wino.Core.Domain/Entities/MailAccountPreferences.cs index ba14a98d..1e7db610 100644 --- a/Wino.Core.Domain/Entities/MailAccountPreferences.cs +++ b/Wino.Core.Domain/Entities/MailAccountPreferences.cs @@ -36,6 +36,11 @@ namespace Wino.Core.Domain.Entities /// public bool IsSignatureEnabled { get; set; } + /// + /// Gets or sets whether this account's unread items should be included in taskbar badge. + /// + public bool IsTaskbarBadgeEnabled { get; set; } = true; + /// /// Gets or sets signature for new messages. Null if signature is not needed. /// diff --git a/Wino.Core.Domain/Translations/en_US/resources.json b/Wino.Core.Domain/Translations/en_US/resources.json index 28242b46..e1c46713 100644 --- a/Wino.Core.Domain/Translations/en_US/resources.json +++ b/Wino.Core.Domain/Translations/en_US/resources.json @@ -513,6 +513,10 @@ "SettingsNoAccountSetupMessage": "You didn't setup any accounts yet.", "SettingsNotifications_Description": "Turn on or off notifications for this account.", "SettingsNotifications_Title": "Notifications", + "SettingsNotificationsAndTaskbar_Title": "Notifications & Taskbar", + "SettingsTaskbarBadge_Title": "Taskbar Badge", + "SettingsTaskbarBadge_Description": "Include unread mail count in taskbar icon.", + "SettingsNotificationsAndTaskbar_Description": "Change whether notifications should be displayed and taskbar badge for this account.", "SettingsPaneLengthReset_Description": "Reset the size of the mail list to original if you have issues with it.", "SettingsPaneLengthReset_Title": "Reset Mail List Size", "SettingsPaypal_Description": "Show much more love ❤️ All donations are appreciated.", diff --git a/Wino.Core.UWP/Services/NotificationBuilder.cs b/Wino.Core.UWP/Services/NotificationBuilder.cs index d6f5af70..caddecb0 100644 --- a/Wino.Core.UWP/Services/NotificationBuilder.cs +++ b/Wino.Core.UWP/Services/NotificationBuilder.cs @@ -166,6 +166,8 @@ namespace Wino.Core.UWP.Services foreach (var account in accounts) { + if (!account.Preferences.IsTaskbarBadgeEnabled) continue; + var accountInbox = await _folderService.GetSpecialFolderByAccountIdAsync(account.Id, SpecialFolderType.Inbox); if (accountInbox == null) diff --git a/Wino.Mail.ViewModels/AccountDetailsPageViewModel.cs b/Wino.Mail.ViewModels/AccountDetailsPageViewModel.cs index 306f3bff..6787f670 100644 --- a/Wino.Mail.ViewModels/AccountDetailsPageViewModel.cs +++ b/Wino.Mail.ViewModels/AccountDetailsPageViewModel.cs @@ -39,6 +39,9 @@ namespace Wino.Mail.ViewModels [ObservableProperty] private bool isAppendMessageSettinEnabled; + [ObservableProperty] + private bool isTaskbarBadgeEnabled; + public bool IsFocusedInboxSupportedForAccount => Account != null && Account.Preferences.IsFocusedInboxEnabled != null; @@ -120,6 +123,7 @@ namespace Wino.Mail.ViewModels IsAppendMessageSettingVisible = Account.ProviderType == MailProviderType.IMAP4; IsAppendMessageSettinEnabled = Account.Preferences.ShouldAppendMessagesToSentFolder; + IsTaskbarBadgeEnabled = Account.Preferences.IsTaskbarBadgeEnabled; OnPropertyChanged(nameof(IsFocusedInboxSupportedForAccount)); @@ -154,6 +158,10 @@ namespace Wino.Mail.ViewModels Account.Preferences.IsSignatureEnabled = IsSignatureEnabled; await _accountService.UpdateAccountAsync(Account); break; + case nameof(IsTaskbarBadgeEnabled): + Account.Preferences.IsTaskbarBadgeEnabled = IsTaskbarBadgeEnabled; + await _accountService.UpdateAccountAsync(Account); + break; } } } diff --git a/Wino.Mail/Views/Account/AccountDetailsPage.xaml b/Wino.Mail/Views/Account/AccountDetailsPage.xaml index 5903d054..bbdb850d 100644 --- a/Wino.Mail/Views/Account/AccountDetailsPage.xaml +++ b/Wino.Mail/Views/Account/AccountDetailsPage.xaml @@ -153,6 +153,32 @@ + + + + + + + + + + + + + + + + + + + + + + +