Skip to content

Commit

Permalink
Consolidate
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobby Sudekum committed Aug 15, 2018
1 parent 194a5b1 commit bc32b5e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
9 changes: 3 additions & 6 deletions Examples/Swift/CustomViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var instructionsBannerView: InstructionsBannerView!

lazy var feedbackViewController: FeedbackViewController = {
let controller = FeedbackViewController(for: routeController.eventsManager)
controller.modalPresentationStyle = .custom
controller.transitioningDelegate = controller
return controller
}()
var feedbackViewController: FeedbackViewController!

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -38,6 +33,8 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {

mapView.delegate = self
mapView.compassView.isHidden = true

feedbackViewController = FeedbackViewController(eventsManager: routeController.eventsManager)

// Add listeners for progress updates
resumeNotifications()
Expand Down
6 changes: 4 additions & 2 deletions MapboxNavigation/FeedbackViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ public class FeedbackViewController: UIViewController, DismissDraggable, UIGestu

var eventsManager: EventsManager

public init(for eventsManager: EventsManager) {
public init(eventsManager: EventsManager) {
self.eventsManager = eventsManager
super.init(nibName: nil, bundle: nil)
self.modalPresentationStyle = .custom
self.transitioningDelegate = self
}

required public init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -195,7 +197,7 @@ public class FeedbackViewController: UIViewController, DismissDraggable, UIGestu
//strongSelf.delegate?.mapViewController(strongSelf, didSendFeedbackAssigned: uuid, feedbackType: item.feedbackType)
strongSelf.eventsManager.updateFeedback(uuid: uuid, type: item.feedbackType, source: source, description: nil)

guard let parent = strongSelf.parent else {
guard let parent = strongSelf.presentingViewController else {
strongSelf.dismiss(animated: true)
return
}
Expand Down
9 changes: 2 additions & 7 deletions MapboxNavigation/RouteMapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ class RouteMapViewController: UIViewController {
return viewController
}()

lazy var feedbackViewController: FeedbackViewController = {
let controller = FeedbackViewController(for: routeController.eventsManager)

controller.modalPresentationStyle = .custom
controller.transitioningDelegate = controller
return controller
}()
var feedbackViewController: FeedbackViewController!

private struct Actions {
static let overview: Selector = #selector(RouteMapViewController.toggleOverview(_:))
Expand Down Expand Up @@ -111,6 +105,7 @@ class RouteMapViewController: UIViewController {
self.init()
self.routeController = routeController
self.delegate = delegate
feedbackViewController = FeedbackViewController(eventsManager: routeController.eventsManager)
automaticallyAdjustsScrollViewInsets = false
}

Expand Down

0 comments on commit bc32b5e

Please sign in to comment.