RileyLinkManagerSetupViewController.swift 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // RileyLinkManagerSetupViewController.swift
  3. // Loop
  4. //
  5. // Copyright © 2018 LoopKit Authors. All rights reserved.
  6. //
  7. import UIKit
  8. import LoopKit
  9. import LoopKitUI
  10. import RileyLinkKit
  11. open class RileyLinkManagerSetupViewController: UINavigationController, PumpManagerOnboarding, UINavigationControllerDelegate, CompletionNotifying {
  12. open var maxBasalRateUnitsPerHour: Double?
  13. open var maxBolusUnits: Double?
  14. open var basalSchedule: BasalRateSchedule?
  15. open weak var pumpManagerOnboardingDelegate: PumpManagerOnboardingDelegate?
  16. open weak var completionDelegate: CompletionDelegate?
  17. open var rileyLinkPumpManager: RileyLinkPumpManager?
  18. open override func viewDidLoad() {
  19. super.viewDidLoad()
  20. if #available(iOSApplicationExtension 13.0, *) {
  21. // Prevent interactive dismissal
  22. isModalInPresentation = true
  23. }
  24. delegate = self
  25. }
  26. open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
  27. let viewControllers = navigationController.viewControllers
  28. let count = navigationController.viewControllers.count
  29. if count >= 2, let setupViewController = viewControllers[count - 2] as? RileyLinkSetupTableViewController {
  30. rileyLinkPumpManager = setupViewController.rileyLinkPumpManager
  31. }
  32. }
  33. open func finishedSetup() {
  34. completionDelegate?.completionNotifyingDidComplete(self)
  35. }
  36. }