Просмотр исходного кода

Address PR feedback: change message text+title conditionally

Deniz Cengiz 1 год назад
Родитель
Сommit
daa1593f61
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

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

@@ -589,14 +589,17 @@ extension DataTable {
                     action: {
                         alertCarbEntryToDelete = meal
 
-                        if !meal.isFPU {
+                        // meal is carb-only
+                        if meal.fpuID == nil {
                             alertTitle = "Delete Carbs?"
                             alertMessage = Formatter.dateFormatter
                                 .string(from: meal.date ?? Date()) + ", " +
                                 (Formatter.decimalFormatterWithTwoFractionDigits.string(for: meal.carbs) ?? "0") +
                                 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."
                         }