Commit 55aed832 authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[iOS][Password Check] Hiding Password Check Section during Search

This change hides Password Check section during search.

Bug: 1075494
Change-Id: I5f0ce561bcb5d3282c1e477298cfecbce9224580
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339747Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Cr-Commit-Position: refs/heads/master@{#797233}
parent 254a0876
...@@ -716,12 +716,18 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -716,12 +716,18 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
- (void)setPasswordCheckUIState:(PasswordCheckUIState)state { - (void)setPasswordCheckUIState:(PasswordCheckUIState)state {
_passwordCheckState = state; _passwordCheckState = state;
if (_checkForProblemsItem) { [self updatePasswordCheckButtonWithState:state];
[self updatePasswordCheckButtonWithState:state]; [self updatePasswordCheckStatusLabelWithState:state];
[self reconfigureCellsForItems:@[ _checkForProblemsItem ]];
// During searching Password Check section is hidden so cells should not be
// reconfigured.
if (self.navigationItem.searchController.active) {
return;
} }
if (_checkForProblemsItem)
[self reconfigureCellsForItems:@[ _checkForProblemsItem ]];
if (_passwordProblemsItem) { if (_passwordProblemsItem) {
[self updatePasswordCheckStatusLabelWithState:state];
[self reconfigureCellsForItems:@[ _passwordProblemsItem ]]; [self reconfigureCellsForItems:@[ _passwordProblemsItem ]];
} }
} }
...@@ -800,9 +806,15 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -800,9 +806,15 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
- (void)willPresentSearchController:(UISearchController*)searchController { - (void)willPresentSearchController:(UISearchController*)searchController {
[self showScrim]; [self showScrim];
// Remove save passwords switch section. // Remove save passwords switch section and password check section.
[self [self
performBatchTableViewUpdates:^{ performBatchTableViewUpdates:^{
if (base::FeatureList::IsEnabled(
password_manager::features::kPasswordCheck)) {
[self clearSectionWithIdentifier:SectionIdentifierPasswordCheck
withRowAnimation:UITableViewRowAnimationTop];
}
[self clearSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch [self clearSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch
withRowAnimation:UITableViewRowAnimationTop]; withRowAnimation:UITableViewRowAnimationTop];
} }
...@@ -829,11 +841,34 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -829,11 +841,34 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
[model addItem:_managedSavePasswordItem [model addItem:_managedSavePasswordItem
toSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch]; toSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch];
} }
NSInteger switchSection = [model
sectionForSectionIdentifier:SectionIdentifierSavePasswordsSwitch];
NSMutableArray<NSIndexPath*>* rowsIndexPaths = [NSMutableArray
arrayWithObjects:[NSIndexPath indexPathForRow:0
inSection:switchSection],
nil];
if (base::FeatureList::IsEnabled(
password_manager::features::kPasswordCheck)) {
[model insertSectionWithIdentifier:SectionIdentifierPasswordCheck
atIndex:1];
NSInteger checkSection = [model
sectionForSectionIdentifier:SectionIdentifierPasswordCheck];
[self.tableView insertSections:[NSIndexSet indexSetWithIndex:1]
withRowAnimation:UITableViewRowAnimationTop];
[model addItem:_passwordProblemsItem
toSectionWithIdentifier:SectionIdentifierPasswordCheck];
[model addItem:_checkForProblemsItem
toSectionWithIdentifier:SectionIdentifierPasswordCheck];
[rowsIndexPaths addObject:[NSIndexPath indexPathForRow:0
inSection:checkSection]];
[rowsIndexPaths addObject:[NSIndexPath indexPathForRow:1
inSection:checkSection]];
}
[self.tableView [self.tableView insertRowsAtIndexPaths:rowsIndexPaths
insertRowsAtIndexPaths:@[ [NSIndexPath indexPathForRow:0 withRowAnimation:UITableViewRowAnimationTop];
inSection:0] ]
withRowAnimation:UITableViewRowAnimationTop];
} }
completion:nil]; completion:nil];
} }
......
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