Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“Add pump” button when pump has not been configured #184

Merged
merged 2 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions FreeAPS/Sources/Modules/Home/HomeStateModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ extension Home {
setupDelegate: self
).asAny()
self.router.mainSecondaryModalView.send(view)
} else if show {
self.router.mainSecondaryModalView.send(self.router.view(for: .pumpConfigDirect))
} else {
self.router.mainSecondaryModalView.send(nil)
}
Expand Down
13 changes: 13 additions & 0 deletions FreeAPS/Sources/Modules/Home/View/Header/PumpView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ struct PumpView: View {

var body: some View {
VStack(alignment: .leading, spacing: 12) {
if reservoir == nil && battery == nil {
VStack(alignment: .center, spacing: 12) {
HStack
{
// no cgm defined so display a generic CGM
Image(systemName: "keyboard.onehanded.left").font(.body).imageScale(.large)
}
HStack {
Text("Add pump").font(.caption).bold()
}
}.frame(alignment: .top)
}

if let reservoir = reservoir {
HStack {
Image(systemName: "drop.fill")
Expand Down
6 changes: 3 additions & 3 deletions FreeAPS/Sources/Modules/Home/View/HomeRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ extension Home {
timerDate: $state.timerDate
)
.onTapGesture {
if state.pumpDisplayState != nil {
state.setupPump = true
}
// if state.pumpDisplayState != nil {
state.setupPump = true
// }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Swinject
extension PumpConfig {
struct RootView: BaseView {
let resolver: Resolver
let displayClose: Bool
@StateObject var state = StateModel()

var body: some View {
Expand Down Expand Up @@ -34,6 +35,7 @@ extension PumpConfig {
.onAppear(perform: configureView)
.navigationTitle("Pump config")
.navigationBarTitleDisplayMode(.automatic)
.navigationBarItems(leading: displayClose ? Button("Close", action: state.hideModal) : nil)
.sheet(isPresented: $state.setupPump) {
if let pumpManager = state.provider.apsManager.pumpManager {
PumpSettingsView(
Expand Down
5 changes: 4 additions & 1 deletion FreeAPS/Sources/Router/Screen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum Screen: Identifiable, Hashable {
case nighscoutConfig
case nighscoutConfigDirect
case pumpConfig
case pumpConfigDirect
case pumpSettingsEditor
case basalProfileEditor
case isfEditor
Expand Down Expand Up @@ -53,7 +54,9 @@ extension Screen {
case .nighscoutConfigDirect:
NightscoutConfig.RootView(resolver: resolver, displayClose: true)
case .pumpConfig:
PumpConfig.RootView(resolver: resolver)
PumpConfig.RootView(resolver: resolver, displayClose: false)
case .pumpConfigDirect:
PumpConfig.RootView(resolver: resolver, displayClose: true)
case .pumpSettingsEditor:
PumpSettingsEditor.RootView(resolver: resolver)
case .basalProfileEditor:
Expand Down