Procházet zdrojové kódy

Address PR feedback: change message text+title conditionally

Deniz Cengiz před 1 rokem
rodič
revize
daa1593f61

+ 6 - 3
FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -589,14 +589,17 @@ extension DataTable {
                     action: {
                     action: {
                         alertCarbEntryToDelete = meal
                         alertCarbEntryToDelete = meal
 
 
-                        if !meal.isFPU {
+                        // meal is carb-only
+                        if meal.fpuID == nil {
                             alertTitle = "Delete Carbs?"
                             alertTitle = "Delete Carbs?"
                             alertMessage = Formatter.dateFormatter
                             alertMessage = Formatter.dateFormatter
                                 .string(from: meal.date ?? Date()) + ", " +
                                 .string(from: meal.date ?? Date()) + ", " +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(for: meal.carbs) ?? "0") +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(for: meal.carbs) ?? "0") +
                                 NSLocalizedString(" g", comment: "gram of carbs")
                                 NSLocalizedString(" g", comment: "gram of carbs")
-                        } else {
-                            alertTitle = "Delete Carb Equivalents?"
+                        }
+                        // meal is complex-meal or fpu-only
+                        else {
+                            alertTitle = meal.isFPU ? "Delete Carbs Equivalents?" : "Delete Carbs?"
                             alertMessage = "All FPUs and the carbs of the meal will be deleted."
                             alertMessage = "All FPUs and the carbs of the meal will be deleted."
                         }
                         }