mobile-ios/CovidSafe/UploadDataVC.swift
2020-05-08 17:49:14 +10:00

56 lines
1.9 KiB
Swift

import UIKit
import CoreData
class UploadDataViewController: UIViewController {
// MARK: - Local
private var uploadStepsNavigationVC: UINavigationController?
var _preferredScreenEdgesDeferringSystemGestures: UIRectEdge = []
// MARK: - Delegates
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(enableDeferringSystemGestures(_:)), name: .enableDeferringSystemGestures, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(disableDeferringSystemGestures(_:)), name: .disableDeferringSystemGestures, object: nil)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Reset the Steps navigation vc whenever user re-enter this tab
uploadStepsNavigationVC?.popToRootViewController(animated: false)
}
override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
return _preferredScreenEdgesDeferringSystemGestures
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
@objc
func enableDeferringSystemGestures(_ notification: Notification) {
if #available(iOS 11.0, *) {
_preferredScreenEdgesDeferringSystemGestures = .bottom
setNeedsUpdateOfScreenEdgesDeferringSystemGestures()
}
}
@objc
func disableDeferringSystemGestures(_ notification: Notification) {
if #available(iOS 11.0, *) {
_preferredScreenEdgesDeferringSystemGestures = []
setNeedsUpdateOfScreenEdgesDeferringSystemGestures()
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let vc = segue.destination as? UINavigationController {
uploadStepsNavigationVC = vc
}
}
}