Skip to content

Commit

Permalink
[ios] Creates flag to remove Feed from NTP.
Browse files Browse the repository at this point in the history
Removes the Feed, its header and the Settings toggle if the flag
is enabled.

Bug= 1326937

(cherry picked from commit 5855871)

Change-Id: If0fecb227c37b8e557c3c79cb46078f7e54f92e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3653098
Reviewed-by: Adam Arcaro <adamta@google.com>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1004821}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655926
Cr-Commit-Position: refs/branch-heads/5060@{#146}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Sergio Collazos authored and Chromium LUCI CQ committed May 20, 2022
1 parent 7c7ba4e commit d664551
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 8 deletions.
5 changes: 5 additions & 0 deletions chrome/browser/flag-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,11 @@
"owners": [ "veronguyen", "gambard" ],
"expiry_milestone": 105
},
{
"name": "enable-feed-ablation",
"owners": [ "adamta", "sczs" ],
"expiry_milestone": 106
},
{
"name": "enable-fenced-frames",
"owners": [ "dom", "shivanisha", "chrome-fenced-frames@google.com" ],
Expand Down
3 changes: 3 additions & 0 deletions ios/chrome/browser/flags/about_flags.mm
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@
flag_descriptions::kAutofillEnableRankingFormulaDescription,
flags_ui::kOsIos,
FEATURE_VALUE_TYPE(autofill::features::kAutofillEnableRankingFormula)},
{"enable-feed-ablation", flag_descriptions::kEnableFeedAblationName,
flag_descriptions::kEnableFeedAblationDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kEnableFeedAblation)},
};

bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) {
Expand Down
4 changes: 4 additions & 0 deletions ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ const char kEnableFaviconForPasswordsDescription[] =
"and Never Saved sections and also for the AutoFill Passwords for the "
"Credential Provider.";

const char kEnableFeedAblationName[] = "Enables Feed Ablation";
const char kEnableFeedAblationDescription[] =
"If Enabled the Feed will be removed from the NTP";

const char kEnableFREUIModuleIOSName[] = "Enable FRE UI module";
const char kEnableFREUIModuleIOSDescription[] =
"Use the new FRE UI module for first run.";
Expand Down
4 changes: 4 additions & 0 deletions ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ extern const char kEnableDiscoverFeedStaticResourceServingDescription[];
extern const char kEnableFaviconForPasswordsName[];
extern const char kEnableFaviconForPasswordsDescription[];

// Title and description for the flag to remove the Feed from the NTP.
extern const char kEnableFeedAblationName[];
extern const char kEnableFeedAblationDescription[];

// Title and description for the flag to test the FRE default browser promo
// experiment.
extern const char kEnableFREDefaultBrowserScreenTestingName[];
Expand Down
6 changes: 4 additions & 2 deletions ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ - (void)handleSortTypeForFollowingFeed:(FollowingFeedSortType)sortType {
}

- (BOOL)shouldFeedBeVisible {
return [self isFeedHeaderVisible] && [self.feedExpandedPref value];
return [self isFeedHeaderVisible] && [self.feedExpandedPref value] &&
!IsFeedAblationEnabled();
}

#pragma mark - FeedMenuCommands
Expand Down Expand Up @@ -1040,7 +1041,8 @@ - (ContentSuggestionsHeaderViewController*)headerController {
// menu, or by an enterprise policy.
- (BOOL)isFeedHeaderVisible {
return self.prefService->GetBoolean(prefs::kArticlesForYouEnabled) &&
self.prefService->GetBoolean(prefs::kNTPContentSuggestionsEnabled);
self.prefService->GetBoolean(prefs::kNTPContentSuggestionsEnabled) &&
!IsFeedAblationEnabled();
}

// Returns |YES| if the feed is currently visible on the NTP.
Expand Down
6 changes: 6 additions & 0 deletions ios/chrome/browser/ui/ntp/new_tab_page_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ extern const char kDiscoverFeedSRSPreloadTemplatesEnabled[];
// TODO(crbug.com/1262536): Remove this when it is fixed.
extern const base::Feature kNTPViewHierarchyRepair;

// Feature flag to remove the Feed from the NTP.
extern const base::Feature kEnableFeedAblation;

// Whether the Discover feed content preview is shown in the context menu.
bool IsDiscoverFeedPreviewEnabled();

Expand All @@ -48,4 +51,7 @@ bool IsDiscoverFeedShorterCacheEnabled();
// Whether the NTP view hierarchy repair is enabled.
bool IsNTPViewHierarchyRepairEnabled();

// Whether the Discover feed ablation experiment is enabled.
bool IsFeedAblationEnabled();

#endif // IOS_CHROME_BROWSER_UI_NTP_NEW_TAB_PAGE_FEATURE_H_
7 changes: 7 additions & 0 deletions ios/chrome/browser/ui/ntp/new_tab_page_feature.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
const base::Feature kNTPViewHierarchyRepair{"NTPViewHierarchyRepair",
base::FEATURE_ENABLED_BY_DEFAULT};

const base::Feature kEnableFeedAblation{"FeedAblationEnabled",
base::FEATURE_DISABLED_BY_DEFAULT};

bool IsDiscoverFeedPreviewEnabled() {
return base::FeatureList::IsEnabled(kEnableDiscoverFeedPreview);
}
Expand All @@ -50,3 +53,7 @@ bool IsDiscoverFeedShorterCacheEnabled() {
bool IsNTPViewHierarchyRepairEnabled() {
return base::FeatureList::IsEnabled(kNTPViewHierarchyRepair);
}

bool IsFeedAblationEnabled() {
return base::FeatureList::IsEnabled(kEnableFeedAblation);
}
16 changes: 10 additions & 6 deletions ios/chrome/browser/ui/settings/settings_table_view_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#import "ios/chrome/browser/ui/authentication/signin_presenter.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h"
#import "ios/chrome/browser/ui/ntp/new_tab_page_feature.h"
#import "ios/chrome/browser/ui/settings/about_chrome_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h"
Expand Down Expand Up @@ -468,13 +469,16 @@ - (void)loadModel {
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];
[model addItem:[self privacyDetailItem]
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];
if ([_contentSuggestionPolicyEnabled value]) {
[model addItem:self.articlesForYouItem
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];

} else {
[model addItem:self.managedArticlesForYouItem
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];
if (!IsFeedAblationEnabled()) {
if ([_contentSuggestionPolicyEnabled value]) {
[model addItem:self.articlesForYouItem
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];

} else {
[model addItem:self.managedArticlesForYouItem
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];
}
}
[model addItem:[self languageSettingsDetailItem]
toSectionWithIdentifier:SettingsSectionIdentifierAdvanced];
Expand Down

0 comments on commit d664551

Please sign in to comment.