Commit dee7c127 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Don't store SectionInfo int NTP "More" button

This CL makes sure that the SectionInfo variable isn't store in the
"more" callback on the NTP. This is because the SectionInfo can be
recreated for example when disabling/enabling the content suggestions.

Bug: 1023793, 1024172
Change-Id: I8edb799baedb3d1dd811a57db77d07298d97533e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1913257Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715251}
parent 67d614f4
...@@ -583,18 +583,24 @@ addSuggestionsToModel:(NSArray<CSCollectionViewItem*>*)suggestions ...@@ -583,18 +583,24 @@ addSuggestionsToModel:(NSArray<CSCollectionViewItem*>*)suggestions
- (void)addFooterIfNeeded:(ContentSuggestionsSectionInformation*)sectionInfo { - (void)addFooterIfNeeded:(ContentSuggestionsSectionInformation*)sectionInfo {
NSInteger sectionIdentifier = SectionIdentifierForInfo(sectionInfo); NSInteger sectionIdentifier = SectionIdentifierForInfo(sectionInfo);
NSString* footerTitle = sectionInfo.footerTitle;
__weak ContentSuggestionsCollectionUpdater* weakSelf = self; __weak ContentSuggestionsCollectionUpdater* weakSelf = self;
if (sectionInfo.footerTitle && if (footerTitle && ![self.collectionViewController.collectionViewModel
![self.collectionViewController.collectionViewModel footerForSectionWithIdentifier:sectionIdentifier]) {
footerForSectionWithIdentifier:sectionIdentifier]) {
ContentSuggestionsFooterItem* footer = [[ContentSuggestionsFooterItem alloc] ContentSuggestionsFooterItem* footer = [[ContentSuggestionsFooterItem alloc]
initWithType:ItemTypeFooter initWithType:ItemTypeFooter
title:sectionInfo.footerTitle title:sectionInfo.footerTitle
callback:^(ContentSuggestionsFooterItem* item, callback:^(ContentSuggestionsFooterItem* item,
ContentSuggestionsFooterCell* cell) { ContentSuggestionsFooterCell* cell) {
[weakSelf runAdditionalActionForSection:sectionInfo __typeof(self) strongSelf = weakSelf;
withItem:item ContentSuggestionsSectionInformation* strongSectionInfo =
cell:cell]; strongSelf
.sectionInfoBySectionIdentifier[@(sectionIdentifier)];
DCHECK([footerTitle isEqual:strongSectionInfo.footerTitle]);
[strongSelf runAdditionalActionForSection:strongSectionInfo
withItem:item
cell:cell];
}]; }];
[self.collectionViewController.collectionViewModel [self.collectionViewController.collectionViewModel
......
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