| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // CGMManagerUI.swift
- // LoopKitUI
- //
- // Copyright © 2018 LoopKit Authors. All rights reserved.
- //
- import HealthKit
- import SwiftUI
- import LoopKit
- public protocol CGMManagerUI: CGMManager, DeviceManagerUI {
- /// Provides a view controller for setting up and configuring the manager if needed.
- ///
- /// If this method returns nil, it's expected that `init?(rawState: [:])` creates a non-nil manager
- static func setupViewController(glucoseTintColor: Color, guidanceColors: GuidanceColors) -> (UIViewController & CGMManagerSetupViewController & CompletionNotifying)?
- func settingsViewController(for glucoseUnit: HKUnit, glucoseTintColor: Color, guidanceColors: GuidanceColors) -> (UIViewController & CompletionNotifying)
-
- /// a message from the cgm that needs to be brought to the user's attention in the status bar
- var cgmStatusHighlight: DeviceStatusHighlight? { get }
-
- /// the completed percent of the progress bar to display in the status bar
- var cgmLifecycleProgress: DeviceLifecycleProgress? { get }
-
- /// gets the range category of a glucose sample using the CGM manager managed glucose thresholds
- func glucoseRangeCategory(for glucose: GlucoseSampleValue) -> GlucoseRangeCategory?
- }
- extension CGMManagerUI {
- public func glucoseRangeCategory(for glucose: GlucoseSampleValue) -> GlucoseRangeCategory? {
- return nil
- }
- }
- public protocol CGMManagerSetupViewController {
- var setupDelegate: CGMManagerSetupViewControllerDelegate? { get set }
- }
- public protocol CGMManagerSetupViewControllerDelegate: AnyObject {
- func cgmManagerSetupViewController(_ cgmManagerSetupViewController: CGMManagerSetupViewController, didSetUpCGMManager cgmManager: CGMManagerUI)
- }
|