Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller.mm

Issue 2779893003: Removes the displayed cell in the ReadingList item (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller.mm
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller.mm b/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller.mm
index 3d244f4a290b11dd36c653084877baa9ef66b724..856dc459efaa41ef3e4ca41a25d3793de0a04bbb 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller.mm
@@ -582,6 +582,9 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
if ([items count] != map.size())
return YES;
+ NSMutableArray<ReadingListCollectionViewItem*>* itemsToReconfigure =
+ [NSMutableArray array];
+
NSInteger index = 0;
ItemsMapByDate::const_reverse_iterator iterator = map.rbegin();
for (; iterator != map.rend(); iterator++) {
@@ -589,8 +592,12 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
base::mac::ObjCCastStrict<ReadingListCollectionViewItem>(items[index]);
ReadingListCollectionViewItem* newItem = iterator->second;
Olivier 2017/03/28 08:52:07 If an item is inserted (and index is not synchroni
gambard 2017/03/28 09:43:14 Yes. It is hard to find a good heuristic to calcul
if (oldItem.url == newItem.url) {
- oldItem.text = newItem.text;
- oldItem.distillationState = newItem.distillationState;
+ if (![oldItem isEqual:newItem]) {
+ oldItem.text = newItem.text;
+ oldItem.detailText = newItem.detailText;
+ oldItem.distillationState = newItem.distillationState;
+ [itemsToReconfigure addObject:oldItem];
+ }
if (oldItem.faviconPageURL != newItem.faviconPageURL) {
[self setItem:oldItem faviconURL:newItem.faviconPageURL];
}
@@ -600,6 +607,8 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
}
index++;
}
+ [self reconfigureCellsForItems:itemsToReconfigure
+ inSectionWithIdentifier:sectionIdentifier];
return NO;
}

Powered by Google App Engine
This is Rietveld 408576698