[PS-686] Mobile update negative copy in settings (#1961)

* feat: update auto totp copy setting

* feat: update show icons settings

* feat: update auto add settings

* feat: update settings and options to sentence case

* feat: update translation keys

With the latest changes the translation keys had diverged from their contents.
This commit fixes that.

* fix: revert AndroidManifest changes

* chore: add todo comments to fix negative functions
This commit is contained in:
Andreas Coroiu 2022-07-11 08:45:42 +02:00 committed by GitHub
parent cceded2a0f
commit 67f49a0591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 79 additions and 86 deletions

View File

@ -83,31 +83,31 @@
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n DisableAutoTotpCopy}"
Text="{u:I18n CopyTotpAutomatically}"
StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding DisableAutoTotpCopy}"
IsToggled="{Binding AutoTotpCopy}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout>
<Label
Text="{u:I18n DisableAutoTotpCopyDescription}"
Text="{u:I18n CopyTotpAutomaticallyDescription}"
StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout>
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n DisableWebsiteIcons}"
Text="{u:I18n ShowWebsiteIcons}"
StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding DisableFavicon}"
IsToggled="{Binding Favicon}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout>
<Label
Text="{u:I18n DisableWebsiteIconsDescription}"
Text="{u:I18n ShowWebsiteIconsDescription}"
StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAutofillSettings}">
@ -117,16 +117,16 @@
</StackLayout>
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n DisableSavePrompt}"
Text="{u:I18n AskToAddLogin}"
StyleClass="box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding AutofillDisableSavePrompt}"
IsToggled="{Binding AutofillSavePrompt}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout>
<Label
Text="{u:I18n DisableSavePromptDescription}"
Text="{u:I18n AskToAddLoginDescription}"
StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAutofillSettings}">

View File

@ -12,15 +12,14 @@ namespace Bit.App.Pages
{
public class OptionsPageViewModel : BaseViewModel
{
private readonly ITotpService _totpService;
private readonly IStateService _stateService;
private readonly IMessagingService _messagingService;
private bool _autofillDisableSavePrompt;
private bool _autofillSavePrompt;
private string _autofillBlacklistedUris;
private bool _disableFavicon;
private bool _disableAutoTotpCopy;
private bool _favicon;
private bool _autoTotpCopy;
private int _clearClipboardSelectedIndex;
private int _themeSelectedIndex;
private int _autoDarkThemeSelectedIndex;
@ -31,7 +30,6 @@ namespace Bit.App.Pages
public OptionsPageViewModel()
{
_totpService = ServiceContainer.Resolve<ITotpService>("totpService");
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
@ -133,38 +131,38 @@ namespace Bit.App.Pages
}
}
public bool DisableFavicon
public bool Favicon
{
get => _disableFavicon;
get => _favicon;
set
{
if (SetProperty(ref _disableFavicon, value))
if (SetProperty(ref _favicon, value))
{
UpdateDisableFaviconAsync().FireAndForget();
UpdateFaviconAsync().FireAndForget();
}
}
}
public bool DisableAutoTotpCopy
public bool AutoTotpCopy
{
get => _disableAutoTotpCopy;
get => _autoTotpCopy;
set
{
if (SetProperty(ref _disableAutoTotpCopy, value))
if (SetProperty(ref _autoTotpCopy, value))
{
UpdateAutoTotpCopyAsync().FireAndForget();
}
}
}
public bool AutofillDisableSavePrompt
public bool AutofillSavePrompt
{
get => _autofillDisableSavePrompt;
get => _autofillSavePrompt;
set
{
if (SetProperty(ref _autofillDisableSavePrompt, value))
if (SetProperty(ref _autofillSavePrompt, value))
{
UpdateAutofillDisableSavePromptAsync().FireAndForget();
UpdateAutofillSavePromptAsync().FireAndForget();
}
}
}
@ -183,11 +181,11 @@ namespace Bit.App.Pages
public async Task InitAsync()
{
AutofillDisableSavePrompt = (await _stateService.GetAutofillDisableSavePromptAsync()).GetValueOrDefault();
AutofillSavePrompt = !(await _stateService.GetAutofillDisableSavePromptAsync()).GetValueOrDefault();
var blacklistedUrisList = await _stateService.GetAutofillBlacklistedUrisAsync();
AutofillBlacklistedUris = blacklistedUrisList != null ? string.Join(", ", blacklistedUrisList) : null;
DisableAutoTotpCopy = !(await _totpService.IsAutoCopyEnabledAsync());
DisableFavicon = (await _stateService.GetDisableFaviconAsync()).GetValueOrDefault();
AutoTotpCopy = !(await _stateService.GetDisableAutoTotpCopyAsync() ?? false);
Favicon = !(await _stateService.GetDisableFaviconAsync()).GetValueOrDefault();
var theme = await _stateService.GetThemeAsync();
ThemeSelectedIndex = ThemeOptions.FindIndex(k => k.Key == theme);
var autoDarkTheme = await _stateService.GetAutoDarkThemeAsync() ?? "dark";
@ -204,15 +202,17 @@ namespace Bit.App.Pages
{
if (_inited)
{
await _stateService.SetDisableAutoTotpCopyAsync(DisableAutoTotpCopy);
// TODO: [PS-961] Fix negative function names
await _stateService.SetDisableAutoTotpCopyAsync(!AutoTotpCopy);
}
}
private async Task UpdateDisableFaviconAsync()
private async Task UpdateFaviconAsync()
{
if (_inited)
{
await _stateService.SetDisableFaviconAsync(DisableFavicon);
// TODO: [PS-961] Fix negative function names
await _stateService.SetDisableFaviconAsync(!Favicon);
}
}
@ -243,11 +243,12 @@ namespace Bit.App.Pages
}
}
private async Task UpdateAutofillDisableSavePromptAsync()
private async Task UpdateAutofillSavePromptAsync()
{
if (_inited)
{
await _stateService.SetAutofillDisableSavePromptAsync(AutofillDisableSavePrompt);
// TODO: [PS-961] Fix negative function names
await _stateService.SetAutofillDisableSavePromptAsync(!AutofillSavePrompt);
}
}

View File

@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -9,9 +10,10 @@
namespace Bit.App.Resources {
using System;
using System.Reflection;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.1.0.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class AppResources {
@ -1479,15 +1481,15 @@ namespace Bit.App.Resources {
}
}
public static string DisableAutoTotpCopyDescription {
public static string CopyTotpAutomaticallyDescription {
get {
return ResourceManager.GetString("DisableAutoTotpCopyDescription", resourceCulture);
return ResourceManager.GetString("CopyTotpAutomaticallyDescription", resourceCulture);
}
}
public static string DisableAutoTotpCopy {
public static string CopyTotpAutomatically {
get {
return ResourceManager.GetString("DisableAutoTotpCopy", resourceCulture);
return ResourceManager.GetString("CopyTotpAutomatically", resourceCulture);
}
}
@ -1917,15 +1919,15 @@ namespace Bit.App.Resources {
}
}
public static string DisableWebsiteIcons {
public static string ShowWebsiteIcons {
get {
return ResourceManager.GetString("DisableWebsiteIcons", resourceCulture);
return ResourceManager.GetString("ShowWebsiteIcons", resourceCulture);
}
}
public static string DisableWebsiteIconsDescription {
public static string ShowWebsiteIconsDescription {
get {
return ResourceManager.GetString("DisableWebsiteIconsDescription", resourceCulture);
return ResourceManager.GetString("ShowWebsiteIconsDescription", resourceCulture);
}
}
@ -2757,15 +2759,15 @@ namespace Bit.App.Resources {
}
}
public static string DisableSavePrompt {
public static string AskToAddLogin {
get {
return ResourceManager.GetString("DisableSavePrompt", resourceCulture);
return ResourceManager.GetString("AskToAddLogin", resourceCulture);
}
}
public static string DisableSavePromptDescription {
public static string AskToAddLoginDescription {
get {
return ResourceManager.GetString("DisableSavePromptDescription", resourceCulture);
return ResourceManager.GetString("AskToAddLoginDescription", resourceCulture);
}
}

View File

@ -236,7 +236,7 @@
<comment>The button text that allows user to launch the website to their web browser.</comment>
</data>
<data name="HelpAndFeedback" xml:space="preserve">
<value>Help and Feedback</value>
<value>Help and feedback</value>
</data>
<data name="Hide" xml:space="preserve">
<value>Hide</value>
@ -269,7 +269,7 @@
<comment>Title for login page. (noun)</comment>
</data>
<data name="LogOut" xml:space="preserve">
<value>Log Out</value>
<value>Log out</value>
<comment>The log out button text (verb).</comment>
</data>
<data name="LogoutConfirmation" xml:space="preserve">
@ -412,7 +412,7 @@
<value>Add an Item</value>
</data>
<data name="AppExtension" xml:space="preserve">
<value>App Extension</value>
<value>App extension</value>
</data>
<data name="AutofillAccessibilityDescription" xml:space="preserve">
<value>Use the Bitwarden accessibility service to auto-fill your logins across apps and the web.</value>
@ -516,7 +516,7 @@
<value>Get your master password hint</value>
</data>
<data name="ImportItems" xml:space="preserve">
<value>Import Items</value>
<value>Import items</value>
</data>
<data name="ImportItemsConfirmation" xml:space="preserve">
<value>You can bulk import items from the bitwarden.com web vault. Do you want to visit the website now?</value>
@ -549,10 +549,10 @@
<value>Immediately</value>
</data>
<data name="VaultTimeout" xml:space="preserve">
<value>Vault Timeout</value>
<value>Vault timeout</value>
</data>
<data name="VaultTimeoutAction" xml:space="preserve">
<value>Vault Timeout Action</value>
<value>Vault timeout action</value>
</data>
<data name="VaultTimeoutLogOutConfirmation" xml:space="preserve">
<value>Logging out will remove all access to your vault and requires online authentication after the timeout period. Are you sure you want to use this setting?</value>
@ -647,7 +647,7 @@
<comment>Push notifications for apple products</comment>
</data>
<data name="RateTheApp" xml:space="preserve">
<value>Rate the App</value>
<value>Rate the app</value>
</data>
<data name="RateTheAppDescription" xml:space="preserve">
<value>Please consider helping us out with a good review!</value>
@ -701,7 +701,7 @@
<comment>What Apple calls their fingerprint reader.</comment>
</data>
<data name="TwoStepLogin" xml:space="preserve">
<value>Two-step Login</value>
<value>Two-step login</value>
</data>
<data name="TwoStepLoginConfirmation" xml:space="preserve">
<value>Two-step login makes your account more secure by requiring you to verify your login with another device such as a security key, authenticator app, SMS, phone call, or email. Two-step login can be enabled on the bitwarden.com web vault. Do you want to visit the website now?</value>
@ -710,7 +710,7 @@
<value>Unlock with {0}</value>
</data>
<data name="UnlockWithPIN" xml:space="preserve">
<value>Unlock with PIN Code</value>
<value>Unlock with PIN code</value>
</data>
<data name="Validating" xml:space="preserve">
<value>Validating</value>
@ -907,11 +907,11 @@
<data name="CopyTotp" xml:space="preserve">
<value>Copy TOTP</value>
</data>
<data name="DisableAutoTotpCopyDescription" xml:space="preserve">
<value>If your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard whenever you auto-fill the login.</value>
<data name="CopyTotpAutomaticallyDescription" xml:space="preserve">
<value>If a login has an authenticator key, copy the TOTP verification code to your clip-board when you auto-fill the login.</value>
</data>
<data name="DisableAutoTotpCopy" xml:space="preserve">
<value>Disable Automatic TOTP Copy</value>
<data name="CopyTotpAutomatically" xml:space="preserve">
<value>Copy TOTP automatically</value>
</data>
<data name="PremiumRequired" xml:space="preserve">
<value>A premium membership is required to use this feature.</value>
@ -1128,11 +1128,11 @@
<data name="Expiration" xml:space="preserve">
<value>Expiration</value>
</data>
<data name="DisableWebsiteIcons" xml:space="preserve">
<value>Disable Website Icons</value>
<data name="ShowWebsiteIcons" xml:space="preserve">
<value>Show website icons</value>
</data>
<data name="DisableWebsiteIconsDescription" xml:space="preserve">
<value>Website Icons provide a recognizable image next to each login item in your vault.</value>
<data name="ShowWebsiteIconsDescription" xml:space="preserve">
<value>Show a recognizable image next to each login.</value>
</data>
<data name="IconsUrl" xml:space="preserve">
<value>Icons Server URL</value>
@ -1311,7 +1311,7 @@
<value>5. Select "Bitwarden"</value>
</data>
<data name="PasswordAutofill" xml:space="preserve">
<value>Password AutoFill</value>
<value>Password auto-fill</value>
</data>
<data name="BitwardenAutofillAlert2" xml:space="preserve">
<value>The easiest way to add new logins to your vault is by using the Bitwarden Password AutoFill extension. Learn more about using the Bitwarden Password AutoFill extension by navigating to the "Settings" screen.</value>
@ -1449,7 +1449,7 @@
<value>There are no folders to list.</value>
</data>
<data name="FingerprintPhrase" xml:space="preserve">
<value>Fingerprint Phrase</value>
<value>Fingerprint phrase</value>
<comment>A 'fingerprint phrase' is a unique word phrase (similar to a passphrase) that a user can use to authenticate their public key with another user, for the purposes of sharing.</comment>
</data>
<data name="YourAccountsFingerprint" xml:space="preserve">
@ -1460,10 +1460,10 @@
<value>Bitwarden allows you to share your vault items with others by using an organization account. Would you like to visit the bitwarden.com website to learn more?</value>
</data>
<data name="ExportVault" xml:space="preserve">
<value>Export Vault</value>
<value>Export vault</value>
</data>
<data name="LockNow" xml:space="preserve">
<value>Lock Now</value>
<value>Lock now</value>
</data>
<data name="PIN" xml:space="preserve">
<value>PIN</value>
@ -1517,7 +1517,7 @@
<value>2 minutes</value>
</data>
<data name="ClearClipboard" xml:space="preserve">
<value>Clear Clipboard</value>
<value>Clear clipboard</value>
<comment>Clipboard is the operating system thing where you copy/paste data to on your device.</comment>
</data>
<data name="ClearClipboardDescription" xml:space="preserve">
@ -1525,7 +1525,7 @@
<comment>Clipboard is the operating system thing where you copy/paste data to on your device.</comment>
</data>
<data name="DefaultUriMatchDetection" xml:space="preserve">
<value>Default URI Match Detection</value>
<value>Default URI match detection</value>
<comment>Default URI match detection for auto-fill.</comment>
</data>
<data name="DefaultUriMatchDetectionDescription" xml:space="preserve">
@ -1573,14 +1573,14 @@
<data name="BlacklistedUrisDescription" xml:space="preserve">
<value>URIs that are blacklisted will not offer auto-fill. The list should be comma separated. Ex: "https://twitter.com, androidapp://com.twitter.android".</value>
</data>
<data name="DisableSavePrompt" xml:space="preserve">
<value>Disable Save Prompt</value>
<data name="AskToAddLogin" xml:space="preserve">
<value>Ask to add login</value>
</data>
<data name="DisableSavePromptDescription" xml:space="preserve">
<value>The "Save Prompt" automatically prompts you to save new items to your vault whenever you enter them for the first time.</value>
<data name="AskToAddLoginDescription" xml:space="preserve">
<value>Ask to add an item if one isn't found in your vault.</value>
</data>
<data name="OnRestart" xml:space="preserve">
<value>On App Restart</value>
<value>On app restart</value>
</data>
<data name="AutofillServiceNotEnabled" xml:space="preserve">
<value>Auto-fill makes it easy to securely access your Bitwarden vault from other websites and apps. It looks like you have not enabled an auto-fill service for Bitwarden. Enable auto-fill for Bitwarden from the "Settings" screen.</value>
@ -2159,7 +2159,7 @@
<value>Account removed successfully</value>
</data>
<data name="DeleteAccount" xml:space="preserve">
<value>Delete Account</value>
<value>Delete account</value>
</data>
<data name="DeletingYourAccountIsPermanent" xml:space="preserve">
<value>Deleting your account is permanent</value>

View File

@ -6,6 +6,5 @@ namespace Bit.Core.Abstractions
{
Task<string> GetCodeAsync(string key);
int GetTimeInterval(string key);
Task<bool> IsAutoCopyEnabledAsync();
}
}

View File

@ -10,14 +10,11 @@ namespace Bit.Core.Services
{
private const string SteamChars = "23456789BCDFGHJKMNPQRTVWXY";
private readonly IStateService _stateService;
private readonly ICryptoFunctionService _cryptoFunctionService;
public TotpService(
IStateService stateService,
ICryptoFunctionService cryptoFunctionService)
{
_stateService = stateService;
_cryptoFunctionService = cryptoFunctionService;
}
@ -132,11 +129,5 @@ namespace Bit.Core.Services
}
return period;
}
public async Task<bool> IsAutoCopyEnabledAsync()
{
var disabled = await _stateService.GetDisableAutoTotpCopyAsync();
return !disabled.GetValueOrDefault();
}
}
}

View File

@ -74,7 +74,7 @@ namespace Bit.Core.Utilities
});
var passwordGenerationService = new PasswordGenerationService(cryptoService, stateService,
cryptoFunctionService, policyService);
var totpService = new TotpService(stateService, cryptoFunctionService);
var totpService = new TotpService(cryptoFunctionService);
var authService = new AuthService(cryptoService, cryptoFunctionService, apiService, stateService,
tokenService, appIdService, i18nService, platformUtilsService, messagingService, vaultTimeoutService,
keyConnectorService);