Commit 5aa43ad5 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Removing -[ApplicationSettingsCommands showSyncSettingsFromViewController:]

This patch removes dead code in MainController, ApplicationSettingsCommands and
SettingsNavigationController, related to unified consent flag. This flag is now
always true.

Bug: 951313
Change-Id: I5a695d0b6c59ba24f1230b8f41b75a491ce6f226
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784597
Auto-Submit: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693166}
parent 9cd87534
......@@ -173,7 +173,6 @@ source_set("app_internal") {
"//components/suggestions",
"//components/sync",
"//components/ukm/ios:features",
"//components/unified_consent",
"//components/url_formatter",
"//components/web_resource",
"//ios/chrome/app/application_delegate",
......
......@@ -39,7 +39,6 @@
#include "components/search_engines/template_url_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/ukm/ios/features.h"
#include "components/unified_consent/feature.h"
#include "components/url_formatter/url_formatter.h"
#include "components/web_resource/web_resource_pref_names.h"
#import "ios/chrome/app/application_delegate/app_state.h"
......@@ -1638,7 +1637,6 @@ enum class EnterTabSwitcherSnapshotResult {
- (void)showAdvancedSigninSettingsFromViewController:
(UIViewController*)baseViewController {
DCHECK(unified_consent::IsUnifiedConsentFeatureEnabled());
self.signinInteractionCoordinator = [[SigninInteractionCoordinator alloc]
initWithBrowserState:_mainBrowserState
dispatcher:self.mainBVC.dispatcher];
......@@ -1723,26 +1721,6 @@ enum class EnterTabSwitcherSnapshotResult {
completion:nil];
}
// TODO(crbug.com/779791) : Remove show settings commands from MainController.
- (void)showSyncSettingsFromViewController:
(UIViewController*)baseViewController {
// When unified consent feather is enabled,
// |showGoogleServicesSettingsFromViewController:| should be called.
DCHECK(!unified_consent::IsUnifiedConsentFeatureEnabled());
DCHECK(!self.signinInteractionCoordinator.isSettingsViewPresented);
if (_settingsNavigationController) {
[_settingsNavigationController
showSyncSettingsFromViewController:baseViewController];
return;
}
_settingsNavigationController =
[SettingsNavigationController newSyncController:_mainBrowserState
delegate:self];
[baseViewController presentViewController:_settingsNavigationController
animated:YES
completion:nil];
}
// TODO(crbug.com/779791) : Remove show settings commands from MainController.
- (void)showSyncPassphraseSettingsFromViewController:
(UIViewController*)baseViewController {
......
......@@ -272,7 +272,6 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10;
fromEmail:lastSignedInEmail
toEmail:[identity userEmail]
isSignedIn:isSignedIn];
[_navigationController setShouldCommitSyncChangesOnDismissal:NO];
[[_delegate presentingViewController]
presentViewController:_navigationController
animated:YES
......
......@@ -34,7 +34,6 @@ source_set("browser_view") {
"//components/signin/ios/browser:active_state_manager",
"//components/strings",
"//components/translate/core/browser",
"//components/unified_consent",
"//components/url_formatter",
"//ios/chrome/app:tests_hook",
"//ios/chrome/app/strings",
......
......@@ -28,7 +28,6 @@
#import "components/signin/ios/browser/manage_accounts_delegate.h"
#include "components/strings/grit/components_strings.h"
#include "components/translate/core/browser/translate_manager.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/app/tests_hook.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
......@@ -4964,11 +4963,7 @@ NSString* const kBrowserViewControllerSnackbarCategory =
}
- (void)showSyncSettings {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
} else {
[self.dispatcher showSyncSettingsFromViewController:self];
}
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
}
- (void)showSyncPassphraseSettings {
......
......@@ -26,11 +26,6 @@
- (void)showGoogleServicesSettingsFromViewController:
(UIViewController*)baseViewController;
// TODO(crbug.com/779791) : Do not pass baseViewController through dispatcher.
// Shows the sync settings UI, presenting from |baseViewController|.
- (void)showSyncSettingsFromViewController:
(UIViewController*)baseViewController;
// TODO(crbug.com/779791) : Do not pass baseViewController through dispatcher.
// Shows the sync encryption passphrase UI, presenting from
// |baseViewController|.
......
......@@ -1154,11 +1154,7 @@ const int kRecentlyClosedTabsSectionIndex = 0;
}
- (void)showSyncSettings {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
} else {
[self.dispatcher showSyncSettingsFromViewController:self];
}
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
}
- (void)showSyncPassphraseSettings {
......
......@@ -49,10 +49,6 @@ extern NSString* const kSettingsDoneButtonId;
@interface SettingsNavigationController
: UINavigationController<ApplicationSettingsCommands>
// Whether sync changes should be committed when the settings are being
// dismissed. Defaults to YES.
@property(nonatomic, assign) BOOL shouldCommitSyncChangesOnDismissal;
// Creates a new SettingsTableViewController and the chrome around it.
// |browserState| is used to personalize some settings aspects and should not be
// nil nor Off-the-Record. |delegate| may be nil.
......@@ -77,13 +73,6 @@ newAccountsController:(ios::ChromeBrowserState*)browserState
delegate:
(id<SettingsNavigationControllerDelegate>)delegate;
// Creates a new SyncSettingsCollectionViewController and the chrome around
// it. |browserState| is used to personalize some settings aspects and should
// not be nil. |delegate| may be nil.
+ (SettingsNavigationController*)
newSyncController:(ios::ChromeBrowserState*)browserState
delegate:(id<SettingsNavigationControllerDelegate>)delegate;
// Creates a new SyncEncryptionPassphraseCollectionViewController and the chrome
// around it. |browserState| is used to personalize some settings aspects and
// should not be nil. |delegate| may be nil.
......
......@@ -6,7 +6,6 @@
#include "base/mac/foundation_util.h"
#include "components/strings/grit/components_strings.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/sync/sync_setup_service.h"
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
......@@ -23,7 +22,6 @@
#import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/sync/sync_settings_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/utils/settings_utils.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
......@@ -54,11 +52,6 @@ NSString* const kSettingsDoneButtonId = @"kSettingsDoneButtonId";
__weak id<SettingsNavigationControllerDelegate> delegate_;
}
@synthesize googleServicesSettingsCoordinator =
_googleServicesSettingsCoordinator;
@synthesize shouldCommitSyncChangesOnDismissal =
shouldCommitSyncChangesOnDismissal_;
#pragma mark - SettingsNavigationController methods.
+ (SettingsNavigationController*)
......@@ -109,21 +102,6 @@ newAccountsController:(ios::ChromeBrowserState*)browserState
return nc;
}
+ (SettingsNavigationController*)
newSyncController:(ios::ChromeBrowserState*)browserState
delegate:(id<SettingsNavigationControllerDelegate>)delegate {
SyncSettingsTableViewController* controller =
[[SyncSettingsTableViewController alloc] initWithBrowserState:browserState
allowSwitchSyncAccount:YES];
controller.dispatcher = [delegate dispatcherForSettings];
SettingsNavigationController* nc = [[SettingsNavigationController alloc]
initWithRootViewController:controller
browserState:browserState
delegate:delegate];
[controller navigationItem].rightBarButtonItem = [nc doneButton];
return nc;
}
+ (SettingsNavigationController*)
newUserFeedbackController:(ios::ChromeBrowserState*)browserState
delegate:(id<SettingsNavigationControllerDelegate>)delegate
......@@ -258,12 +236,6 @@ initWithRootViewController:(UIViewController*)rootViewController
if (self) {
mainBrowserState_ = browserState;
delegate_ = delegate;
// When Unified Consent is enabled, |self.googleServicesSettingsCoordinator|
// is responsible to commit the sync changes. Thus sync changes only need to
// be explicitly committed by this navigation controller when Unified
// Consent is disabled.
shouldCommitSyncChangesOnDismissal_ =
!unified_consent::IsUnifiedConsentFeatureEnabled();
[self setModalPresentationStyle:UIModalPresentationFormSheet];
[self setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
// TODO(crbug.com/980037) Remove this and properly handle swipe to dismiss
......@@ -303,13 +275,6 @@ initWithRootViewController:(UIViewController*)rootViewController
}
}
// Sync changes cannot be cancelled and they must always be committed when
// existing settings.
if (shouldCommitSyncChangesOnDismissal_) {
SyncSetupServiceFactory::GetForBrowserState([self mainBrowserState])
->PreUnityCommitChanges();
}
// GoogleServicesSettingsCoordinator must be stopped before dismissing the
// sync settings view.
[self stopGoogleServicesSettingsCoordinator];
......@@ -443,17 +408,6 @@ initWithRootViewController:(UIViewController*)rootViewController
[self showGoogleServices];
}
// TODO(crbug.com/779791) : Do not pass |baseViewController| through dispatcher.
- (void)showSyncSettingsFromViewController:
(UIViewController*)baseViewController {
SyncSettingsTableViewController* controller =
[[SyncSettingsTableViewController alloc]
initWithBrowserState:mainBrowserState_
allowSwitchSyncAccount:YES];
controller.dispatcher = [delegate_ dispatcherForSettings];
[self pushViewController:controller animated:YES];
}
// TODO(crbug.com/779791) : Do not pass |baseViewController| through dispatcher.
- (void)showSyncPassphraseSettingsFromViewController:
(UIViewController*)baseViewController {
......
......@@ -619,11 +619,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
ACCESS_POINT_UNKNOWN]
baseViewController:self];
} else if (ShouldShowSyncSettings(syncState)) {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
} else {
[self.dispatcher showSyncSettingsFromViewController:self];
}
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
} else if (ShouldShowSyncPassphraseSettings(syncState)) {
[self.dispatcher showSyncPassphraseSettingsFromViewController:self];
}
......
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