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

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

Issue 2609173002: Reload the ReadingListCollection only if changes occurred (Closed)
Patch Set: Address comment Created 3 years, 11 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_item.mm
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.mm b/ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.mm
index c90b5e365f205f79d71d220f15986a6847005032..8c5a1a31998e105062be3a96d226defdda6a786a 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.mm
@@ -47,7 +47,6 @@ const CGFloat kDistillationIndicatorSize = 18;
@interface ReadingListCollectionViewItem ()<ReadingListCellDelegate> {
GURL _url;
- ReadingListEntry::DistillationState _distillationState;
}
// Attributes provider used to retrieve favicons.
@property(nonatomic, strong)
@@ -66,6 +65,7 @@ const CGFloat kDistillationIndicatorSize = 18;
@synthesize detailText = _detailText;
@synthesize url = _url;
@synthesize displayedCell = _displayedCell;
+@synthesize distillationState = _distillationState;
- (instancetype)initWithType:(NSInteger)type
attributesProvider:(FaviconAttributesProvider*)provider
@@ -96,6 +96,14 @@ const CGFloat kDistillationIndicatorSize = 18;
return self;
}
+#pragma mark - property
+
+- (void)setDistillationState:
+ (ReadingListEntry::DistillationState)distillationState {
+ self.displayedCell.distillationState = distillationState;
+ _distillationState = distillationState;
+}
+
#pragma mark - CollectionViewTextItem
- (void)configureCell:(ReadingListCell*)cell {
@@ -128,6 +136,18 @@ const CGFloat kDistillationIndicatorSize = 18;
self.text, self.detailText];
}
+- (BOOL)isEqual:(id)other {
+ if (other == self)
+ return YES;
+ if (!other || ![other isKindOfClass:[self class]])
+ return NO;
+ ReadingListCollectionViewItem* otherItem =
+ static_cast<ReadingListCollectionViewItem*>(other);
+ return [self.text isEqualToString:otherItem.text] &&
+ [self.detailText isEqualToString:otherItem.detailText] &&
+ self.distillationState == otherItem.distillationState;
+}
+
@end
#pragma mark - ReadingListCell
@@ -220,7 +240,7 @@ const CGFloat kDistillationIndicatorSize = 18;
}
}
-#pragma mark UICollectionViewCell
+#pragma mark - UICollectionViewCell
- (void)prepareForReuse {
[self.delegate readingListCellWillPrepareForReload:self];

Powered by Google App Engine
This is Rietveld 408576698