diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index cab3b561c..04014a96d 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -40,6 +40,7 @@ public class OWSNavigationBar: UINavigationBar { @objc public static let backgroundBlurMutingFactor: CGFloat = 0.5 + var blurEffectView: UIView? override init(frame: CGRect) { super.init(frame: frame) @@ -53,6 +54,7 @@ public class OWSNavigationBar: UINavigationBar { let blurEffect = UIBlurEffect(style: .light) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.isUserInteractionEnabled = false + self.blurEffectView = blurEffectView // remove hairline below bar. self.shadowImage = UIImage() @@ -71,6 +73,8 @@ public class OWSNavigationBar: UINavigationBar { NotificationCenter.default.addObserver(self, selector: #selector(didChangeStatusBarFrame), name: .UIApplicationDidChangeStatusBarFrame, object: nil) } + // MARK: Layout + @objc public func callDidChange() { Logger.debug("\(self.logTag) in \(#function)") @@ -125,4 +129,15 @@ public class OWSNavigationBar: UINavigationBar { } } } + + // MARK: + + @objc + public func makeClear() { + self.backgroundColor = .clear + self.setBackgroundImage(UIImage(), for: .default) + self.shadowImage = UIImage() + self.clipsToBounds = true + self.blurEffectView?.isHidden = true + } } diff --git a/SignalMessaging/attachments/AttachmentApprovalViewController.swift b/SignalMessaging/attachments/AttachmentApprovalViewController.swift index d0a0d5752..15fff1703 100644 --- a/SignalMessaging/attachments/AttachmentApprovalViewController.swift +++ b/SignalMessaging/attachments/AttachmentApprovalViewController.swift @@ -67,11 +67,11 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool let vc = AttachmentApprovalViewController(attachment: attachment, delegate: delegate) let navController = OWSNavigationController(rootViewController: vc) - // Make navigationBar clear - navController.navigationBar.backgroundColor = .clear - navController.navigationBar.setBackgroundImage(UIImage(), for: .default) - navController.navigationBar.shadowImage = UIImage() - navController.navigationBar.clipsToBounds = true + guard let navigationBar = navController.navigationBar as? OWSNavigationBar else { + owsFail("\(self.logTag) in \(#function) navigationBar was nil or unexpected class") + return navController + } + navigationBar.makeClear() return navController }