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 // e.g. when getting to media details via message details screen, there's only
// one "Page" so the bounce doesn't make sense. // one "Page" so the bounce doesn't make sense.
pagerScrollView.isScrollEnabled = sliderEnabled 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 } guard let strongSelf = self else { return }
strongSelf.pagerScrollView(strongSelf.pagerScrollView, contentOffsetDidChange: change) strongSelf.pagerScrollView(strongSelf.pagerScrollView, contentOffsetDidChange: change)
} }
@ -607,10 +607,16 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
return return
} }
mediaGalleryDataSource.dismissMediaDetailViewController(self, if IsLandscapeOrientationEnabled() {
animated: isAnimated, mediaGalleryDataSource.dismissMediaDetailViewController(self,
completion: completion) animated: isAnimated,
completion: completion)
} else {
mediaGalleryDataSource.dismissMediaDetailViewController(self, animated: isAnimated) {
UIDevice.current.ows_setOrientation(.portrait)
completion?()
}
}
} }
// MARK: MediaDetailViewControllerDelegate // MARK: MediaDetailViewControllerDelegate

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

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

Loading…
Cancel
Save