diff --git a/clients/ios/Classes/DetailObjCViewController.h b/clients/ios/Classes/DetailObjCViewController.h index a0bcad463..177855beb 100644 --- a/clients/ios/Classes/DetailObjCViewController.h +++ b/clients/ios/Classes/DetailObjCViewController.h @@ -43,7 +43,6 @@ //@property (nonatomic) StoryDetailViewController *previousPage; @property (nonatomic, strong) IBOutlet UIScrollView *scrollView; @property (nonatomic, strong) IBOutlet UIPageControl *pageControl; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint *scrollViewTopConstraint; @property (weak, nonatomic) IBOutlet UIView *autoscrollView; @property (weak, nonatomic) IBOutlet UIImageView *autoscrollBackgroundImageView; @@ -51,7 +50,8 @@ @property (weak, nonatomic) IBOutlet UIButton *autoscrollPauseResumeButton; @property (weak, nonatomic) IBOutlet UIButton *autoscrollSlowerButton; @property (weak, nonatomic) IBOutlet UIButton *autoscrollFasterButton; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint *autoscrollBottomConstraint; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *autoscrollTopContainerBottomConstraint; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *autoscrollBottomContainerBottomConstraint; @property (nonatomic, strong) IBOutlet UIActivityIndicatorView *loadingIndicator; @property (nonatomic) IBOutlet UIImageView *textStorySendBackgroundImageView; @@ -76,8 +76,8 @@ @property (nonatomic) IBOutlet UIBarButtonItem *originalStoryButton; @property (nonatomic, strong) IBOutlet UIBarButtonItem *subscribeButton; @property (nonatomic) IBOutlet UIImageView *dragBarImageView; -@property (nonatomic) IBOutlet NSLayoutConstraint *traverseBottomConstraint; -@property (nonatomic) IBOutlet NSLayoutConstraint *scrollBottomConstraint; +@property (nonatomic) IBOutlet NSLayoutConstraint *traverseTopContainerBottomConstraint; +@property (nonatomic) IBOutlet NSLayoutConstraint *traverseBottomContainerBottomConstraint; @property (nonatomic) IBOutlet UIView *statusBarBackgroundView; @property (nonatomic) BOOL autoscrollAvailable; @property (nonatomic) BOOL autoscrollActive; @@ -145,6 +145,9 @@ - (void)flashCheckmarkHud:(NSString *)messageType; +- (void)adjustTraversePosition:(CGFloat)position; +- (void)adjustAutoscrollPosition:(CGFloat)position; + - (void)tappedStory; - (void)showAutoscrollBriefly:(BOOL)briefly; - (void)hideAutoscrollAfterDelay; diff --git a/clients/ios/Classes/DetailObjCViewController.m b/clients/ios/Classes/DetailObjCViewController.m index 68ea41308..44c5e5f38 100644 --- a/clients/ios/Classes/DetailObjCViewController.m +++ b/clients/ios/Classes/DetailObjCViewController.m @@ -62,8 +62,8 @@ @synthesize isAnimatedIntoPlace; @synthesize progressView, progressViewContainer; @synthesize traversePinned, traverseFloating; -@synthesize traverseBottomConstraint; -@synthesize scrollBottomConstraint; +@synthesize traverseTopContainerBottomConstraint; +@synthesize traverseBottomContainerBottomConstraint; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -225,7 +225,7 @@ [self.view addConstraint:self.notifier.topOffsetConstraint]; [self.notifier hideNow]; - self.traverseBottomConstraint.constant = 50; + [self adjustTraversePosition:50]; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects: @@ -471,11 +471,11 @@ - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; - if (self.isNavigationBarHidden && !self.shouldHideStatusBar) { - self.scrollViewTopConstraint.constant = self.statusBarHeight; - } else { - self.scrollViewTopConstraint.constant = 0; - } +// if (self.isNavigationBarHidden && !self.shouldHideStatusBar) { +// self.scrollViewTopConstraint.constant = self.statusBarHeight; +// } else { +// self.scrollViewTopConstraint.constant = 0; +// } UIInterfaceOrientation orientation = self.view.window.windowScene.interfaceOrientation; [self layoutForInterfaceOrientation:orientation]; @@ -558,7 +558,7 @@ safeBottomMargin = -1 * self.view.safeAreaInsets.bottom/2; } - self.traverseBottomConstraint.constant = safeBottomMargin + 20; + [self adjustTraversePosition:safeBottomMargin + 20]; [self.view layoutIfNeeded]; } } @@ -772,6 +772,16 @@ return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone || appDelegate.isCompactWidth; } +- (void)adjustTraversePosition:(CGFloat)position { + self.traverseTopContainerBottomConstraint.constant = position; + self.traverseBottomContainerBottomConstraint.constant = position; +} + +- (void)adjustAutoscrollPosition:(CGFloat)position { + self.autoscrollTopContainerBottomConstraint.constant = position; + self.autoscrollBottomContainerBottomConstraint.constant = position; +} + - (void)updateAutoscrollButtons { self.autoscrollBackgroundImageView.image = [[ThemeManager themeManager] themedImage:[UIImage imageNamed:@"traverse_background.png"]]; @@ -1043,9 +1053,9 @@ // traversePinned = YES; // // if (!self.isPhoneOrCompact) { -// self.traverseBottomConstraint.constant = 0; +// self.traverseTopContainerBottomConstraint.constant = 0; // } else { -// self.traverseBottomConstraint.constant = -1 * self.view.safeAreaInsets.bottom/2; +// self.traverseTopContainerBottomConstraint.constant = -1 * self.view.safeAreaInsets.bottom/2; // } // // [UIView animateWithDuration:.24 delay:0 @@ -1708,9 +1718,9 @@ if (self.autoscrollView.alpha == 0) { if (self.isPhoneOrCompact) { - self.autoscrollBottomConstraint.constant = 50; + [self adjustAutoscrollPosition:50]; } else { - self.autoscrollBottomConstraint.constant = 0; + [self adjustAutoscrollPosition:12]; } [self.view layoutIfNeeded]; diff --git a/clients/ios/Classes/DetailViewController.swift b/clients/ios/Classes/DetailViewController.swift index 326aa30a9..d972dfadd 100644 --- a/clients/ios/Classes/DetailViewController.swift +++ b/clients/ios/Classes/DetailViewController.swift @@ -261,6 +261,8 @@ class DetailViewController: DetailObjCViewController { private extension DetailViewController { func checkViewControllers() { + let isTop = layout == .top + if layout == .left { if feedDetailViewController != nil { remove(viewController: feedDetailViewController) @@ -277,12 +279,18 @@ private extension DetailViewController { if feedDetailViewController == nil { feedDetailViewController = Storyboards.shared.controller(withIdentifier: .feedDetail) as? FeedDetailViewController - add(viewController: feedDetailViewController, top: layout == .top) + add(viewController: feedDetailViewController, top: isTop) supplementaryFeedDetailNavigationController = appDelegate.feedDetailNavigationController supplementaryFeedDetailViewController = appDelegate.feedDetailViewController appDelegate.feedDetailViewController = feedDetailViewController appDelegate.splitViewController.setViewController(nil, for: .supplementary) + } else { + let appropriateSuperview = isTop ? topContainerView : bottomContainerView + + if feedDetailViewController?.view.superview != appropriateSuperview { + add(viewController: feedDetailViewController, top: isTop) + } } dividerViewBottomConstraint.constant = dividerPosition @@ -292,11 +300,26 @@ private extension DetailViewController { horizontalPageViewController = Storyboards.shared.controller(withIdentifier: .horizontalPages) as? HorizontalPageViewController horizontalPageViewController?.detailViewController = self - - add(viewController: horizontalPageViewController, top: layout != .top) } -// appDelegate.loadFeedDetailView() + let appropriateSuperview = isTop ? bottomContainerView : topContainerView + + if horizontalPageViewController?.view.superview != appropriateSuperview { + add(viewController: horizontalPageViewController, top: !isTop) + + if isTop { + bottomContainerView.addSubview(traverseView) + bottomContainerView.addSubview(autoscrollView) + } else { + topContainerView.addSubview(traverseView) + topContainerView.addSubview(autoscrollView) + } + } + + traverseTopContainerBottomConstraint.isActive = !isTop + traverseBottomContainerBottomConstraint.isActive = isTop + autoscrollTopContainerBottomConstraint.isActive = !isTop + autoscrollBottomContainerBottomConstraint.isActive = isTop } func add(viewController: UIViewController?, top: Bool) { diff --git a/clients/ios/Classes/FeedDetailObjCViewController.m b/clients/ios/Classes/FeedDetailObjCViewController.m index da1ef4daf..8669433df 100644 --- a/clients/ios/Classes/FeedDetailObjCViewController.m +++ b/clients/ios/Classes/FeedDetailObjCViewController.m @@ -2200,13 +2200,13 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state }]; } -// NSString *preferenceKey = @"story_titles_position"; -// NSArray *titles = @[@"Left", @"Top", @"Bottom"]; -// NSArray *values = @[@"titles_on_left", @"titles_on_top", @"titles_on_bottom"]; -// -// [viewController addSegmentedControlWithTitles:titles values:values preferenceKey:preferenceKey selectionShouldDismiss:YES handler:^(NSUInteger selectedIndex) { -// [self.appDelegate.detailViewController updateLayoutWithReload:YES]; -// }]; + NSString *preferenceKey = @"story_titles_position"; + NSArray *titles = @[@"Left", @"Top", @"Bottom"]; + NSArray *values = @[@"titles_on_left", @"titles_on_top", @"titles_on_bottom"]; + + [viewController addSegmentedControlWithTitles:titles values:values preferenceKey:preferenceKey selectionShouldDismiss:YES handler:^(NSUInteger selectedIndex) { + [self.appDelegate.detailViewController updateLayoutWithReload:YES]; + }]; [viewController addSegmentedControlWithTitles:@[@"Newest First", @"Oldest"] selectIndex:[appDelegate.storiesCollection.activeOrder isEqualToString:@"newest"] ? 0 : 1 selectionShouldDismiss:YES handler:^(NSUInteger selectedIndex) { if (selectedIndex == 0) { @@ -2234,9 +2234,9 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state }]; } - NSString *preferenceKey = @"story_list_preview_text_size"; - NSArray *titles = @[@"Title", @"1", @"2", @"3"]; - NSArray *values = @[@"title", @"short", @"medium", @"long"]; + preferenceKey = @"story_list_preview_text_size"; + titles = @[@"Title", @"1", @"2", @"3"]; + values = @[@"title", @"short", @"medium", @"long"]; [viewController addSegmentedControlWithTitles:titles values:values preferenceKey:preferenceKey selectionShouldDismiss:YES handler:^(NSUInteger selectedIndex) { [self.appDelegate resizePreviewSize]; diff --git a/clients/ios/Classes/StoryDetailObjCViewController.m b/clients/ios/Classes/StoryDetailObjCViewController.m index d92761f21..b248e075c 100644 --- a/clients/ios/Classes/StoryDetailObjCViewController.m +++ b/clients/ios/Classes/StoryDetailObjCViewController.m @@ -1412,12 +1412,12 @@ appDelegate.detailViewController.traverseView.alpha = 1; // NSLog(@" ---> Bottom position: %d", bottomPosition); if (bottomPosition >= 0 || !isHorizontal) { - appDelegate.detailViewController.traverseBottomConstraint.constant = safeBottomMargin; + [appDelegate.detailViewController adjustTraversePosition:safeBottomMargin]; } else { if (webpageHeight > 0) { - appDelegate.detailViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin; + [appDelegate.detailViewController adjustTraversePosition:viewportHeight - (webpageHeight - topPosition) + safeBottomMargin]; } else { - appDelegate.detailViewController.traverseBottomConstraint.constant = safeBottomMargin; + [appDelegate.detailViewController adjustTraversePosition:safeBottomMargin]; } } } else if (!singlePage && (atTop && !atBottom)) { @@ -1426,7 +1426,7 @@ appDelegate.detailViewController.traverseFloating = NO; [appDelegate.detailViewController.view layoutIfNeeded]; - appDelegate.detailViewController.traverseBottomConstraint.constant = safeBottomMargin; + [appDelegate.detailViewController adjustTraversePosition:safeBottomMargin]; [UIView animateWithDuration:.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ @@ -1439,7 +1439,7 @@ appDelegate.detailViewController.traverseFloating = YES; [appDelegate.detailViewController.view layoutIfNeeded]; - appDelegate.detailViewController.traverseBottomConstraint.constant = safeBottomMargin; + [appDelegate.detailViewController adjustTraversePosition:safeBottomMargin]; [UIView animateWithDuration:.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ @@ -1452,7 +1452,7 @@ appDelegate.detailViewController.traversePinned = NO; appDelegate.detailViewController.traverseFloating = YES; appDelegate.detailViewController.traverseView.alpha = 1; - appDelegate.detailViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin; + [appDelegate.detailViewController adjustTraversePosition:viewportHeight - (webpageHeight - topPosition) + safeBottomMargin]; } [self storeScrollPosition:YES]; diff --git a/clients/ios/NewsBlur.xcodeproj/project.pbxproj b/clients/ios/NewsBlur.xcodeproj/project.pbxproj index f80a9641c..b468a93c2 100755 --- a/clients/ios/NewsBlur.xcodeproj/project.pbxproj +++ b/clients/ios/NewsBlur.xcodeproj/project.pbxproj @@ -2837,7 +2837,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1220; + LastUpgradeCheck = 1230; ORGANIZATIONNAME = NewsBlur; TargetAttributes = { 1749390F1C251BFE003D98AA = { diff --git a/clients/ios/NewsBlur.xcodeproj/xcshareddata/xcschemes/NewsBlur.xcscheme b/clients/ios/NewsBlur.xcodeproj/xcshareddata/xcschemes/NewsBlur.xcscheme index bbf5a9e79..55ed64ee9 100644 --- a/clients/ios/NewsBlur.xcodeproj/xcshareddata/xcschemes/NewsBlur.xcscheme +++ b/clients/ios/NewsBlur.xcodeproj/xcshareddata/xcschemes/NewsBlur.xcscheme @@ -1,6 +1,6 @@ - + - + @@ -321,6 +321,7 @@ + @@ -329,6 +330,7 @@ + @@ -336,15 +338,22 @@ + + + + + + - + + @@ -358,7 +367,8 @@ - + + diff --git a/clients/ios/Resources/Settings.bundle/Root~ipad.plist b/clients/ios/Resources/Settings.bundle/Root~ipad.plist index ec0ca8470..2a33fd698 100644 --- a/clients/ios/Resources/Settings.bundle/Root~ipad.plist +++ b/clients/ios/Resources/Settings.bundle/Root~ipad.plist @@ -170,6 +170,7 @@ Titles Titles on left + Titles on top Titles on bottom DefaultValue @@ -177,6 +178,7 @@ Values titles_on_left + titles_on_top titles_on_bottom Key