#1404 (edge swipe back in fullscreen)

This commit is contained in:
David Sinclair 2021-02-27 20:29:58 -08:00
parent e31b1813de
commit 77ab11512a
6 changed files with 30 additions and 12 deletions

View file

@ -132,6 +132,11 @@ class DetailViewController: BaseViewController {
/// Bottom constraint of the divider view.
@IBOutlet weak var dividerViewBottomConstraint: NSLayoutConstraint!
/// The navigation controller managed by the split view controller, that encloses the immediate navigation controller of the detail view when in compact layout.
@objc var parentNavigationController: UINavigationController? {
return navigationController?.parent as? UINavigationController
}
/// The feed detail navigation controller in the supplementary pane, loaded from the storyboard.
var supplementaryFeedDetailNavigationController: UINavigationController?

View file

@ -53,6 +53,7 @@
@property (nonatomic) UISearchBar *searchBar;
@property (nonatomic) IBOutlet UIView *messageView;
@property (nonatomic) IBOutlet UILabel *messageLabel;
@property (nonatomic, strong) id standardInteractivePopGestureDelegate;
@property (nonatomic, readwrite) BOOL pageFetching;
@property (nonatomic, readwrite) BOOL pageFinished;

View file

@ -340,6 +340,10 @@
self.appDelegate = (NewsBlurAppDelegate *)[[UIApplication sharedApplication] delegate];
if (self.standardInteractivePopGestureDelegate == nil) {
self.standardInteractivePopGestureDelegate = appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.delegate;
}
UIInterfaceOrientation orientation = self.view.window.windowScene.interfaceOrientation;
[self setUserAvatarLayout:orientation];
self.finishedAnimatingIn = NO;
@ -462,6 +466,10 @@
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.delegate != self.standardInteractivePopGestureDelegate) {
appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.delegate = self.standardInteractivePopGestureDelegate;
}
if (appDelegate.inStoryDetail && self.isPhoneOrCompact) {
appDelegate.inStoryDetail = NO;
[self checkScroll];

View file

@ -90,7 +90,6 @@
@property (nonatomic) MBProgressHUD *storyHUD;
@property (nonatomic, strong) NBNotifier *notifier;
@property (nonatomic) NSInteger scrollingToPage;
@property (nonatomic, strong) id standardInteractivePopGestureDelegate;
@property (nonatomic, readonly) BOOL shouldHideStatusBar;
@property (nonatomic, readonly) BOOL isNavigationBarHidden;
@property (nonatomic, readonly) BOOL allowFullscreen;

View file

@ -271,18 +271,11 @@
self.currentlyTogglingNavigationBar = NO;
if (self.standardInteractivePopGestureDelegate == nil) {
self.standardInteractivePopGestureDelegate = self.navigationController.interactivePopGestureRecognizer.delegate;
}
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
BOOL swipeEnabled = [[userPreferences stringForKey:@"story_detail_swipe_left_edge"]
isEqualToString:@"pop_to_story_list"];;
// self.navigationController.hidesBarsOnSwipe = self.allowFullscreen;
// [self.navigationController.barHideOnSwipeGestureRecognizer addTarget:self action:@selector(barHideSwipe:)];
self.navigationController.interactivePopGestureRecognizer.enabled = swipeEnabled;
self.navigationController.interactivePopGestureRecognizer.delegate = self;
appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.enabled = swipeEnabled;
if (self.isPhoneOrCompact) {
if (!appDelegate.storiesCollection.isSocialView) {
@ -404,8 +397,9 @@
previousPage.view.hidden = YES;
// self.navigationController.hidesBarsOnSwipe = NO;
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate = self.standardInteractivePopGestureDelegate;
appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.enabled = YES;
[appDelegate.detailViewController.parentNavigationController setNavigationBarHidden:NO animated:YES];
self.autoscrollActive = NO;
}
@ -529,6 +523,17 @@
[self.navigationController setNavigationBarHidden:hide animated:YES];
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
BOOL swipeEnabled = [[userPreferences stringForKey:@"story_detail_swipe_left_edge"]
isEqualToString:@"pop_to_story_list"];;
appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.enabled = swipeEnabled;
if (hide) {
appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.delegate = self;
} else if (appDelegate.feedDetailViewController.standardInteractivePopGestureDelegate != nil) {
appDelegate.detailViewController.parentNavigationController.interactivePopGestureRecognizer.delegate = appDelegate.feedDetailViewController.standardInteractivePopGestureDelegate;
}
CGPoint oldOffset = currentPage.webView.scrollView.contentOffset;
CGFloat navHeight = self.navigationController.navigationBar.bounds.size.height;
CGFloat statusAdjustment = 0.0;

View file

@ -13,7 +13,7 @@
<objects>
<viewController storyboardIdentifier="DetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="djW-7k-haK" customClass="DetailViewController" customModule="NewsBlur" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jTZ-4O-xyT">
<rect key="frame" x="0.0" y="0.0" width="1194" height="834"/>
<rect key="frame" x="0.0" y="0.0" width="818.5" height="834"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bPa-u1-Aml">
<rect key="frame" x="0.0" y="50" width="1194" height="604"/>