Jonas Björkert 9 месяцев назад
Родитель
Сommit
fbdb2a7abc

+ 5 - 3
Trio/Sources/Services/RemoteControl/TrioRemoteControl+Bolus.swift

@@ -48,12 +48,13 @@ extension TrioRemoteControl {
             return
         }
 
+        // Send "initiating bolus" notification
         if let returnInfo = pushMessage.returnNotification {
             await RemoteNotificationResponseManager.shared.sendResponseNotification(
                 to: returnInfo,
                 commandType: pushMessage.commandType,
                 success: true,
-                message: "Starting bolus..."
+                message: "Initiating bolus..."
             )
         }
 
@@ -64,8 +65,9 @@ extension TrioRemoteControl {
                 Task {
                     if success {
                         await self.logSuccess(
-                            "Bolus successfull.",
-                            pushMessage: pushMessage
+                            "Remote command processed successfully. \(pushMessage.humanReadableDescription())",
+                            pushMessage: pushMessage,
+                            customNotificationMessage: "Bolus started"
                         )
                     } else {
                         await self.logError(

+ 2 - 2
Trio/Sources/Services/RemoteControl/TrioRemoteControl+Helpers.swift

@@ -20,7 +20,7 @@ extension TrioRemoteControl {
         await nightscoutManager.uploadNoteTreatment(note: note)
     }
 
-    func logSuccess(_ message: String, pushMessage: PushMessage) async {
+    func logSuccess(_ message: String, pushMessage: PushMessage, customNotificationMessage: String? = nil) async {
         debug(.remoteControl, message)
 
         // Send success notification back to LoopFollow if return info exists
@@ -29,7 +29,7 @@ extension TrioRemoteControl {
                 to: returnInfo,
                 commandType: pushMessage.commandType,
                 success: true,
-                message: "\(pushMessage.commandType.description) completed successfully"
+                message: customNotificationMessage ?? "Command successful"
             )
         }
     }

+ 2 - 1
Trio/Sources/Services/RemoteControl/TrioRemoteControl+Meal.swift

@@ -90,7 +90,8 @@ extension TrioRemoteControl {
         if pushMessage.bolusAmount == nil {
             await logSuccess(
                 "Remote command processed successfully. \(pushMessage.humanReadableDescription())",
-                pushMessage: pushMessage
+                pushMessage: pushMessage,
+                customNotificationMessage: "Meal logged"
             )
         }
     }

+ 4 - 2
Trio/Sources/Services/RemoteControl/TrioRemoteControl+Override.swift

@@ -7,7 +7,8 @@ extension TrioRemoteControl {
 
         await logSuccess(
             "Remote command processed successfully. \(pushMessage.humanReadableDescription())",
-            pushMessage: pushMessage
+            pushMessage: pushMessage,
+            customNotificationMessage: "Override canceled"
         )
     }
 
@@ -60,7 +61,8 @@ extension TrioRemoteControl {
 
                 await logSuccess(
                     "Remote command processed successfully. \(pushMessage.humanReadableDescription())",
-                    pushMessage: pushMessage
+                    pushMessage: pushMessage,
+                    customNotificationMessage: "Override started"
                 )
             }
         } catch {

+ 4 - 2
Trio/Sources/Services/RemoteControl/TrioRemoteControl+TempTarget.swift

@@ -31,7 +31,8 @@ extension TrioRemoteControl {
 
         await logSuccess(
             "Remote command processed successfully. \(pushMessage.humanReadableDescription())",
-            pushMessage: pushMessage
+            pushMessage: pushMessage,
+            customNotificationMessage: "Temp target set"
         )
     }
 
@@ -42,7 +43,8 @@ extension TrioRemoteControl {
 
         await logSuccess(
             "Remote command processed successfully. \(pushMessage.humanReadableDescription())",
-            pushMessage: pushMessage
+            pushMessage: pushMessage,
+            customNotificationMessage: "Temp target canceled"
         )
     }