Przeglądaj źródła

Change labels (#289)

* All occurances of "Non-Pump" or "nonPump" in texts and code changed to "External"
* Removed label "Automatic" for SMBs in history
Deniz Cengiz 2 lat temu
rodzic
commit
1e600499ec

+ 3 - 3
FreeAPS/Sources/APS/Storage/PumpHistoryStorage.swift

@@ -46,7 +46,7 @@ final class BasePumpHistoryStorage: PumpHistoryStorage, Injectable {
                         temp: nil,
                         carbInput: nil,
                         isSMB: dose.automatic,
-                        isNonPumpInsulin: dose.manuallyEntered
+                        isExternal: dose.manuallyEntered
                     )]
                 case .tempBasal:
                     guard let dose = event.dose else { return [] }
@@ -215,8 +215,8 @@ final class BasePumpHistoryStorage: PumpHistoryStorage, Injectable {
         if event.isSMB ?? false {
             return .smb
         }
-        if event.isNonPumpInsulin ?? false {
-            return .nonPumpInsulin
+        if event.isExternal ?? false {
+            return .isExternal
         }
         return event.type
     }

+ 2 - 2
FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings

@@ -1171,8 +1171,8 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
-/* A manually entered dose of non-pump insulin */
-"Non-pump Insulin" = "Externes Insulin";
+/* A manually entered dose of external insulin */
+"External Insulin" = "Externes Insulin";
 
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manuelle Temporäre Basalrate";

+ 4 - 4
FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings

@@ -569,8 +569,8 @@ Enact a temp Basal or a temp target */
 /* Automatic delivered treatments */
 "Automatic" = "Automatic";
 
-/* Non-pump insulin treatments */
-"Non-Pump" = "Non-Pump";
+/* External insulin treatments */
+"External" = "External";
 
 /* */
 "Other" = "Other";
@@ -1175,8 +1175,8 @@ Enact a temp Basal or a temp target */
 /* An Automatic delivered bolus (SMB) */
 "SMB" = "SMB";
 
-/* A manually entered dose of non-pump insulin */
-"Non-pump Insulin" = "Non-pump Insulin";
+/* A manually entered dose of external insulin */
+"External Insulin" = "External Insulin";
 
 /* Status highlight when manual temp basal is running. */
 "Manual Basal" = "Manual Basal";

+ 5 - 5
FreeAPS/Sources/Models/PumpHistoryEvent.swift

@@ -12,7 +12,7 @@ struct PumpHistoryEvent: JSON, Equatable {
     let carbInput: Int?
     let note: String?
     let isSMB: Bool?
-    let isNonPumpInsulin: Bool?
+    let isExternal: Bool?
 
     init(
         id: String,
@@ -26,7 +26,7 @@ struct PumpHistoryEvent: JSON, Equatable {
         carbInput: Int? = nil,
         note: String? = nil,
         isSMB: Bool? = nil,
-        isNonPumpInsulin: Bool? = nil
+        isExternal: Bool? = nil
     ) {
         self.id = id
         self.type = type
@@ -39,14 +39,14 @@ struct PumpHistoryEvent: JSON, Equatable {
         self.carbInput = carbInput
         self.note = note
         self.isSMB = isSMB
-        self.isNonPumpInsulin = isNonPumpInsulin
+        self.isExternal = isExternal
     }
 }
 
 enum EventType: String, JSON {
     case bolus = "Bolus"
     case smb = "SMB"
-    case nonPumpInsulin = "Non-pump Insulin"
+    case isExternal = "External Insulin"
     case mealBolus = "Meal Bolus"
     case correctionBolus = "Correction Bolus"
     case snackBolus = "Snack Bolus"
@@ -90,6 +90,6 @@ extension PumpHistoryEvent {
         case carbInput = "carb_input"
         case note
         case isSMB
-        case isNonPumpInsulin
+        case isExternal
     }
 }

+ 1 - 1
FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift

@@ -87,7 +87,7 @@ extension Bolus {
                         rate: nil,
                         temp: nil,
                         carbInput: nil,
-                        isNonPumpInsulin: true
+                        isExternal: true
                     )
                 ]
             )

+ 6 - 8
FreeAPS/Sources/Modules/DataTable/DataTableDataFlow.swift

@@ -67,7 +67,7 @@ enum DataTable {
         let fpuID: String?
         let note: String?
         let isSMB: Bool?
-        let isNonPump: Bool?
+        let isExternal: Bool?
 
         private var numberFormatter: NumberFormatter {
             let formatter = NumberFormatter()
@@ -96,7 +96,7 @@ enum DataTable {
             fpuID: String? = nil,
             note: String? = nil,
             isSMB: Bool? = nil,
-            isNonPump: Bool? = nil
+            isExternal: Bool? = nil
         ) {
             self.units = units
             self.type = type
@@ -110,7 +110,7 @@ enum DataTable {
             self.fpuID = fpuID
             self.note = note
             self.isSMB = isSMB
-            self.isNonPump = isNonPump
+            self.isExternal = isExternal
         }
 
         static func == (lhs: Treatment, rhs: Treatment) -> Bool {
@@ -139,11 +139,9 @@ enum DataTable {
                     .string(from: amount as NSNumber)! + NSLocalizedString(" g", comment: "gram of carb equilvalents")
             case .bolus:
                 var bolusText = " "
-
-                if isSMB ?? false {
-                    bolusText += NSLocalizedString("Automatic", comment: "Automatic delivered treatments")
-                } else if isNonPump ?? false {
-                    bolusText += NSLocalizedString("Non-Pump", comment: "Non-pump Insulin")
+                if isSMB ?? false {}
+                else if isExternal ?? false {
+                    bolusText += NSLocalizedString("External", comment: "External Insulin")
                 } else {
                     bolusText += NSLocalizedString("Manual", comment: "Manual Bolus")
                 }

+ 11 - 11
FreeAPS/Sources/Modules/DataTable/DataTableStateModel.swift

@@ -16,8 +16,8 @@ extension DataTable {
         @Published var glucose: [Glucose] = []
         @Published var manualGlucose: Decimal = 0
         @Published var maxBolus: Decimal = 0
-        @Published var nonPumpInsulinAmount: Decimal = 0
-        @Published var nonPumpInsulinDate = Date()
+        @Published var externalInsulinAmount: Decimal = 0
+        @Published var externalInsulinDate = Date()
 
         var units: GlucoseUnits = .mmolL
 
@@ -79,7 +79,7 @@ extension DataTable {
                             amount: $0.amount,
                             idPumpEvent: $0.id,
                             isSMB: $0.isSMB,
-                            isNonPump: $0.isNonPumpInsulin
+                            isExternal: $0.isExternal
                         )
                     }
 
@@ -199,13 +199,13 @@ extension DataTable {
             saveToHealth.append(saveToJSON)
         }
 
-        func addNonPumpInsulin() {
-            guard nonPumpInsulinAmount > 0 else {
+        func addExternalInsulin() {
+            guard externalInsulinAmount > 0 else {
                 showModal(for: nil)
                 return
             }
 
-            nonPumpInsulinAmount = min(nonPumpInsulinAmount, maxBolus * 3) // Allow for 3 * Max Bolus for non-pump insulin
+            externalInsulinAmount = min(externalInsulinAmount, maxBolus * 3) // Allow for 3 * Max Bolus for external insulin
             unlockmanager.unlock()
                 .sink { _ in } receiveValue: { [weak self] _ in
                     guard let self = self else { return }
@@ -214,21 +214,21 @@ extension DataTable {
                             PumpHistoryEvent(
                                 id: UUID().uuidString,
                                 type: .bolus,
-                                timestamp: nonPumpInsulinDate,
-                                amount: nonPumpInsulinAmount,
+                                timestamp: externalInsulinDate,
+                                amount: externalInsulinAmount,
                                 duration: nil,
                                 durationMin: nil,
                                 rate: nil,
                                 temp: nil,
                                 carbInput: nil,
-                                isNonPumpInsulin: true
+                                isExternal: true
                             )
                         ]
                     )
-                    debug(.default, "Non-pump insulin saved to pumphistory.json")
+                    debug(.default, "External insulin saved to pumphistory.json")
 
                     // Reset amount to 0 for next entry.
-                    nonPumpInsulinAmount = 0
+                    externalInsulinAmount = 0
                 }
                 .store(in: &lifetime)
         }

+ 17 - 17
FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -11,7 +11,7 @@ extension DataTable {
         @State private var removeCarbsAlert: Alert?
         @State private var isRemoveInsulinAlertPresented = false
         @State private var removeInsulinAlert: Alert?
-        @State private var showNonPumpInsulin: Bool = false
+        @State private var showExternalInsulin: Bool = false
         @State private var showFutureEntries: Bool = false // default to hide future entries
         @State private var showManualGlucose: Bool = false
         @State private var isAmountUnconfirmed: Bool = true
@@ -66,17 +66,17 @@ extension DataTable {
             .sheet(isPresented: $showManualGlucose) {
                 addGlucoseView
             }
-            .sheet(isPresented: $showNonPumpInsulin, onDismiss: { if isAmountUnconfirmed { state.nonPumpInsulinAmount = 0
-                state.nonPumpInsulinDate = Date() } }) {
-                addNonPumpInsulinView
+            .sheet(isPresented: $showExternalInsulin, onDismiss: { if isAmountUnconfirmed { state.externalInsulinAmount = 0
+                state.externalInsulinDate = Date() } }) {
+                addExternalInsulinView
             }
         }
 
         private var treatmentsList: some View {
             List {
                 HStack {
-                    Button(action: { showNonPumpInsulin = true
-                        state.nonPumpInsulinDate = Date() }, label: {
+                    Button(action: { showExternalInsulin = true
+                        state.externalInsulinDate = Date() }, label: {
                         HStack {
                             Image(systemName: "syringe")
                             Text("Add")
@@ -269,7 +269,7 @@ extension DataTable {
             }
         }
 
-        var addNonPumpInsulinView: some View {
+        var addExternalInsulinView: some View {
             NavigationView {
                 VStack {
                     Form {
@@ -279,7 +279,7 @@ extension DataTable {
                                 Spacer()
                                 DecimalTextField(
                                     "0",
-                                    value: $state.nonPumpInsulinAmount,
+                                    value: $state.externalInsulinAmount,
                                     formatter: insulinFormatter,
                                     autofocus: true,
                                     cleanInput: true
@@ -289,25 +289,25 @@ extension DataTable {
                         }
 
                         Section {
-                            DatePicker("Date", selection: $state.nonPumpInsulinDate, in: ...Date())
+                            DatePicker("Date", selection: $state.externalInsulinDate, in: ...Date())
                         }
 
-                        let amountWarningCondition = (state.nonPumpInsulinAmount > state.maxBolus)
+                        let amountWarningCondition = (state.externalInsulinAmount > state.maxBolus)
 
                         Section {
                             HStack {
                                 Button {
-                                    state.addNonPumpInsulin()
+                                    state.addExternalInsulin()
                                     isAmountUnconfirmed = false
-                                    showNonPumpInsulin = false
+                                    showExternalInsulin = false
                                 }
                                 label: {
-                                    Text("Log non-pump insulin")
+                                    Text("Log external insulin")
                                 }
                                 .foregroundColor(amountWarningCondition ? Color.white : Color.accentColor)
                                 .frame(maxWidth: .infinity, alignment: .center)
                                 .disabled(
-                                    state.nonPumpInsulinAmount <= 0 || state.nonPumpInsulinAmount > state.maxBolus * 3
+                                    state.externalInsulinAmount <= 0 || state.externalInsulinAmount > state.maxBolus * 3
                                 )
                             }
                         }
@@ -324,10 +324,10 @@ extension DataTable {
                     }
                 }
                 .onAppear(perform: configureView)
-                .navigationTitle("Non-Pump Insulin")
+                .navigationTitle("External Insulin")
                 .navigationBarTitleDisplayMode(.inline)
-                .navigationBarItems(leading: Button("Close", action: { showNonPumpInsulin = false
-                    state.nonPumpInsulinAmount = 0 }))
+                .navigationBarItems(leading: Button("Close", action: { showExternalInsulin = false
+                    state.externalInsulinAmount = 0 }))
             }
         }