Dr0ptp4kt has submitted this change and it was merged.
Change subject: Fix to hide footer on main page.
......................................................................
Fix to hide footer on main page.
Also fixes scroll limiting so when the TOC is not showing
you can't scroll the web view so far up that its content
has a huge amount of whitespace beneath it.
Change-Id: Id2573528d4a2732ceb498d44f8f571e27416081f
---
M Wikipedia.xcodeproj/project.pbxproj
M wikipedia/View
Controllers/WebView/Footer/SubFooters/Legal/WMFLegalFooterViewController.xib
M wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.h
M wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.m
M wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.xib
M wikipedia/View Controllers/WebView/WebViewController.m
M wikipedia/View Controllers/WebView/WebViewController_Private.h
7 files changed, 60 insertions(+), 29 deletions(-)
Approvals:
Dr0ptp4kt: Verified; Looks good to me, approved
Fjalapeno: Looks good to me, but someone else must approve
diff --git a/Wikipedia.xcodeproj/project.pbxproj
b/Wikipedia.xcodeproj/project.pbxproj
index ee5b735..24deeca 100644
--- a/Wikipedia.xcodeproj/project.pbxproj
+++ b/Wikipedia.xcodeproj/project.pbxproj
@@ -1461,9 +1461,9 @@
0480AE7A1AA4E61000A9950C /* SubFooters */ = {
isa = PBXGroup;
children = (
- 0480AE7B1AA4E61000A9950C /* Legal */,
- 0480AE7F1AA4E61000A9950C /* Options */,
0480AE831AA4E61000A9950C /* ReadMore */,
+ 0480AE7F1AA4E61000A9950C /* Options */,
+ 0480AE7B1AA4E61000A9950C /* Legal */,
);
path = SubFooters;
sourceTree = "<group>";
@@ -2978,7 +2978,6 @@
0487048419F8262600B7D307 /* CaptchaResetter.m
in Sources */,
D407E6411A51DBDA00CCC8B1 /* SchemaConverter.m
in Sources */,
BCB669A71A83F6C400C7B1FE /* MWKSiteDataObject.m
in Sources */,
- 043BFC7A1A932BA50068B932 /*
LegalFooterViewController.m in Sources */,
BC7DFCD61AA4E5FE000035C3 /*
WMFImageURLParsing.m in Sources */,
04821CD119895EDC007558F6 /*
ReferenceGradientView.m in Sources */,
0460F8DC19B0F932001BC59B /* CenteredPathView.m
in Sources */,
diff --git a/wikipedia/View
Controllers/WebView/Footer/SubFooters/Legal/WMFLegalFooterViewController.xib
b/wikipedia/View
Controllers/WebView/Footer/SubFooters/Legal/WMFLegalFooterViewController.xib
index 7f00f5e..911d8db 100644
--- a/wikipedia/View
Controllers/WebView/Footer/SubFooters/Legal/WMFLegalFooterViewController.xib
+++ b/wikipedia/View
Controllers/WebView/Footer/SubFooters/Legal/WMFLegalFooterViewController.xib
@@ -13,7 +13,7 @@
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2"
customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill"
id="i5M-Pr-FkT">
- <rect key="frame" x="0.0" y="0.0" width="284" height="138"/>
+ <rect key="frame" x="0.0" y="0.0" width="284" height="67"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"
heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO"
contentMode="scaleAspectFit" horizontalHuggingPriority="251"
verticalHuggingPriority="251" image="WikipediaWordmark"
translatesAutoresizingMaskIntoConstraints="NO" id="aOI-9i-zmL">
@@ -25,7 +25,7 @@
</constraints>
</imageView>
<label opaque="NO" contentMode="left"
horizontalHuggingPriority="251" verticalHuggingPriority="251" text=""
textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0"
baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO"
translatesAutoresizingMaskIntoConstraints="NO" id="58r-oL-D8g"
userLabel="License label" customClass="PaddedLabel">
- <rect key="frame" x="27" y="26" width="231" height="32"/>
+ <rect key="frame" x="27" y="26" width="231" height="31"/>
<gestureRecognizers/>
<fontDescription key="fontDescription" type="system"
pointSize="10"/>
<color key="textColor"
cocoaTouchSystemColor="darkTextColor"/>
@@ -38,7 +38,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0"
colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="58r-oL-D8g" firstAttribute="top"
secondItem="aOI-9i-zmL" secondAttribute="bottom" constant="10" id="1Ve-Eu-ZaU"/>
- <constraint firstAttribute="bottom" secondItem="58r-oL-D8g"
secondAttribute="bottom" constant="80" id="C8W-en-Vy8"/>
+ <constraint firstAttribute="bottom" secondItem="58r-oL-D8g"
secondAttribute="bottom" constant="10" id="C8W-en-Vy8"/>
<constraint firstItem="aOI-9i-zmL" firstAttribute="top"
secondItem="i5M-Pr-FkT" secondAttribute="top" id="W9I-lT-54a"/>
<constraint firstAttribute="centerX" secondItem="aOI-9i-zmL"
secondAttribute="centerX" id="ecI-L1-uR4"/>
<constraint firstAttribute="trailing" secondItem="58r-oL-D8g"
secondAttribute="trailing" constant="26" id="eix-Vq-gWR"/>
@@ -46,7 +46,7 @@
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
- <point key="canvasLocation" x="418" y="269"/>
+ <point key="canvasLocation" x="418" y="233.5"/>
</view>
<tapGestureRecognizer id="nPt-LV-uzV">
<connections>
diff --git a/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.h b/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.h
index 97a4aee..8bad2e1 100644
--- a/wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.h
+++ b/wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.h
@@ -12,6 +12,6 @@
- (void)updateLanguageCount:(NSInteger)count;
- (void)updateLastModifiedDate:(NSDate*)date userName:(NSString*)userName;
-@property (nonatomic, readonly) CGFloat scrollLimitingNativeSubContainerY;
+@property (nonatomic, readonly) CGFloat footerHeight;
@end
diff --git a/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.m b/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.m
index f581f33..dc9aaaa 100644
--- a/wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.m
+++ b/wikipedia/View Controllers/WebView/Footer/WMFWebViewFooterViewController.m
@@ -15,9 +15,11 @@
@property (strong, nonatomic) WMFReadMoreViewController*
readMoreViewController;
@property (strong, nonatomic) WMFLegalFooterViewController*
legalViewController;
-@property (weak, nonatomic) IBOutlet UIView* readMoreContainerView;
-@property (weak, nonatomic) IBOutlet UIView* optionsContainerView;
-@property (weak, nonatomic) IBOutlet UIView* legalContainerView;
+@property (weak, nonatomic) IBOutlet UIView* container;
+
+@property (weak, nonatomic) IBOutlet UIView* readMoreSubContainerView;
+@property (weak, nonatomic) IBOutlet UIView* optionsSubContainerView;
+@property (weak, nonatomic) IBOutlet UIView* legalSubContainerView;
@end
@@ -30,17 +32,21 @@
- (void)setupSubFooterContainers {
self.readMoreViewController = [[WMFReadMoreViewController alloc] init];
- [self wmf_addChildController:self.readMoreViewController
andConstrainToEdgesOfContainerView:self.readMoreContainerView];
+ [self wmf_addChildController:self.readMoreViewController
andConstrainToEdgesOfContainerView:self.readMoreSubContainerView];
self.optionsController = [[WMFOptionsFooterViewController alloc] init];
- [self wmf_addChildController:self.optionsController
andConstrainToEdgesOfContainerView:self.optionsContainerView];
+ [self wmf_addChildController:self.optionsController
andConstrainToEdgesOfContainerView:self.optionsSubContainerView];
self.legalViewController = [[WMFLegalFooterViewController alloc] init];
- [self wmf_addChildController:self.legalViewController
andConstrainToEdgesOfContainerView:self.legalContainerView];
+ [self wmf_addChildController:self.legalViewController
andConstrainToEdgesOfContainerView:self.legalSubContainerView];
}
-- (CGFloat)scrollLimitingNativeSubContainerY {
- return self.optionsContainerView.frame.origin.y;
+- (CGFloat)footerHeight {
+ // Find the overall height of the content shown by the web footer.
+ // Note: can't just use self.view's height because it extends down farther
than the sub-containers' content.
+ // We need the containerContainer's height plus any top padding, which the
line below provides.
+ CGPoint p = [self.container convertPoint:CGPointMake(0,
self.container.frame.size.height) toView:self.view];
+ return p.y;
}
- (void)search {
diff --git a/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.xib b/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.xib
index 1144ef8..dbb139a 100644
--- a/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.xib
+++ b/wikipedia/View
Controllers/WebView/Footer/WMFWebViewFooterViewController.xib
@@ -6,19 +6,20 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1"
userLabel="File's Owner" customClass="WMFWebViewFooterViewController">
<connections>
- <outlet property="legalContainerView" destination="3BA-2M-FfO"
id="ElT-ly-OyV"/>
- <outlet property="optionsContainerView"
destination="bY3-nl-Jig" id="7hB-cS-f4Y"/>
- <outlet property="readMoreContainerView"
destination="w0a-mT-r7z" id="Z5c-Sv-4DQ"/>
+ <outlet property="container" destination="Dh1-J0-8gD"
id="jbN-jx-ivs"/>
+ <outlet property="legalSubContainerView"
destination="3BA-2M-FfO" id="3XT-Hd-D1F"/>
+ <outlet property="optionsSubContainerView"
destination="bY3-nl-Jig" id="c9Z-oy-mKS"/>
+ <outlet property="readMoreSubContainerView"
destination="w0a-mT-r7z" id="F0Q-ub-NAf"/>
<outlet property="view" destination="i5M-Pr-FkT"
id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2"
customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill"
id="i5M-Pr-FkT">
- <rect key="frame" x="0.0" y="0.0" width="291" height="432"/>
+ <rect key="frame" x="0.0" y="0.0" width="291" height="442"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"
heightSizable="YES"/>
<subviews>
- <view contentMode="scaleToFill"
translatesAutoresizingMaskIntoConstraints="NO" id="Dh1-J0-8gD">
- <rect key="frame" x="12" y="16" width="267" height="300"/>
+ <view contentMode="scaleToFill"
translatesAutoresizingMaskIntoConstraints="NO" id="Dh1-J0-8gD"
userLabel="Container container">
+ <rect key="frame" x="12" y="16" width="267" height="356"/>
<subviews>
<view contentMode="scaleToFill"
translatesAutoresizingMaskIntoConstraints="NO" id="w0a-mT-r7z" userLabel="Read
more container">
<rect key="frame" x="0.0" y="0.0" width="267"
height="100"/>
@@ -47,7 +48,7 @@
<constraint firstItem="w0a-mT-r7z"
firstAttribute="top" secondItem="Dh1-J0-8gD" secondAttribute="top"
id="3XF-ln-CWn"/>
<constraint firstItem="bY3-nl-Jig"
firstAttribute="trailing" secondItem="Dh1-J0-8gD" secondAttribute="trailing"
id="7I5-zm-vwm"/>
<constraint firstItem="3BA-2M-FfO"
firstAttribute="leading" secondItem="Dh1-J0-8gD" secondAttribute="leading"
id="I6m-8j-ZFT"/>
- <constraint firstAttribute="bottom"
secondItem="3BA-2M-FfO" secondAttribute="bottom" id="OVd-yY-gdq"/>
+ <constraint firstAttribute="bottom"
secondItem="3BA-2M-FfO" secondAttribute="bottom" constant="56" id="OVd-yY-gdq"/>
<constraint firstItem="3BA-2M-FfO"
firstAttribute="trailing" secondItem="Dh1-J0-8gD" secondAttribute="trailing"
id="Ooo-k9-aqV"/>
<constraint firstItem="w0a-mT-r7z"
firstAttribute="trailing" secondItem="Dh1-J0-8gD" secondAttribute="trailing"
id="QW2-et-dJo"/>
<constraint firstItem="w0a-mT-r7z"
firstAttribute="leading" secondItem="Dh1-J0-8gD" secondAttribute="leading"
id="Uaa-Pf-4y5"/>
@@ -61,11 +62,17 @@
<constraints>
<constraint firstItem="Dh1-J0-8gD" firstAttribute="leading"
secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="12"
id="F9w-kv-jxZ"/>
<constraint firstItem="Dh1-J0-8gD" firstAttribute="top"
secondItem="i5M-Pr-FkT" secondAttribute="top" constant="16" id="FWd-4I-JwX"/>
+ <constraint firstAttribute="bottom"
relation="greaterThanOrEqual" secondItem="Dh1-J0-8gD" secondAttribute="bottom"
constant="16" id="Fvh-2a-05n"/>
<constraint firstItem="Dh1-J0-8gD" firstAttribute="trailing"
secondItem="i5M-Pr-FkT" secondAttribute="trailing" constant="-12"
id="SgQ-Qp-NV8"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
- <point key="canvasLocation" x="375.5" y="349"/>
+ <variation key="default">
+ <mask key="constraints">
+ <exclude reference="Fvh-2a-05n"/>
+ </mask>
+ </variation>
+ <point key="canvasLocation" x="375.5" y="352"/>
</view>
</objects>
</document>
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m
b/wikipedia/View Controllers/WebView/WebViewController.m
index bb157fc..0238405 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -340,12 +340,27 @@
[self.view addConstraint:self.scrollIndicatorViewHeightConstraint];
}
-- (CGFloat)scrollLimitingNativeSubContainerY {
- return self.footerViewController.scrollLimitingNativeSubContainerY;
+- (CGFloat)footerMinimumScrollY {
+ /*
+ Reminder/Examples:
+ VALUES | TOP OF FOOTER WOULD SCROLL
+
+ 0 Not past the top of the screen.
+ 100 100 pixels past the top of the screen.
+ -100 100 pixels below the top of the screen.
+
+ */
+ if (self.isCurrentArticleMain) {
+ // Prevent top of footer from being scrolled up past bottom of screen.
+ return -self.view.frame.size.height;
+ } else {
+ // Prevent bottom of footer from being scrolled up past bottom of
screen.
+ return self.footerViewController.footerHeight -
self.view.frame.size.height;
+ }
}
- (void)scrollIndicatorMove {
- CGFloat f = self.webView.scrollView.contentSize.height -
kBottomScrollSpacerHeight + [self scrollLimitingNativeSubContainerY];
+ CGFloat f = self.webView.scrollView.contentSize.height -
kBottomScrollSpacerHeight + [self footerMinimumScrollY];
if (f == 0) {
f = 0.00001f;
}
@@ -1065,7 +1080,7 @@
// When trying to scroll the bottom of the web view article all the way to
// the top, this is the minimum amount that will be allowed to be onscreen
// before we limit scrolling.
- CGFloat onscreenMinHeight = -[self scrollLimitingNativeSubContainerY];
+ CGFloat onscreenMinHeight = -[self footerMinimumScrollY];
CGFloat offsetMaxY = kBottomScrollSpacerHeight + onscreenMinHeight;
@@ -1527,7 +1542,9 @@
self.lastScrollOffset = scrollOffset;
}
- if (![[SessionSingleton sharedInstance] isCurrentArticleMain]) {
+ self.isCurrentArticleMain = [[SessionSingleton sharedInstance]
isCurrentArticleMain];
+
+ if (!self.isCurrentArticleMain) {
NSString* lastModifiedByUserName =
(lastModifiedBy && !lastModifiedBy.anonymous) ?
lastModifiedBy.name : nil;
[self.footerViewController updateLanguageCount:langCount];
diff --git a/wikipedia/View Controllers/WebView/WebViewController_Private.h
b/wikipedia/View Controllers/WebView/WebViewController_Private.h
index d490900..7c7303f 100644
--- a/wikipedia/View Controllers/WebView/WebViewController_Private.h
+++ b/wikipedia/View Controllers/WebView/WebViewController_Private.h
@@ -153,6 +153,8 @@
@property (nonatomic) BOOL didLastNavigateByBackOrForward;
+@property (nonatomic) BOOL isCurrentArticleMain;
+
- (void)cancelArticleLoading;
- (void)cancelSearchLoading;
--
To view, visit https://gerrit.wikimedia.org/r/194055
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id2573528d4a2732ceb498d44f8f571e27416081f
Gerrit-PatchSet: 3
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mhurd <[email protected]>
Gerrit-Reviewer: Bgerstle <[email protected]>
Gerrit-Reviewer: Dr0ptp4kt <[email protected]>
Gerrit-Reviewer: Fjalapeno <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits