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
Save Passwords
</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.">
Check password safety
</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.
Warn you if passwords are compromised
</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.">
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 name="IDS_IOS_PASSWORDS" desc="Title for the view in Settings for managing saved passwords. [Length: 15em] [iOS only]">
Passwords
......
......@@ -471,7 +471,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
SettingsSwitchItem* leakCheckItem =
[[SettingsSwitchItem alloc] initWithType:ItemTypePasswordLeakCheckSwitch];
leakCheckItem.text = l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SWITCH);
leakCheckItem.on = [passwordLeakCheckEnabled_ value];
leakCheckItem.on = [self leakCheckItemOnState];
leakCheckItem.accessibilityIdentifier = @"leakCheckItem_switch";
AuthenticationService* authService =
......@@ -533,7 +533,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
DCHECK(base::FeatureList::IsEnabled(
password_manager::features::kLeakDetection));
// Update the item.
leakCheckItem_.on = [passwordLeakCheckEnabled_ value];
leakCheckItem_.on = [self leakCheckItemOnState];
// Update the cell if it's not removed by presenting search controller.
if ([self.tableViewModel
......@@ -562,7 +562,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
[passwordLeakCheckEnabled_ setValue:switchView.on];
// Update the item.
leakCheckItem_.on = [passwordLeakCheckEnabled_ value];
leakCheckItem_.on = [self leakCheckItemOnState];
[self updateDetailTextLeakCheckItem];
[self reconfigureCellsForItems:@[ leakCheckItem_ ]];
}
......@@ -1259,9 +1259,17 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
[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
// reconfigures the corresponding cell. If the user is not sign in, |enabled| is
// overriden with |NO|.
// reconfigures the corresponding cell. If the user is not signed in, |enabled|
// is overriden with |NO|.
- (void)setLeakCheckSwitchItemEnabled:(BOOL)enabled {
if (!base::FeatureList::IsEnabled(password_manager::features::kLeakDetection))
return;
......@@ -1293,18 +1301,16 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
// When editing keep the current detail text.
return;
}
if (leakCheckItem_.enabled) {
leakCheckItem_.detailText =
l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_IN_DESC);
return;
}
if (leakCheckItem_.on) {
AuthenticationService* authService =
AuthenticationServiceFactory::GetForBrowserState(browserState_);
if (!authService->IsAuthenticated() && [passwordLeakCheckEnabled_ value]) {
// If the user is signed out and the sync preference is enabled, this
// informs that it will be turned on on sign in.
leakCheckItem_.detailText =
l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_OUT_ENABLED_DESC);
return;
}
leakCheckItem_.detailText =
l10n_util::GetNSString(IDS_IOS_LEAK_CHECK_SIGNED_OUT_DISABLED_DESC);
leakCheckItem_.detailText = nil;
}
#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