Commit 524cceb5 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][Password-Breach] Update settings strings

Screenshots:
https://drive.google.com/open?id=1FtWB0KqauDTnX-PicF1aMets092Jo2rj
https://drive.google.com/file/d/1Scn70Xe29D4rno6OmMkif1N64XlswnPR
https://drive.google.com/file/d/1mQunVKqxB63hxet8WdmP3BSTLrMsV0Nu

Bug: 1014660
Change-Id: I5ea1e7fbb486d49303fbfdf0db995c1792374f4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1882322
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710338}
parent 938dc44b
...@@ -1346,16 +1346,10 @@ Handoff must also be enabled in the General section of Settings, and your device ...@@ -1346,16 +1346,10 @@ Handoff must also be enabled in the General section of Settings, and your device
Save Passwords Save Passwords
</message> </message>
<message name="IDS_IOS_LEAK_CHECK_SWITCH" desc="Title for the switch toggling whether Chrome should check that entered credentials have been part of a leak."> <message name="IDS_IOS_LEAK_CHECK_SWITCH" desc="Title for the switch toggling whether Chrome should check that entered credentials have been part of a leak.">
Check password safety Warn you if passwords are compromised
</message>
<message name="IDS_IOS_LEAK_CHECK_SIGNED_IN_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-in users.">
Warns you if a password you use was part of a data breach.
</message>
<message name="IDS_IOS_LEAK_CHECK_SIGNED_OUT_DISABLED_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-out users who have disabled the feature.">
Google can check if your passwords were part of a data breach.
</message> </message>
<message name="IDS_IOS_LEAK_CHECK_SIGNED_OUT_ENABLED_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-out users who have not disabled the feature."> <message name="IDS_IOS_LEAK_CHECK_SIGNED_OUT_ENABLED_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-out users who have not disabled the feature.">
Google can check if your passwords were part of a data breach. This will be turned on when you sign in with your Google Account. When you sign in to your Google Account, this feature is turned on.
</message> </message>
<message name="IDS_IOS_PASSWORDS" desc="Title for the view in Settings for managing saved passwords. [Length: 15em] [iOS only]"> <message name="IDS_IOS_PASSWORDS" desc="Title for the view in Settings for managing saved passwords. [Length: 15em] [iOS only]">
Passwords Passwords
......
...@@ -471,7 +471,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -471,7 +471,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
SettingsSwitchItem* leakCheckItem = SettingsSwitchItem* leakCheckItem =
[[SettingsSwitchItem alloc] initWithType:ItemTypePasswordLeakCheckSwitch]; [[SettingsSwitchItem alloc] initWithType:ItemTypePasswordLeakCheckSwitch];
leakCheckItem.text = l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SWITCH); leakCheckItem.text = l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SWITCH);
leakCheckItem.on = [passwordLeakCheckEnabled_ value]; leakCheckItem.on = [self leakCheckItemOnState];
leakCheckItem.accessibilityIdentifier = @"leakCheckItem_switch"; leakCheckItem.accessibilityIdentifier = @"leakCheckItem_switch";
AuthenticationService* authService = AuthenticationService* authService =
...@@ -533,7 +533,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -533,7 +533,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
DCHECK(base::FeatureList::IsEnabled( DCHECK(base::FeatureList::IsEnabled(
password_manager::features::kLeakDetection)); password_manager::features::kLeakDetection));
// Update the item. // Update the item.
leakCheckItem_.on = [passwordLeakCheckEnabled_ value]; leakCheckItem_.on = [self leakCheckItemOnState];
// Update the cell if it's not removed by presenting search controller. // Update the cell if it's not removed by presenting search controller.
if ([self.tableViewModel if ([self.tableViewModel
...@@ -562,7 +562,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -562,7 +562,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
[passwordLeakCheckEnabled_ setValue:switchView.on]; [passwordLeakCheckEnabled_ setValue:switchView.on];
// Update the item. // Update the item.
leakCheckItem_.on = [passwordLeakCheckEnabled_ value]; leakCheckItem_.on = [self leakCheckItemOnState];
[self updateDetailTextLeakCheckItem]; [self updateDetailTextLeakCheckItem];
[self reconfigureCellsForItems:@[ leakCheckItem_ ]]; [self reconfigureCellsForItems:@[ leakCheckItem_ ]];
} }
...@@ -1259,9 +1259,17 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -1259,9 +1259,17 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
[self reconfigureCellsForItems:@[ savePasswordsItem_ ]]; [self reconfigureCellsForItems:@[ savePasswordsItem_ ]];
} }
// Returns a boolean indicating if the switch should appear as "On" or "Off"
// based on the sync preference and the sign in status.
- (BOOL)leakCheckItemOnState {
AuthenticationService* authService =
AuthenticationServiceFactory::GetForBrowserState(browserState_);
return [passwordLeakCheckEnabled_ value] && authService->IsAuthenticated();
}
// Sets the leak check switch item's enabled status to |enabled| and // Sets the leak check switch item's enabled status to |enabled| and
// reconfigures the corresponding cell. If the user is not sign in, |enabled| is // reconfigures the corresponding cell. If the user is not signed in, |enabled|
// overriden with |NO|. // is overriden with |NO|.
- (void)setLeakCheckSwitchItemEnabled:(BOOL)enabled { - (void)setLeakCheckSwitchItemEnabled:(BOOL)enabled {
if (!base::FeatureList::IsEnabled(password_manager::features::kLeakDetection)) if (!base::FeatureList::IsEnabled(password_manager::features::kLeakDetection))
return; return;
...@@ -1293,18 +1301,16 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -1293,18 +1301,16 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
// When editing keep the current detail text. // When editing keep the current detail text.
return; return;
} }
if (leakCheckItem_.enabled) { AuthenticationService* authService =
leakCheckItem_.detailText = AuthenticationServiceFactory::GetForBrowserState(browserState_);
l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_IN_DESC); if (!authService->IsAuthenticated() && [passwordLeakCheckEnabled_ value]) {
return; // If the user is signed out and the sync preference is enabled, this
} // informs that it will be turned on on sign in.
if (leakCheckItem_.on) {
leakCheckItem_.detailText = leakCheckItem_.detailText =
l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_OUT_ENABLED_DESC); l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_OUT_ENABLED_DESC);
return; return;
} }
leakCheckItem_.detailText = leakCheckItem_.detailText = nil;
l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_OUT_DISABLED_DESC);
} }
#pragma mark - Testing #pragma mark - Testing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment