Hide the status bar in the image picker / attachment approval.

pull/2/head
Matthew Chen 6 years ago
parent 6e492927d1
commit 7a67a7b6b5

@ -2836,7 +2836,9 @@ typedef enum : NSUInteger {
OWSImagePickerGridController *picker = [OWSImagePickerGridController new];
picker.delegate = self;
pickerModal = [[OWSNavigationController alloc] initWithRootViewController:picker];
OWSNavigationController *modal = [[OWSNavigationController alloc] initWithRootViewController:picker];
modal.ows_prefersStatusBarHidden = @(YES);
pickerModal = modal;
} else {
UIImagePickerController *picker = [OWSImagePickerController new];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

@ -169,6 +169,7 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
let vc = AttachmentApprovalViewController(mode: .modal, attachments: attachments)
vc.approvalDelegate = approvalDelegate
let navController = OWSNavigationController(rootViewController: vc)
navController.ows_prefersStatusBarHidden = true
guard let navigationBar = navController.navigationBar as? OWSNavigationBar else {
owsFailDebug("navigationBar was nil or unexpected class")
@ -198,6 +199,10 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
// MARK: - View Lifecycle
public override var prefersStatusBarHidden: Bool {
return true
}
override public func viewDidLoad() {
super.viewDidLoad()
@ -229,8 +234,6 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
Logger.debug("")
super.viewWillAppear(animated)
CurrentAppContext().setStatusBarHidden(true, animated: animated)
guard let navigationBar = navigationController?.navigationBar as? OWSNavigationBar else {
owsFailDebug("navigationBar was nil or unexpected class")
return
@ -251,10 +254,6 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
override public func viewWillDisappear(_ animated: Bool) {
Logger.debug("")
super.viewWillDisappear(animated)
// Since this VC is being dismissed, the "show status bar" animation would feel like
// it's occuring on the presenting view controller - it's better not to animate at all.
CurrentAppContext().setStatusBarHidden(false, animated: false)
}
override public var inputAccessoryView: UIView? {

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
@ -23,6 +23,11 @@ NS_ASSUME_NONNULL_BEGIN
// unsaved changes.
@interface OWSNavigationController : UINavigationController
// If set, this property lets us override prefersStatusBarHidden behavior.
// This is useful for supressing the status bar while a modal is presented,
// regardless of which view is currently visible.
@property (nonatomic, nullable) NSNumber *ows_prefersStatusBarHidden;
@end
NS_ASSUME_NONNULL_END

@ -69,6 +69,14 @@ NS_ASSUME_NONNULL_BEGIN
self.interactivePopGestureRecognizer.delegate = self;
}
- (BOOL)prefersStatusBarHidden
{
if (self.ows_prefersStatusBarHidden) {
return self.ows_prefersStatusBarHidden.boolValue;
}
return [super prefersStatusBarHidden];
}
#pragma mark - UINavigationBarDelegate
- (void)setupNavbar

Loading…
Cancel
Save