iOS: tweaked #1137 (full screen)

- Pinch in gesture in a story to force the nav bar to show when hidden for full screen or autoscroll.
- Pinch out gesture to hide it if appropriate.
- Form sheet Safari presentation now only on iPad.
- Responsive swipe is covered by another issue.
This commit is contained in:
David Sinclair 2019-03-04 20:07:42 -08:00
parent 899451a9e4
commit 9ffb727d70
4 changed files with 21 additions and 4 deletions

View file

@ -1779,7 +1779,9 @@
} else if ([storyBrowser isEqualToString:@"inappsafari"]) {
self.safariViewController = [[SFSafariViewController alloc] initWithURL:url];
self.safariViewController.delegate = self;
self.safariViewController.modalPresentationStyle = UIModalPresentationPageSheet;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
self.safariViewController.modalPresentationStyle = UIModalPresentationPageSheet;
}
[navigationController presentViewController:self.safariViewController animated:YES completion:nil];
} else if ([storyBrowser isEqualToString:@"inappsafarireader"]) {
self.safariViewController = [[SFSafariViewController alloc] initWithURL:url entersReaderIfAvailable:YES];

View file

@ -125,6 +125,12 @@
doubleDoubleTapGesture.delegate = self;
[self.webView addGestureRecognizer:doubleDoubleTapGesture];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc]
initWithTarget:self action:@selector(pinchGesture:)];
[self.webView addGestureRecognizer:pinchGesture];
}
UIScreenEdgePanGestureRecognizer *screenEdgeGesture = [[UIScreenEdgePanGestureRecognizer alloc]
initWithTarget:self action:@selector(screenEdgeSwipe:)];
screenEdgeGesture.edges = UIRectEdgeLeft;
@ -258,6 +264,15 @@
}
}
- (void)pinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer {
if (gestureRecognizer.state != UIGestureRecognizerStateEnded) {
return;
}
appDelegate.storyPageControl.forceNavigationBarShown = gestureRecognizer.scale < 1;
[appDelegate.storyPageControl changedFullscreen];
}
- (void)screenEdgeSwipe:(UITapGestureRecognizer *)gestureRecognizer {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
BOOL swipeEnabled = [[userPreferences stringForKey:@"story_detail_swipe_left_edge"]

View file

@ -86,6 +86,7 @@
@property (nonatomic, strong) NBNotifier *notifier;
@property (nonatomic) NSInteger scrollingToPage;
@property (nonatomic, readonly) BOOL wantNavigationBarHidden;
@property (nonatomic) BOOL forceNavigationBarShown;
@property (nonatomic) BOOL currentlyTogglingNavigationBar;
@property (nonatomic, readonly) BOOL isHorizontal;

View file

@ -454,7 +454,7 @@
- (BOOL)wantNavigationBarHidden {
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
return [preferences boolForKey:@"story_full_screen"] || self.autoscrollAvailable;
return ([preferences boolForKey:@"story_full_screen"] || self.autoscrollAvailable) && !self.forceNavigationBarShown;
}
- (void)setNavigationBarHidden:(BOOL)hide {
@ -1448,8 +1448,7 @@
}
- (void)changedFullscreen {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
BOOL wantHidden = [userPreferences boolForKey:@"story_full_screen"];
BOOL wantHidden = self.wantNavigationBarHidden;
BOOL isHidden = self.navigationController.navigationBarHidden;
if (self.currentPage.webView.scrollView.contentOffset.y > 10 || isHidden) {