Add feature flag for landscape orientation.

pull/1/head
Matthew Chen 6 years ago
parent eab3599ce9
commit be714399c7

@ -145,7 +145,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
// e.g. when getting to media details via message details screen, there's only
// one "Page" so the bounce doesn't make sense.
pagerScrollView.isScrollEnabled = sliderEnabled
pagerScrollViewContentOffsetObservation = pagerScrollView.observe(\.contentOffset, options: [.new]) { [weak self] object, change in
pagerScrollViewContentOffsetObservation = pagerScrollView.observe(\.contentOffset, options: [.new]) { [weak self] _, change in
guard let strongSelf = self else { return }
strongSelf.pagerScrollView(strongSelf.pagerScrollView, contentOffsetDidChange: change)
}
@ -607,10 +607,16 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
return
}
mediaGalleryDataSource.dismissMediaDetailViewController(self,
animated: isAnimated,
completion: completion)
if IsLandscapeOrientationEnabled() {
mediaGalleryDataSource.dismissMediaDetailViewController(self,
animated: isAnimated,
completion: completion)
} else {
mediaGalleryDataSource.dismissMediaDetailViewController(self, animated: isAnimated) {
UIDevice.current.ows_setOrientation(.portrait)
completion?()
}
}
}
// MARK: MediaDetailViewControllerDelegate

@ -6,7 +6,7 @@
NS_ASSUME_NONNULL_BEGIN
#define LANDSCAPE_ORIENTATION_ENABLED
BOOL IsLandscapeOrientationEnabled(void);
UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void);

@ -8,13 +8,15 @@
NS_ASSUME_NONNULL_BEGIN
BOOL IsLandscapeOrientationEnabled(void)
{
return NO;
}
UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void)
{
#ifdef LANDSCAPE_ORIENTATION_ENABLED
return UIInterfaceOrientationMaskAllButUpsideDown;
#else
return UIInterfaceOrientationMaskPortrait;
#endif
return (IsLandscapeOrientationEnabled() ? UIInterfaceOrientationMaskAllButUpsideDown
: UIInterfaceOrientationMaskPortrait);
}
@interface OWSViewController ()

Loading…
Cancel
Save