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

[DanaKit] Progress update 02-06-2024 #263

Merged
merged 6 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion DanaKit
Sjoerd-Bo3 marked this conversation as resolved.
Show resolved Hide resolved
Submodule DanaKit updated 45 files
+15 −0 Common/Bundle.swift
+0 −2 Common/LocalizedString.swift
+4 −0 DanaKit.xcodeproj/project.pbxproj
+1 −1 DanaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+1 −1 DanaKit/Encryption/Common.swift
+23 −4 DanaKit/Packets/DanaBolusStart.swift
+10 −5 DanaKit/PumpManager/BluetoothManager.swift
+0 −1 DanaKit/PumpManager/DanaKit.swift
+164 −73 DanaKit/PumpManager/DanaKitPumpManager.swift
+9 −0 DanaKit/PumpManager/DanaKitPumpManagerError.swift
+2 −3 DanaKit/PumpManager/DanaKitPumpManagerState.swift
+42 −148 DanaKit/PumpManager/PeripheralManager.swift
+2 −0 DanaKitUI/ViewController/DanaUICoordinator.swift
+1 −1 DanaKitUI/ViewModels/DanaKitSettingsViewModel.swift
+3 −2 DanaKitUI/Views/Onboarding/DanaIExplainationView.swift
+3 −2 DanaKitUI/Views/Onboarding/DanaRSv1Explaination.swift
+1 −1 DanaKitUI/Views/Onboarding/DanaRSv1Password.swift
+4 −3 DanaKitUI/Views/Onboarding/DanaRSv3Explaination.swift
+2 −1 DanaKitUI/Views/Settings/BasalProfileView.swift
+9 −11 DanaKitUI/Views/Settings/DanaKitSettingsView.swift
+1 −1 DanaKitUI/Views/Settings/DanaKitUserSettingsView.swift
+8 −11 DanaKitUI/Views/Settings/PickerView.swift
+13 −4 Localization/ar.lproj/Localizable.strings
+12 −3 Localization/cs.lproj/Localizable.strings
+13 −4 Localization/da.lproj/Localizable.strings
+12 −3 Localization/de.lproj/Localizable.strings
+12 −3 Localization/en.lproj/Localizable.strings
+13 −4 Localization/es.lproj/Localizable.strings
+14 −5 Localization/fi.lproj/Localizable.strings
+12 −3 Localization/fr.lproj/Localizable.strings
+12 −3 Localization/he.lproj/Localizable.strings
+12 −3 Localization/hi.lproj/Localizable.strings
+13 −4 Localization/it.lproj/Localizable.strings
+13 −4 Localization/ja.lproj/Localizable.strings
+14 −5 Localization/nb.lproj/Localizable.strings
+13 −4 Localization/nl.lproj/Localizable.strings
+13 −4 Localization/pl.lproj/Localizable.strings
+12 −3 Localization/pt-BR.lproj/Localizable.strings
+13 −4 Localization/ro.lproj/Localizable.strings
+12 −3 Localization/ru.lproj/Localizable.strings
+12 −3 Localization/sk.lproj/Localizable.strings
+13 −4 Localization/sv.lproj/Localizable.strings
+12 −3 Localization/tr.lproj/Localizable.strings
+12 −3 Localization/vi.lproj/Localizable.strings
+13 −4 Localization/zh-Hans.lproj/Localizable.strings
18 changes: 11 additions & 7 deletions FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ extension AddCarbs {
@StateObject var state = StateModel()
@State var dish: String = ""
@State var isPromtPresented = false
@State var saved = false
@State var noteSaved = false
@State var mealSaved = false
@State private var showAlert = false
@FocusState private var isFocused: Bool

Expand Down Expand Up @@ -117,9 +118,12 @@ extension AddCarbs {
}

Section {
Button { state.add() }
Button {
mealSaved = true
state.add()
}
label: { Text("Save and continue").font(.title3) }
.disabled(state.carbs <= 0 && state.fat <= 0 && state.protein <= 0)
.disabled(mealSaved || state.carbs <= 0 && state.fat <= 0 && state.protein <= 0)
.frame(maxWidth: .infinity, alignment: .center)
} footer: { Text(state.waitersNotepad().description) }

Expand All @@ -138,23 +142,23 @@ extension AddCarbs {
Section {
TextField("Name Of Dish", text: $dish)
Button {
saved = true
if dish != "", saved {
noteSaved = true
if dish != "", noteSaved {
let preset = Presets(context: moc)
preset.dish = dish
preset.fat = state.fat as NSDecimalNumber
preset.protein = state.protein as NSDecimalNumber
preset.carbs = state.carbs as NSDecimalNumber
try? moc.save()
state.addNewPresetToWaitersNotepad(dish)
saved = false
noteSaved = false
isPromtPresented = false
}
}
label: { Text("Save") }
Button {
dish = ""
saved = false
noteSaved = false
isPromtPresented = false }
label: { Text("Cancel") }
} header: { Text("Enter Meal Preset Name") }
Expand Down