mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-26 12:16:07 +01:00
Require user to verify email to use file Send (#1360)
This commit is contained in:
parent
fe80fd0ba1
commit
a2cff6da28
@ -21,8 +21,10 @@ namespace Bit.App.Pages
|
|||||||
private readonly IMessagingService _messagingService;
|
private readonly IMessagingService _messagingService;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly ISendService _sendService;
|
private readonly ISendService _sendService;
|
||||||
|
private readonly ITokenService _tokenService;
|
||||||
private bool _sendEnabled;
|
private bool _sendEnabled;
|
||||||
private bool _canAccessPremium;
|
private bool _canAccessPremium;
|
||||||
|
private bool _emailVerified;
|
||||||
private SendView _send;
|
private SendView _send;
|
||||||
private string _fileName;
|
private string _fileName;
|
||||||
private bool _showOptions;
|
private bool _showOptions;
|
||||||
@ -53,6 +55,7 @@ namespace Bit.App.Pages
|
|||||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||||
_userService = ServiceContainer.Resolve<IUserService>("userService");
|
_userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||||
_sendService = ServiceContainer.Resolve<ISendService>("sendService");
|
_sendService = ServiceContainer.Resolve<ISendService>("sendService");
|
||||||
|
_tokenService = ServiceContainer.Resolve<ITokenService>("tokenService");
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
|
|
||||||
TypeOptions = new List<KeyValuePair<string, SendType>>
|
TypeOptions = new List<KeyValuePair<string, SendType>>
|
||||||
@ -221,6 +224,7 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
PageTitle = EditMode ? AppResources.EditSend : AppResources.AddSend;
|
PageTitle = EditMode ? AppResources.EditSend : AppResources.AddSend;
|
||||||
_canAccessPremium = await _userService.CanAccessPremiumAsync();
|
_canAccessPremium = await _userService.CanAccessPremiumAsync();
|
||||||
|
_emailVerified = _tokenService.GetEmailVerified();
|
||||||
SendEnabled = ! await AppHelpers.IsSendDisabledByPolicyAsync();
|
SendEnabled = ! await AppHelpers.IsSendDisabledByPolicyAsync();
|
||||||
DisableHideEmail = await AppHelpers.IsHideEmailDisabledByPolicyAsync();
|
DisableHideEmail = await AppHelpers.IsHideEmailDisabledByPolicyAsync();
|
||||||
SendOptionsPolicyInEffect = SendEnabled && DisableHideEmail;
|
SendOptionsPolicyInEffect = SendEnabled && DisableHideEmail;
|
||||||
@ -246,7 +250,7 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var defaultType = _canAccessPremium ? SendType.File : SendType.Text;
|
var defaultType = _canAccessPremium && _emailVerified ? SendType.File : SendType.Text;
|
||||||
Send = new SendView
|
Send = new SendView
|
||||||
{
|
{
|
||||||
Type = Type.GetValueOrDefault(defaultType),
|
Type = Type.GetValueOrDefault(defaultType),
|
||||||
@ -340,6 +344,11 @@ namespace Bit.App.Pages
|
|||||||
await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired);
|
await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!_emailVerified)
|
||||||
|
{
|
||||||
|
await _platformUtilsService.ShowDialogAsync(AppResources.SendFileEmailVerificationRequired);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!EditMode)
|
if (!EditMode)
|
||||||
{
|
{
|
||||||
if (FileData == null)
|
if (FileData == null)
|
||||||
@ -459,9 +468,17 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
if (Send != null)
|
if (Send != null)
|
||||||
{
|
{
|
||||||
if (!EditMode && type == SendType.File && !_canAccessPremium)
|
if (!EditMode && type == SendType.File && (!_canAccessPremium || !_emailVerified))
|
||||||
{
|
{
|
||||||
await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired);
|
if (!_canAccessPremium)
|
||||||
|
{
|
||||||
|
await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired);
|
||||||
|
}
|
||||||
|
else if (!_emailVerified)
|
||||||
|
{
|
||||||
|
await _platformUtilsService.ShowDialogAsync(AppResources.SendFileEmailVerificationRequired);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsAddFromShare && Device.RuntimePlatform == Device.Android)
|
if (IsAddFromShare && Device.RuntimePlatform == Device.Android)
|
||||||
{
|
{
|
||||||
_deviceActionService.CloseMainApp();
|
_deviceActionService.CloseMainApp();
|
||||||
|
6
src/App/Resources/AppResources.Designer.cs
generated
6
src/App/Resources/AppResources.Designer.cs
generated
@ -3502,5 +3502,11 @@ namespace Bit.App.Resources {
|
|||||||
return ResourceManager.GetString("SendFilePremiumRequired", resourceCulture);
|
return ResourceManager.GetString("SendFilePremiumRequired", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string SendFileEmailVerificationRequired {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SendFileEmailVerificationRequired", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1983,4 +1983,8 @@
|
|||||||
<value>Free accounts are restricted to sharing text only. A premium membership is required to use files with Send.</value>
|
<value>Free accounts are restricted to sharing text only. A premium membership is required to use files with Send.</value>
|
||||||
<comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment>
|
<comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SendFileEmailVerificationRequired" xml:space="preserve">
|
||||||
|
<value>You must verify your email to use files with Send.</value>
|
||||||
|
<comment>'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated.</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
Loading…
Reference in New Issue
Block a user