Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions LoopFollow/Remote/LoopAPNS/LoopAPNSBolusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ struct LoopAPNSBolusView: View {
switch alertType {
case .success:
return Alert(
title: Text("Success"),
title: Text("Command Sent"),
message: Text(alertMessage),
dismissButton: .default(Text("OK")) {
presentationMode.wrappedValue.dismiss()
Expand Down Expand Up @@ -409,7 +409,7 @@ struct LoopAPNSBolusView: View {
}
// Mark TOTP code as used
TOTPService.shared.markTOTPAsUsed(qrCodeURL: Storage.shared.loopAPNSQrCodeURL.value)
self.alertMessage = "Insulin sent successfully!"
self.alertMessage = RemoteCommandMessage.sent
self.alertType = .success
LogManager.shared.log(
category: .apns,
Expand Down
6 changes: 2 additions & 4 deletions LoopFollow/Remote/LoopAPNS/LoopAPNSCarbsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ struct LoopAPNSCarbsView: View {
switch alertType {
case .success:
return Alert(
title: Text("Success"),
title: Text("Command Sent"),
message: Text(alertMessage),
dismissButton: .default(Text("OK")) {
presentationMode.wrappedValue.dismiss()
Expand Down Expand Up @@ -571,9 +571,7 @@ struct LoopAPNSCarbsView: View {
}
// Mark TOTP code as used
TOTPService.shared.markTOTPAsUsed(qrCodeURL: Storage.shared.loopAPNSQrCodeURL.value)
let timeFormatter = DateFormatter()
timeFormatter.timeStyle = .short
self.alertMessage = "Carbs sent successfully for \(timeFormatter.string(from: adjustedConsumedDate))!"
self.alertMessage = RemoteCommandMessage.sent
self.alertType = .success
LogManager.shared.log(
category: .apns,
Expand Down
6 changes: 6 additions & 0 deletions LoopFollow/Remote/RemoteCommandMessage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// LoopFollow
// RemoteCommandMessage.swift

enum RemoteCommandMessage {
static let sent = "Remote command sent. Wait for a notification confirming the result."
}
4 changes: 2 additions & 2 deletions LoopFollow/Remote/TRC/BolusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ struct BolusView: View {
)
case .statusSuccess:
return Alert(
title: Text("Status"),
title: Text("Command Sent"),
message: Text(statusMessage ?? ""),
dismissButton: .default(Text("OK"), action: {
presentationMode.wrappedValue.dismiss()
Expand Down Expand Up @@ -322,7 +322,7 @@ struct BolusView: View {
if sentUnits > 0 {
QuickPickBolusesManager.shared.recordBolus(units: sentUnits)
}
statusMessage = "Bolus command sent successfully."
statusMessage = RemoteCommandMessage.sent
LogManager.shared.log(
category: .apns,
message: "sendBolusPushNotification succeeded - Bolus: \(InsulinFormatter.shared.string(bolusAmount)) U"
Expand Down
4 changes: 2 additions & 2 deletions LoopFollow/Remote/TRC/MealView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ struct MealView: View {
)
case .statusSuccess:
return Alert(
title: Text("Status"),
title: Text("Command Sent"),
message: Text(statusMessage ?? ""),
dismissButton: .default(Text("OK"), action: {
presentationMode.wrappedValue.dismiss()
Expand Down Expand Up @@ -362,7 +362,7 @@ struct MealView: View {
bolus: bolusAmount.doubleValue(for: .internationalUnit())
)
}
statusMessage = "Meal command sent successfully."
statusMessage = RemoteCommandMessage.sent
LogManager.shared.log(
category: .apns,
message: "sendMealPushNotification succeeded - Carbs: \(carbs.doubleValue(for: .gram())) g, Protein: \(protein.doubleValue(for: .gram())) g, Fat: \(fat.doubleValue(for: .gram())) g, Bolus: \(bolusAmount.doubleValue(for: .internationalUnit())) U, Scheduled: \(scheduledDate != nil ? formatDate(scheduledDate!) : "now")"
Expand Down
6 changes: 3 additions & 3 deletions LoopFollow/Remote/TRC/OverrideView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ struct OverrideView: View {
)
case .statusSuccess:
return Alert(
title: Text("Success"),
title: Text("Command Sent"),
message: Text(statusMessage ?? ""),
dismissButton: .default(Text("OK"), action: {
presentationMode.wrappedValue.dismiss()
Expand Down Expand Up @@ -181,7 +181,7 @@ struct OverrideView: View {
DispatchQueue.main.async {
self.isLoading = false
if success {
self.statusMessage = "Override command sent successfully."
self.statusMessage = RemoteCommandMessage.sent
self.alertType = .statusSuccess
LogManager.shared.log(category: .apns, message: "sendOverridePushNotification succeeded for override: \(override.name)")
} else {
Expand All @@ -201,7 +201,7 @@ struct OverrideView: View {
DispatchQueue.main.async {
self.isLoading = false
if success {
self.statusMessage = "Cancel override command sent successfully."
self.statusMessage = RemoteCommandMessage.sent
self.alertType = .statusSuccess
LogManager.shared.log(category: .apns, message: "sendCancelOverridePushNotification succeeded")
} else {
Expand Down
6 changes: 3 additions & 3 deletions LoopFollow/Remote/TRC/TempTargetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct TempTargetView: View {
)
case .statusSuccess:
return Alert(
title: Text("Status"),
title: Text("Command Sent"),
message: Text(statusMessage ?? ""),
dismissButton: .default(Text("OK"), action: {
presentationMode.wrappedValue.dismiss()
Expand Down Expand Up @@ -261,7 +261,7 @@ struct TempTargetView: View {
DispatchQueue.main.async {
self.isLoading = false
if success {
self.statusMessage = "Temp target command successfully sent."
self.statusMessage = RemoteCommandMessage.sent
self.alertType = .statusSuccess
LogManager.shared.log(category: .apns, message: "sendTempTargetPushNotification succeeded with target: \(newHKTarget), duration: \(duration)")
} else {
Expand All @@ -281,7 +281,7 @@ struct TempTargetView: View {
DispatchQueue.main.async {
self.isLoading = false
if success {
self.statusMessage = "Cancel temp target command successfully sent."
self.statusMessage = RemoteCommandMessage.sent
self.alertType = .statusSuccess
LogManager.shared.log(category: .apns, message: "sendCancelTempTargetPushNotification succeeded")
} else {
Expand Down
Loading