forked from LoopKit/LoopKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUDProvider.swift
More file actions
42 lines (33 loc) · 1.31 KB
/
HUDProvider.swift
File metadata and controls
42 lines (33 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// HUDProvider.swift
// LoopKitUI
//
// Created by Pete Schwamb on 1/29/19.
// Copyright © 2019 LoopKit Authors. All rights reserved.
//
import Foundation
import UIKit
public enum HUDTapAction {
case presentViewController(UIViewController & CompletionNotifying)
case openAppURL(URL)
case setupNewPump
case setupNewCGM
case takeNoAction
}
public protocol HUDProvider: AnyObject {
var managerIdentifier: String { get }
typealias HUDViewRawState = [String: Any]
// Creates the initial view (typically reservoir volume) to be shown in Loop HUD.
func createHUDView() -> BaseHUDView?
// Returns the action that should be taken when the view is tapped
func didTapOnHUDView(_ view: BaseHUDView, allowDebugFeatures: Bool) -> HUDTapAction?
// The current, serializable state of the HUD views
var hudViewRawState: HUDViewRawState { get }
// This notifies the HUDProvider whether hud views are offscreen or
// backgrounded. When not visible, updates should be deferred to better
// inform the user when they are returning to the views. Showing
// changed state via animations might be appropriate when becoming
// visible. When not visible, the HUDProvider should limit work done to
// save cpu resources while backgrounded.
var visible: Bool { get set }
}