Index: ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm |
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm b/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm |
index de07e31b2df7fc4a9e925ef2232165e178884042..07473acb23fbead6c96f3f3af06b9874517f93d2 100644 |
--- a/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm |
+++ b/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm |
@@ -124,6 +124,8 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>; |
// Returns whether there are elements in the section identified by |
// |sectionIdentifier|. |
- (BOOL)hasItemInSection:(SectionIdentifier)sectionIdentifier; |
+// Adds an empty background if needed. |
+- (void)collectionIsEmpty; |
// Updates the toolbar state according to the selected items. |
- (void)updateToolbarState; |
// Displays an action sheet to let the user choose to mark all the elements as |
@@ -486,10 +488,9 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>; |
[super loadModel]; |
if (self.readingListModel->size() == 0) { |
- // The collection is empty, add background. |
- self.collectionView.backgroundView = _emptyCollectionBackground; |
- [self.audience setCollectionHasItems:NO]; |
+ [self collectionIsEmpty]; |
} else { |
+ self.collectionView.alwaysBounceVertical = YES; |
[self loadItems]; |
self.collectionView.backgroundView = nil; |
[self.audience setCollectionHasItems:YES]; |
@@ -622,6 +623,16 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>; |
return numberOfItems > 0; |
} |
+- (void)collectionIsEmpty { |
+ if (self.collectionView.backgroundView) { |
+ return; |
+ } |
+ // The collection is empty, add background. |
+ self.collectionView.alwaysBounceVertical = NO; |
+ self.collectionView.backgroundView = _emptyCollectionBackground; |
+ [self.audience setCollectionHasItems:NO]; |
+} |
+ |
#pragma mark - ReadingListToolbarDelegate |
- (void)markPressed { |
@@ -1083,6 +1094,9 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>; |
} |
} |
completion:nil]; |
+ if (_readingListModel->size() == 0) { |
+ [self collectionIsEmpty]; |
+ } |
} |
- (void)exitEditingModeAnimated:(BOOL)animated { |