Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Loop/View Controllers/StatusTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ final class StatusTableViewController: LoopChartsTableViewController {

// This should be kept up to date immediately
hudView?.loopCompletionHUD.lastLoopCompleted = loopManager.lastLoopCompleted
hudView?.loopCompletionHUD.deviceInoperable = basalDeliveryState == .pumpInoperable
hudView?.loopCompletionHUD.mostRecentGlucoseDataDate = loopManager.mostRecentGlucoseDataDate
hudView?.loopCompletionHUD.mostRecentPumpDataDate = loopManager.mostRecentPumpDataDate

Expand Down
6 changes: 6 additions & 0 deletions LoopUI/Views/LoopCompletionHUDView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public final class LoopCompletionHUDView: BaseHUDView {
}
}

public var deviceInoperable: Bool = false {
didSet {
loopStateView.deviceInoperable = deviceInoperable
}
}

public var mostRecentGlucoseDataDate: Date?
public var mostRecentPumpDataDate: Date?

Expand Down
13 changes: 11 additions & 2 deletions LoopUI/Views/LoopStateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ class WrappedLoopStateViewModel: ObservableObject {
}
}
@Published var animating: Bool
@Published var deviceInoperable: Bool

init(
loopStatusColors: StateColorPalette = StateColorPalette(unknown: .black, normal: .black, warning: .black, error: .black),
closedLoop: Bool = true,
freshness: LoopCompletionFreshness = .stale,
animating: Bool = false
animating: Bool = false,
deviceInoperable: Bool = false
) {
self.loopStatusColors = loopStatusColors
self.closedLoop = closedLoop
self.freshness = freshness
self.animating = animating
self.deviceInoperable = deviceInoperable
}
}

Expand All @@ -42,7 +45,7 @@ struct WrappedLoopCircleView: View {
@StateObject var viewModel: WrappedLoopStateViewModel

var body: some View {
LoopCircleView(closedLoop: viewModel.closedLoop, freshness: viewModel.freshness, animating: viewModel.animating)
LoopCircleView(closedLoop: viewModel.closedLoop, freshness: viewModel.freshness, animating: viewModel.animating, deviceInoperable: viewModel.deviceInoperable)
.environment(\.loopStatusColorPalette, viewModel.loopStatusColors)
}
}
Expand Down Expand Up @@ -100,6 +103,12 @@ final class LoopStateView: UIView {
}
}

var deviceInoperable: Bool = false {
didSet {
viewModel.deviceInoperable = deviceInoperable
}
}

private let viewModel = WrappedLoopStateViewModel()

private func setupViews() {
Expand Down