From c67229d235a4bceb2aa872afd7c0cf5abb58cdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Bispo?= Date: Mon, 20 Jun 2022 12:28:00 +0100 Subject: [PATCH] PS-70 show upgrade to premium text on details to free user. --- src/App/Pages/Vault/ViewPageViewModel.cs | 34 ++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/App/Pages/Vault/ViewPageViewModel.cs b/src/App/Pages/Vault/ViewPageViewModel.cs index ffced6d18..829776af5 100644 --- a/src/App/Pages/Vault/ViewPageViewModel.cs +++ b/src/App/Pages/Vault/ViewPageViewModel.cs @@ -203,6 +203,26 @@ namespace Bit.App.Pages return fs; } } + + public FormattedString UpgradeToPremiumTotpText + { + get + { + var fs = new FormattedString(); + fs.Spans.Add(new Span + { + Text = "Upgrade to premium ", + TextColor = ThemeManager.GetResourceColor("PrimaryColor") + }); + fs.Spans.Add(new Span + { + Text = "to view verification codes", + TextColor = ThemeManager.GetResourceColor("MutedColor") + }); + return fs; + } + } + public bool ShowUris => IsLogin && Cipher.Login.HasUris; public bool ShowIdentityAddress => IsIdentity && ( !string.IsNullOrWhiteSpace(Cipher.Identity.Address1) || @@ -217,7 +237,7 @@ namespace Bit.App.Pages public string PasswordVisibilityAccessibilityText => ShowPassword ? AppResources.PasswordIsVisibleTapToHide : AppResources.PasswordIsNotVisibleTapToShow; public string TotpCodeFormatted { - get => _totpCodeFormatted; + get => _canAccessPremium ? _totpCodeFormatted : "--- ---"; set => SetProperty(ref _totpCodeFormatted, value, additionalPropertyNames: new string[] { @@ -227,7 +247,11 @@ namespace Bit.App.Pages public string TotpSec { get => _totpSec; - set => SetProperty(ref _totpSec, value); + set => SetProperty(ref _totpSec, value, + additionalPropertyNames: new string[] + { + nameof(TotpProgress) + }); } public bool TotpLow { @@ -238,6 +262,7 @@ namespace Bit.App.Pages Page.Resources["textTotp"] = ThemeManager.Resources()[value ? "text-danger" : "text-default"]; } } + public double TotpProgress => string.IsNullOrEmpty(TotpSec) ? 0 : double.Parse(TotpSec) * 100 / 30; public bool IsDeleted => Cipher.IsDeleted; public bool CanEdit => !Cipher.IsDeleted; @@ -707,6 +732,11 @@ namespace Bit.App.Pages return _passwordReprompted = await _passwordRepromptService.ShowPasswordPromptAsync(); } + + public void LaunchGetPremiumMembershipURI() + { + _platformUtilsService.LaunchUri("https://bitwarden.com/pricing/"); + } } public class ViewPageFieldViewModel : ExtendedViewModel