Unverified Commit 4eb16a58 authored by Zach Knox's avatar Zach Knox
Browse files

deep linking?!

parent a63a755f
......@@ -40,8 +40,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let incomingURL = userActivity?.webpageURL else {
return false
}
print(incomingURL)
return true
if userActivity?.userInfo?["facility"] != nil {
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: "launchToFacility"), object: userActivity, userInfo: ["facility": userActivity!.userInfo!["facility"]!]))
return true
} else {
return false
}
}
func initAlerts(_ defaults: UserDefaults) {
......
......@@ -23,7 +23,7 @@
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<key>CFBundleVersion</key>
<string>29</string>
<string>31</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
......
......@@ -180,6 +180,31 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
@objc func toDetailFromSearch(_ notification: Notification) {
let dest = self.storyboard?.instantiateViewController(withIdentifier: "detailView") as! FacilityDetailViewController
let facility = facilitiesArray.filter("ANY facilityName = '" + notification.name.rawValue + "'")[0]
dest.facility = facility
let detailViewWithButtons = self.storyboard?.instantiateViewController(withIdentifier: "detailViewButtons") as? DetailViewButtonsViewController
detailViewWithButtons?.detailViewController = dest
detailViewWithButtons?.facility = dest.facility
let buttonDest = detailViewWithButtons!
let finalDestination = self.storyboard?.instantiateViewController(withIdentifier: "pulling") as? PullingViewController // Fox only, no items
finalDestination?.currentViewController = buttonDest
let destDelegate = DeckTransitioningDelegate(isSwipeToDismissEnabled: true, dismissCompletion: begForReviews)
finalDestination?.modalPresentationStyle = .custom
finalDestination?.transitioningDelegate = destDelegate
// present the detail view over the search controller if we're searching
if searchController.isActive {
searchController.present(finalDestination!, animated: true, completion: nil)
}
else {
present(finalDestination!, animated: true, completion: nil)
}
}
func presentDetailView(_ destination: UIViewController, tapped: UICollectionViewCell) {
var trueDest: UIViewController
if destination is FacilityDetailViewController {
......@@ -249,6 +274,8 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
override func viewDidLoad() {
NotificationCenter.default.addObserver(self, selector: #selector(toDetailFromSearch(_:)), name: NSNotification.Name(rawValue: "launchToFacility"), object: nil)
super.viewDidLoad()
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(anyRefresh(_:)), name: .UIApplicationWillEnterForeground, object: nil)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment