From af73ec4458bb6c090ee173f7ee90605b35110b18 Mon Sep 17 00:00:00 2001 From: David Sinclair Date: Tue, 1 Feb 2022 20:40:07 -0800 Subject: [PATCH] Fixed #1614 (story traversal buttons shifted) --- .../ios/Classes/StoryDetailObjCViewController.m | 14 +++++++------- clients/ios/Classes/StoryPagesObjCViewController.m | 12 +++--------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/clients/ios/Classes/StoryDetailObjCViewController.m b/clients/ios/Classes/StoryDetailObjCViewController.m index fe373f61d..9ceef55ed 100644 --- a/clients/ios/Classes/StoryDetailObjCViewController.m +++ b/clients/ios/Classes/StoryDetailObjCViewController.m @@ -1362,7 +1362,7 @@ CGFloat bottomInset = appDelegate.detailViewController.view.safeAreaInsets.bottom; - int safeBottomMargin = bottomInset / 2; + int safeBottomMargin = bottomInset; int bottomPosition = webpageHeight - topPosition - viewportHeight; BOOL singlePage = webpageHeight - 200 <= viewportHeight; BOOL atBottom = bottomPosition < 150; @@ -1412,12 +1412,12 @@ appDelegate.storyPagesViewController.traverseView.alpha = 1; // NSLog(@" ---> Bottom position: %d", bottomPosition); if (bottomPosition >= 0 || !isHorizontal) { - appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin; + appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0; } else { if (webpageHeight > 0 && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin; + appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) - safeBottomMargin; } else { - appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin; + appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0; } } } else if ((!singlePage && (atTop && !atBottom)) || [[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPhone) { @@ -1426,7 +1426,7 @@ appDelegate.storyPagesViewController.traverseFloating = NO; [appDelegate.storyPagesViewController.view layoutIfNeeded]; - appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin; + appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0; [appDelegate.storyPagesViewController.view layoutIfNeeded]; [UIView animateWithDuration:.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut @@ -1440,7 +1440,7 @@ appDelegate.storyPagesViewController.traverseFloating = YES; [appDelegate.storyPagesViewController.view layoutIfNeeded]; - appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin; + appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0; [appDelegate.storyPagesViewController.view layoutIfNeeded]; [UIView animateWithDuration:.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut @@ -1454,7 +1454,7 @@ appDelegate.storyPagesViewController.traversePinned = NO; appDelegate.storyPagesViewController.traverseFloating = YES; appDelegate.storyPagesViewController.traverseView.alpha = 1; - appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin; + appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) - safeBottomMargin; } [appDelegate.storyPagesViewController resizeScrollView]; diff --git a/clients/ios/Classes/StoryPagesObjCViewController.m b/clients/ios/Classes/StoryPagesObjCViewController.m index be63dd270..f4e378e24 100644 --- a/clients/ios/Classes/StoryPagesObjCViewController.m +++ b/clients/ios/Classes/StoryPagesObjCViewController.m @@ -214,7 +214,7 @@ [self.view addConstraint:self.notifier.topOffsetConstraint]; [self.notifier hideNow]; - self.traverseBottomConstraint.constant = appDelegate.detailViewController.view.safeAreaInsets.bottom / 2; + self.traverseBottomConstraint.constant = 0; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { appDelegate.detailViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects: @@ -522,13 +522,7 @@ self.traverseFloating = NO; if (!hide) { - int safeBottomMargin = 0; - - if (self.isPhoneOrCompact) { - safeBottomMargin = appDelegate.detailViewController.view.safeAreaInsets.bottom / 2; - } - - self.traverseBottomConstraint.constant = safeBottomMargin; + self.traverseBottomConstraint.constant = 0; [self.view layoutIfNeeded]; } } @@ -957,7 +951,7 @@ // Stick to bottom traversePinned = YES; - self.traverseBottomConstraint.constant = appDelegate.detailViewController.view.safeAreaInsets.bottom / 2; + self.traverseBottomConstraint.constant = 0; if (self.traverseView.alpha == 0) { [UIView animateWithDuration:.24 delay:0