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

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

Issue 2607523002: Reading List: Open distilled article first if no network. (Closed)
Patch Set: add guards Created 4 years 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
« no previous file with comments | « components/reading_list/ios/reading_list_model_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/reading_list/reading_list_side_swipe_provider.mm
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_side_swipe_provider.mm b/ios/chrome/browser/ui/reading_list/reading_list_side_swipe_provider.mm
index 7000f2a38125580f869ad22f99a57abef95fd6f5..a3b42901a6acae94dc0a5e42252fd66342b10c2e 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_side_swipe_provider.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_side_swipe_provider.mm
@@ -8,6 +8,7 @@
#include "components/reading_list/ios/reading_list_entry.h"
#include "components/reading_list/ios/reading_list_model.h"
#include "ios/web/public/web_state/web_state.h"
+#include "net/base/network_change_notifier.h"
#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
@@ -55,16 +56,8 @@ class ReadingListObserverBridge;
if (!webState || _readingListModel->unread_size() == 0) {
return;
}
- int64_t updateTime = 0;
- const ReadingListEntry* firstEntry = nullptr;
- for (const auto& url : _readingListModel->Keys()) {
- const ReadingListEntry* entry = _readingListModel->GetEntryByURL(url);
- if (!entry->IsRead() && entry->UpdateTime() > updateTime) {
- updateTime = entry->UpdateTime();
- firstEntry = entry;
- }
- }
- DCHECK_GT(updateTime, 0);
+ const ReadingListEntry* firstEntry = _readingListModel->GetFirstUnreadEntry(
+ net::NetworkChangeNotifier::IsOffline());
DCHECK(firstEntry);
web::NavigationManager::WebLoadParams params(firstEntry->URL());
params.transition_type = ui::PageTransition::PAGE_TRANSITION_AUTO_BOOKMARK;
« no previous file with comments | « components/reading_list/ios/reading_list_model_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698