Fjalapeno has uploaded a new change for review.
https://gerrit.wikimedia.org/r/184970
Change subject: Reset scroll position when searching bug T70230 Only used
cached article when navigating back/forward Forcing the web view to reload a
searched article without deleting the cache (per Brions code review comment).
Add property to track if navigation was du
......................................................................
Reset scroll position when searching bug T70230
Only used cached article when navigating back/forward
Forcing the web view to reload a searched article without deleting the cache
(per Brions code review comment).
Add property to track if navigation was due to back/forward. Use this to
determine whether to return to the previous scroll position.
Change-Id: I51372ac4657470428b245049cc5f259e05f11e6e
---
M wikipedia/View Controllers/WebView/WebViewController.m
1 file changed, 13 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia
refs/changes/70/184970/1
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m
b/wikipedia/View Controllers/WebView/WebViewController.m
index 0b3b6d9..e3a5480 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -133,6 +133,8 @@
@property (strong, nonatomic) IBOutlet NSLayoutConstraint
*webViewBottomConstraint;
+@property (nonatomic) BOOL didLastNavigateByBackOrForward;
+
@end
#pragma mark Internal variables
@@ -1395,8 +1397,11 @@
// being *navigated to* has its history dateVisited updated later in this
method.
if (discoveryMethod != MWK_DISCOVERY_METHOD_BACKFORWARD) {
[self updateHistoryDateVisitedForArticleBeingNavigatedFrom];
+ self.didLastNavigateByBackOrForward = NO;
+ }else{
+ self.didLastNavigateByBackOrForward = YES;
}
-
+
[self retrieveArticleForPageTitle: title
discoveryMethod: discoveryMethod];
@@ -1538,8 +1543,9 @@
// if the article was NOT loaded via back or forward buttons.
if (discoveryMethod != MWK_DISCOVERY_METHOD_BACKFORWARD) {
[session.userDataStore updateHistory:article.title
discoveryMethod:discoveryMethod];
+ [self invalidateCacheForPageTitle:pageTitle];
}
-
+
// If article with sections just show them (unless needsRefresh is YES)
if ([article.sections count] > 0 && !article.needsRefresh) {
[self.tocVC setTocSectionDataForSections:session.article.sections];
@@ -1599,8 +1605,11 @@
//[article
ifNoThumbnailUseFirstSectionImageAsThumbnailUsingContext:articleDataContext_.mainContext];
MWKHistoryEntry *historyEntry = [session.userDataStore.historyList
entryForTitle:article.title];
- CGPoint scrollOffset = historyEntry ? CGPointMake(0,
historyEntry.scrollPosition) : CGPointMake(0, 0);
- self.lastScrollOffset = scrollOffset;
+
+ if(self.didLastNavigateByBackOrForward){
+ CGPoint scrollOffset = historyEntry ? CGPointMake(0,
historyEntry.scrollPosition) : CGPointMake(0, 0);
+ self.lastScrollOffset = scrollOffset;
+ }
if (![[SessionSingleton sharedInstance] isCurrentArticleMain]) {
[sectionTextArray addObject: [self renderFooterDivider]];
--
To view, visit https://gerrit.wikimedia.org/r/184970
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I51372ac4657470428b245049cc5f259e05f11e6e
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Fjalapeno <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits