                 self.previewView.alpha = 1.0
             })
         }
-
-        NotificationCenter.default.addObserver(forName: NSNotification.Name.UIDeviceOrientationDidChange, object: nil, queue: nil) { (_) -> Void in
-            switch UIDevice.current.orientation {
-            case .faceDown, .faceUp, .unknown:
-                ()
-            case .landscapeLeft, .landscapeRight, .portrait, .portraitUpsideDown:
-                self.orientation = UIDevice.current.orientation
-                self.updateWidgetsToOrientation()
-            }
-        }
-    }
-
-    private func updateImagePickerButton() {
-        if imagePickerAdapter == nil {
-            if pickerButton != nil {
-                pickerButton?.removeFromSuperview()
-                pickerButton = nil
-            }
-        } else {
-            if pickerButton == nil {
-                let pickerButtonWidth: CGFloat = 114
-                pickerButton = UIButton(frame: CGRect(x: view.bounds.width - pickerButtonWidth - buttonMargin, y: buttonMargin, width: pickerButtonWidth, height: 38))
-                pickerButton!.setTitle(NSLocalizedString("Photos", comment: "Select from Photos buttont itle"), for: UIControlState())
-                pickerButton!.setImage(UIImage(named: "PhotosIcon"), for: UIControlState())
-                pickerButton!.addTarget(self, action: #selector(presentImagePickerTapped(_:)), for: .touchUpInside)
-                pickerButton!.titleLabel?.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.footnote)
-                pickerButton!.autoresizingMask = [.flexibleTopMargin]
-                pickerButton!.layer.anchorPoint = CGPoint(x: 0.5, y: 0.5)
-                roundifyButton(pickerButton!)
-                view.addSubview(pickerButton!)
-            }
-        }
-    }
-
-    open override func viewWillAppear(_ animated: Bool) {
-        super.viewWillAppear(animated)
-
-        collectionView.reloadData()
-
-        scrollToLastAddedAssetAnimated(false)
-
-        // In case the application uses the old style for managing status bar appearance
-        UIApplication.shared.setStatusBarHidden(true, with: .slide)
     }
 
     open override func viewWillDisappear(_ animated: Bool) {


        view.backgroundColor = UIColor.black

        previewView = UIView(frame: view.bounds)
        previewView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        view.addSubview(previewView)
        let previewLayer = captureManager.previewLayer
        // We are using AVCaptureSessionPresetPhoto which has a 4:3 aspect ratio
        let viewFinderWidth = view.bounds.size.width
        var viewFinderHeight = (viewFinderWidth / 3) * 4
        if captureManager.viewfinderMode == .fullScreen {
            viewFinderHeight = view.bounds.size.height
        }
        previewLayer.frame = CGRect(x: 0, y: 0, width: viewFinderWidth, height: viewFinderHeight)
        previewView.layer.addSublayer(previewLayer)

        focusIndicatorView.alpha = 0.0
        previewView.addSubview(focusIndicatorView)

        flashButton = UIButton(frame: CGRect(x: viewFrame.origin.x + buttonMargin, y: viewFrame.origin.y + buttonMargin, width: 70, height: 38))
        flashButton.setImage(UIImage(named: "LightningIcon"), for: UIControlState())
        flashButton.setTitle(NSLocalizedString("Off", comment: "flash off"), for: UIControlState())
        flashButton.addTarget(self, action: #selector(flashButtonTapped(_:)), for: .touchUpInside)
