From 690e04c377e8f68791cc4974505fb1b6b940b18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Thu, 13 Jun 2024 22:51:29 +0200 Subject: [PATCH] Fixed an issue where merged accounts are counting as 1 account for premium limit. --- .../Interfaces/IAccountProviderDetailViewModel.cs | 5 +++++ Wino.Mail.ViewModels/AccountManagementViewModel.cs | 2 +- Wino.Mail.ViewModels/Data/AccountProviderDetailViewModel.cs | 2 ++ .../Data/MergedAccountProviderDetailViewModel.cs | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Wino.Core.Domain/Interfaces/IAccountProviderDetailViewModel.cs b/Wino.Core.Domain/Interfaces/IAccountProviderDetailViewModel.cs index 2778acd2..d4a9b279 100644 --- a/Wino.Core.Domain/Interfaces/IAccountProviderDetailViewModel.cs +++ b/Wino.Core.Domain/Interfaces/IAccountProviderDetailViewModel.cs @@ -29,5 +29,10 @@ namespace Wino.Core.Domain.Interfaces /// Provider details of the account. /// IProviderDetail ProviderDetail { get; set; } + + /// + /// How many accounts this provider has. + /// + int HoldingAccountCount { get; } } } diff --git a/Wino.Mail.ViewModels/AccountManagementViewModel.cs b/Wino.Mail.ViewModels/AccountManagementViewModel.cs index 712ac35a..dac24f3f 100644 --- a/Wino.Mail.ViewModels/AccountManagementViewModel.cs +++ b/Wino.Mail.ViewModels/AccountManagementViewModel.cs @@ -42,7 +42,7 @@ namespace Wino.Mail.ViewModels public bool IsPurchasePanelVisible => !HasUnlimitedAccountProduct; public bool IsAccountCreationAlmostOnLimit => Accounts != null && Accounts.Count == FREE_ACCOUNT_COUNT - 1; public bool HasAccountsDefined => Accounts != null && Accounts.Any(); - public bool CanReorderAccounts => Accounts?.Count > 1; + public bool CanReorderAccounts => Accounts?.Sum(a => a.HoldingAccountCount) > 1; public string UsedAccountsString => string.Format(Translator.WinoUpgradeRemainingAccountsMessage, Accounts.Count, FREE_ACCOUNT_COUNT); diff --git a/Wino.Mail.ViewModels/Data/AccountProviderDetailViewModel.cs b/Wino.Mail.ViewModels/Data/AccountProviderDetailViewModel.cs index cd2d2a89..8cdacde7 100644 --- a/Wino.Mail.ViewModels/Data/AccountProviderDetailViewModel.cs +++ b/Wino.Mail.ViewModels/Data/AccountProviderDetailViewModel.cs @@ -21,6 +21,8 @@ namespace Wino.Mail.ViewModels.Data public string StartupEntityAddresses => Account.Address; + public int HoldingAccountCount => 1; + public AccountProviderDetailViewModel(IProviderDetail providerDetail, MailAccount account) { ProviderDetail = providerDetail; diff --git a/Wino.Mail.ViewModels/Data/MergedAccountProviderDetailViewModel.cs b/Wino.Mail.ViewModels/Data/MergedAccountProviderDetailViewModel.cs index 1bd7de5b..07f3476b 100644 --- a/Wino.Mail.ViewModels/Data/MergedAccountProviderDetailViewModel.cs +++ b/Wino.Mail.ViewModels/Data/MergedAccountProviderDetailViewModel.cs @@ -24,6 +24,8 @@ namespace Wino.Mail.ViewModels.Data public string StartupEntityAddresses => AccountAddresses; + public int HoldingAccountCount => HoldingAccounts.Count; + public MergedAccountProviderDetailViewModel(MergedInbox mergedInbox, List holdingAccounts) { MergedInbox = mergedInbox;