From b32603b472196dad31ca5c757e9336248c5ad2e8 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 21 Jul 2017 17:21:04 -0400 Subject: [PATCH] premium required for attachment download --- src/App/Pages/Vault/VaultViewLoginPage.cs | 14 ++++++++++---- src/App/Resources/AppResources.Designer.cs | 9 +++++++++ src/App/Resources/AppResources.resx | 3 +++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/App/Pages/Vault/VaultViewLoginPage.cs b/src/App/Pages/Vault/VaultViewLoginPage.cs index ef0fb2847..73f21da2e 100644 --- a/src/App/Pages/Vault/VaultViewLoginPage.cs +++ b/src/App/Pages/Vault/VaultViewLoginPage.cs @@ -277,8 +277,14 @@ namespace Bit.App.Pages private async Task OpenAttachmentAsync(Login login, VaultViewLoginPageModel.Attachment attachment) { - // 20 MB warning - if(attachment.Size >= 20971520 && !(await _userDialogs.ConfirmAsync( + if(!_tokenService.TokenPremium && !login.OrganizationUseTotp) + { + _userDialogs.Alert(AppResources.PremiumRequired); + return; + } + + // 10 MB warning + if(attachment.Size >= 10485760 && !(await _userDialogs.ConfirmAsync( string.Format(AppResources.AttachmentLargeWarning, attachment.SizeName), null, AppResources.Yes, AppResources.No))) { @@ -314,8 +320,8 @@ namespace Bit.App.Pages private void Copy(string copyText, string alertLabel) { - _deviceActionService.CopyToClipboard(copyText); - _userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, alertLabel)); + _deviceActionService.CopyToClipboard(copyText); + _userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, alertLabel)); } private void TotpTick(string totpKey) diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 4002a697f..927c9ec36 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -1771,6 +1771,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to A premium membership is required to use this feature.. + /// + public static string PremiumRequired { + get { + return ResourceManager.GetString("PremiumRequired", resourceCulture); + } + } + /// /// Looks up a localized string similar to bitwarden keeps your vault automatically synced by using push notifications. For the best possible experience, please select "Ok" on the following prompt when asked to enable push notifications.. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 910bd7c2f..da129b2a7 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -962,4 +962,7 @@ Disable Automatic TOTP Copy + + A premium membership is required to use this feature. + \ No newline at end of file