Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Watch: Discard workout (#783)
Adrián Fernándezc5a276dabf03
diff --git a/frontend/ios/App/Watch/OpenGymWatchApp.swift b/frontend/ios/App/Watch/OpenGymWatchApp.swiftindex b2ed2e581..a711202bd 100644--- a/frontend/ios/App/Watch/OpenGymWatchApp.swift+++ b/frontend/ios/App/Watch/OpenGymWatchApp.swift@@ -820,6 +820,7 @@ struct FinishPage: View {.dynamicTypeSize(...DynamicTypeSize.accessibility2).confirmationDialog("Finish workout?", isPresented: $confirming) {Button("Finish and save") { store.finish() }+ Button("Discard workout", role: .destructive) { store.discard() }Button("Cancel", role: .cancel) {}}}diff --git a/frontend/ios/App/Watch/SessionStore.swift b/frontend/ios/App/Watch/SessionStore.swiftindex e168dcd0d..c12de8f25 100644--- a/frontend/ios/App/Watch/SessionStore.swift+++ b/frontend/ios/App/Watch/SessionStore.swift@@ -704,6 +704,21 @@ final class SessionStore: NSObject, ObservableObject, WCSessionDelegate, UNUserNHaptics.finished()}+ /// Discards the session: nothing saved here or in Apple Health, and the phone drops it too.+ func discard() {+ closeRest(at: Date())+ let (next, event) = SessionCore.finish(state, at: Date().timeIntervalSince1970 * 1000, id: UUID().uuidString, discard: true)+ guard let ev = event else { return }+ health.end(save: false)+ stopHold()+ skipRest()+ dropClips()+ send(event: ev)+ state = next+ summary = nil+ Haptics.discarded()+ }+func skipRest() {ackRestOver()closeRest(at: Date())@@ -993,6 +1008,7 @@ final class SessionStore: NSObject, ObservableObject, WCSessionDelegate, UNUserN* skip a soft one going down* count a click each second of the 3-2-1 before a workout* ask two taps: "All done?", nothing logged for 20 minutes+ * discarded stop alone: the workout is gone, nothing saved*/enum Haptics {private static var device: WKInterfaceDevice { WKInterfaceDevice.current() }@@ -1009,4 +1025,5 @@ enum Haptics {static func skip() { play([(0, .directionDown)]) }static func count() { play([(0, .click)]) }static func ask() { play([(0, .notification), (0.6, .notification)]) }+ static func discarded() { play([(0, .stop)]) }}diff --git a/frontend/ios/App/Watch/ar.lproj/Localizable.strings b/frontend/ios/App/Watch/ar.lproj/Localizable.stringsindex 5340b9876..5896dad27 100644--- a/frontend/ios/App/Watch/ar.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/ar.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "إنهاء التمرين";"Finish workout?" = "إنهاء التمرين؟";"Finish and save" = "إنهاء وحفظ";+"Discard workout" = "تجاهل التمرين";"Continue workout" = "متابعة التمرين";"Cancel" = "إلغاء";"Rest’s over. Next set!" = "انتهت الراحة. المجموعة التالية!";diff --git a/frontend/ios/App/Watch/bn.lproj/Localizable.strings b/frontend/ios/App/Watch/bn.lproj/Localizable.stringsindex 8f2cb2b99..06dc02756 100644--- a/frontend/ios/App/Watch/bn.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/bn.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "ওয়ার্কআউট শেষ করুন";"Finish workout?" = "ওয়ার্কআউট শেষ করবেন?";"Finish and save" = "শেষ করে সেভ করুন";+"Discard workout" = "ওয়ার্কআউট বাদ দিন";"Continue workout" = "ওয়ার্কআউট চালিয়ে যান";"Cancel" = "বাতিল";"Rest’s over. Next set!" = "বিশ্রাম শেষ। পরের সেট!";diff --git a/frontend/ios/App/Watch/de.lproj/Localizable.strings b/frontend/ios/App/Watch/de.lproj/Localizable.stringsindex 9af39766b..4f90a62ed 100644--- a/frontend/ios/App/Watch/de.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/de.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Training beenden";"Finish workout?" = "Training beenden?";"Finish and save" = "Beenden und speichern";+"Discard workout" = "Training verwerfen";"Continue workout" = "Weitertrainieren";"Cancel" = "Abbrechen";"Rest’s over. Next set!" = "Pause vorbei. Nächster Satz!";diff --git a/frontend/ios/App/Watch/en.lproj/Localizable.strings b/frontend/ios/App/Watch/en.lproj/Localizable.stringsindex 4f4e76c16..c601e40ae 100644--- a/frontend/ios/App/Watch/en.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/en.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Finish workout";"Finish workout?" = "Finish workout?";"Finish and save" = "Finish and save";+"Discard workout" = "Discard workout";"Continue workout" = "Continue workout";"Cancel" = "Cancel";"Rest’s over. Next set!" = "Rest’s over. Next set!";diff --git a/frontend/ios/App/Watch/es.lproj/Localizable.strings b/frontend/ios/App/Watch/es.lproj/Localizable.stringsindex a09c95d10..b5f2388e3 100644--- a/frontend/ios/App/Watch/es.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/es.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminar entrenamiento";"Finish workout?" = "¿Terminar entrenamiento?";"Finish and save" = "Terminar y guardar";+"Discard workout" = "Descartar entrenamiento";"Continue workout" = "Continuar entrenamiento";"Cancel" = "Cancelar";"Rest’s over. Next set!" = "Se acabó el descanso. ¡Siguiente serie!";diff --git a/frontend/ios/App/Watch/fr.lproj/Localizable.strings b/frontend/ios/App/Watch/fr.lproj/Localizable.stringsindex c8da8658d..75c63ef63 100644--- a/frontend/ios/App/Watch/fr.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/fr.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminer la séance";"Finish workout?" = "Terminer la séance ?";"Finish and save" = "Terminer et enregistrer";+"Discard workout" = "Abandonner la séance";"Continue workout" = "Continuer la séance";"Cancel" = "Annuler";"Rest’s over. Next set!" = "Repos terminé. Série suivante !";diff --git a/frontend/ios/App/Watch/hi.lproj/Localizable.strings b/frontend/ios/App/Watch/hi.lproj/Localizable.stringsindex 7508c4564..1c11b88f3 100644--- a/frontend/ios/App/Watch/hi.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/hi.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "वर्कआउट समाप्त करें";"Finish workout?" = "वर्कआउट समाप्त करें?";"Finish and save" = "समाप्त करें और सहेजें";+"Discard workout" = "वर्कआउट छोड़ें";"Continue workout" = "वर्कआउट जारी रखें";"Cancel" = "रद्द करें";"Rest’s over. Next set!" = "आराम खत्म। अगला सेट!";diff --git a/frontend/ios/App/Watch/hu.lproj/Localizable.strings b/frontend/ios/App/Watch/hu.lproj/Localizable.stringsindex a6a737d1c..6ef2527a1 100644--- a/frontend/ios/App/Watch/hu.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/hu.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Edzés befejezése";"Finish workout?" = "Befejezed az edzést?";"Finish and save" = "Befejezés és mentés";+"Discard workout" = "Edzés elvetése";"Continue workout" = "Edzés folytatása";"Cancel" = "Mégse";"Rest’s over. Next set!" = "Vége a pihenőnek. Jöhet a következő sorozat!";diff --git a/frontend/ios/App/Watch/it.lproj/Localizable.strings b/frontend/ios/App/Watch/it.lproj/Localizable.stringsindex f66fd6c57..2c4b7f642 100644--- a/frontend/ios/App/Watch/it.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/it.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Termina allenamento";"Finish workout?" = "Terminare l’allenamento?";"Finish and save" = "Termina e salva";+"Discard workout" = "Scarta allenamento";"Continue workout" = "Continua allenamento";"Cancel" = "Annulla";"Rest’s over. Next set!" = "Riposo finito. Prossima serie!";diff --git a/frontend/ios/App/Watch/ko.lproj/Localizable.strings b/frontend/ios/App/Watch/ko.lproj/Localizable.stringsindex d9823d2fb..948ba7619 100644--- a/frontend/ios/App/Watch/ko.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/ko.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "운동 마치기";"Finish workout?" = "운동을 마칠까요?";"Finish and save" = "마치고 저장";+"Discard workout" = "운동 버리기";"Continue workout" = "운동 계속하기";"Cancel" = "취소";"Rest’s over. Next set!" = "휴식 끝. 다음 세트!";diff --git a/frontend/ios/App/Watch/pl.lproj/Localizable.strings b/frontend/ios/App/Watch/pl.lproj/Localizable.stringsindex 8d7650769..0fb802bd9 100644--- a/frontend/ios/App/Watch/pl.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/pl.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Zakończ trening";"Finish workout?" = "Zakończyć trening?";"Finish and save" = "Zakończ i zapisz";+"Discard workout" = "Odrzuć trening";"Continue workout" = "Kontynuuj trening";"Cancel" = "Anuluj";"Rest’s over. Next set!" = "Koniec przerwy. Następna seria!";diff --git a/frontend/ios/App/Watch/pt-BR.lproj/Localizable.strings b/frontend/ios/App/Watch/pt-BR.lproj/Localizable.stringsindex f65e55c24..4eae452da 100644--- a/frontend/ios/App/Watch/pt-BR.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/pt-BR.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminar treino";"Finish workout?" = "Terminar o treino?";"Finish and save" = "Terminar e salvar";+"Discard workout" = "Descartar treino";"Continue workout" = "Continuar treino";"Cancel" = "Cancelar";"Rest’s over. Next set!" = "Acabou o descanso. Próxima série!";diff --git a/frontend/ios/App/Watch/pt-PT.lproj/Localizable.strings b/frontend/ios/App/Watch/pt-PT.lproj/Localizable.stringsindex 78a9d7db9..15eb8d90d 100644--- a/frontend/ios/App/Watch/pt-PT.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/pt-PT.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminar treino";"Finish workout?" = "Terminar o treino?";"Finish and save" = "Terminar e guardar";+"Discard workout" = "Descartar treino";"Continue workout" = "Continuar treino";"Cancel" = "Cancelar";"Rest’s over. Next set!" = "Acabou o descanso. Próxima série!";diff --git a/frontend/ios/App/Watch/ru.lproj/Localizable.strings b/frontend/ios/App/Watch/ru.lproj/Localizable.stringsindex 42df48dce..635aedc4c 100644--- a/frontend/ios/App/Watch/ru.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/ru.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Завершить тренировку";"Finish workout?" = "Завершить тренировку?";"Finish and save" = "Завершить и сохранить";+"Discard workout" = "Отменить тренировку";"Continue workout" = "Продолжить тренировку";"Cancel" = "Отмена";"Rest’s over. Next set!" = "Отдых окончен. Следующий подход!";diff --git a/frontend/ios/App/Watch/th.lproj/Localizable.strings b/frontend/ios/App/Watch/th.lproj/Localizable.stringsindex 5bc0f111d..2eb7e35ae 100644--- a/frontend/ios/App/Watch/th.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/th.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "จบการออกกำลังกาย";"Finish workout?" = "จบการออกกำลังกายไหม?";"Finish and save" = "จบและบันทึก";+"Discard workout" = "ทิ้งการออกกำลังกายนี้";"Continue workout" = "ออกกำลังกายต่อ";"Cancel" = "ยกเลิก";"Rest’s over. Next set!" = "หมดเวลาพักแล้ว เซ็ตถัดไป!";diff --git a/frontend/ios/App/Watch/tr.lproj/Localizable.strings b/frontend/ios/App/Watch/tr.lproj/Localizable.stringsindex 33cc8fe2c..1d1daec3b 100644--- a/frontend/ios/App/Watch/tr.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/tr.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Antrenmanı bitir";"Finish workout?" = "Antrenman bitirilsin mi?";"Finish and save" = "Bitir ve kaydet";+"Discard workout" = "Antrenmanı iptal et";"Continue workout" = "Antrenmana devam et";"Cancel" = "İptal";"Rest’s over. Next set!" = "Dinlenme bitti. Sıradaki set!";diff --git a/frontend/ios/App/Watch/uk.lproj/Localizable.strings b/frontend/ios/App/Watch/uk.lproj/Localizable.stringsindex 3faf0a963..de0e5caf5 100644--- a/frontend/ios/App/Watch/uk.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/uk.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Завершити тренування";"Finish workout?" = "Завершити тренування?";"Finish and save" = "Завершити й зберегти";+"Discard workout" = "Скасувати тренування";"Continue workout" = "Продовжити тренування";"Cancel" = "Скасувати";"Rest’s over. Next set!" = "Відпочинок скінчився. Наступний підхід!";diff --git a/frontend/ios/App/Watch/zh-Hans.lproj/Localizable.strings b/frontend/ios/App/Watch/zh-Hans.lproj/Localizable.stringsindex 30f633906..6351770db 100644--- a/frontend/ios/App/Watch/zh-Hans.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/zh-Hans.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "结束训练";"Finish workout?" = "结束训练?";"Finish and save" = "结束并保存";+"Discard workout" = "放弃训练";"Continue workout" = "继续训练";"Cancel" = "取消";"Rest’s over. Next set!" = "休息结束,下一组!";diff --git a/frontend/ios/App/Watch/zh-Hant.lproj/Localizable.strings b/frontend/ios/App/Watch/zh-Hant.lproj/Localizable.stringsindex 5d56bf434..82e2306f6 100644--- a/frontend/ios/App/Watch/zh-Hant.lproj/Localizable.strings+++ b/frontend/ios/App/Watch/zh-Hant.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "結束訓練";"Finish workout?" = "結束訓練?";"Finish and save" = "結束並儲存";+"Discard workout" = "捨棄本次訓練";"Continue workout" = "繼續訓練";"Cancel" = "取消";"Rest’s over. Next set!" = "休息結束,下一組!";diff --git a/frontend/ios/App/WatchCore/Sources/WatchCore/SessionCore.swift b/frontend/ios/App/WatchCore/Sources/WatchCore/SessionCore.swiftindex 7850978f5..3896d93b6 100644--- a/frontend/ios/App/WatchCore/Sources/WatchCore/SessionCore.swift+++ b/frontend/ios/App/WatchCore/Sources/WatchCore/SessionCore.swift@@ -300,8 +300,8 @@ enum SessionCore {return (s, event)}- /// The session finished here.- static func finish(_ s0: SessionState, at: Double, id: String) -> (SessionState, Event?) {+ /// The session finished here, or discarded here (the phone drops it unsaved).+ static func finish(_ s0: SessionState, at: Double, id: String, discard: Bool = false) -> (SessionState, Event?) {guard let w = s0.workout else { return (s0, nil) }var s = s0s.workout = nil@@ -309,7 +309,7 @@ enum SessionCore {s.skipped = nils.startedHere = nilif let wid = w.id { s.finishedHere = Array((s.finishedHere + [wid]).suffix(5)) }- return (s, ["id": id, "type": "finish", "wid": w.id ?? "", "at": at])+ return (s, ["id": id, "type": discard ? "discard" : "finish", "wid": w.id ?? "", "at": at])}/// The set to do next in an exercise: the one picked, or the first not done.diff --git a/frontend/ios/App/WatchCore/Tests/WatchCoreTests/SessionCoreTests.swift b/frontend/ios/App/WatchCore/Tests/WatchCoreTests/SessionCoreTests.swiftindex 9a8a4f9af..7112c76ed 100644--- a/frontend/ios/App/WatchCore/Tests/WatchCoreTests/SessionCoreTests.swift+++ b/frontend/ios/App/WatchCore/Tests/WatchCoreTests/SessionCoreTests.swift@@ -68,6 +68,16 @@ final class SessionCoreTests: XCTestCase {XCTAssertEqual(s.workout?.id, "p2", "the next workout does show")}+ func testDiscardedOnTheWatchTellsThePhoneAndStaysGone() {+ var s = SessionCore.applySnapshot(SessionState(), snap(workout("p1", sets: [row(60, 8)])))+ let (d, event) = SessionCore.finish(s, at: 5000, id: "d1", discard: true)+ s = d+ XCTAssertEqual(event?["type"] as? String, "discard")+ XCTAssertEqual(event?["wid"] as? String, "p1")+ s = SessionCore.applySnapshot(s, snap(workout("p1", sets: [row(60, 8)])))+ XCTAssertNil(s.workout, "a snapshot from before the phone dropped it does not bring it back")+ }+func testFinishedOnThePhoneEndsItHere() {var s = SessionCore.applySnapshot(SessionState(), snap(workout("p1", sets: [row(60, 8)])))s = SessionCore.applySnapshot(s, snap(nil))diff --git a/frontend/ios/App/WatchWidgets/ar.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/ar.lproj/Localizable.stringsindex 5340b9876..5896dad27 100644--- a/frontend/ios/App/WatchWidgets/ar.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/ar.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "إنهاء التمرين";"Finish workout?" = "إنهاء التمرين؟";"Finish and save" = "إنهاء وحفظ";+"Discard workout" = "تجاهل التمرين";"Continue workout" = "متابعة التمرين";"Cancel" = "إلغاء";"Rest’s over. Next set!" = "انتهت الراحة. المجموعة التالية!";diff --git a/frontend/ios/App/WatchWidgets/bn.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/bn.lproj/Localizable.stringsindex 8f2cb2b99..06dc02756 100644--- a/frontend/ios/App/WatchWidgets/bn.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/bn.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "ওয়ার্কআউট শেষ করুন";"Finish workout?" = "ওয়ার্কআউট শেষ করবেন?";"Finish and save" = "শেষ করে সেভ করুন";+"Discard workout" = "ওয়ার্কআউট বাদ দিন";"Continue workout" = "ওয়ার্কআউট চালিয়ে যান";"Cancel" = "বাতিল";"Rest’s over. Next set!" = "বিশ্রাম শেষ। পরের সেট!";diff --git a/frontend/ios/App/WatchWidgets/de.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/de.lproj/Localizable.stringsindex 9af39766b..4f90a62ed 100644--- a/frontend/ios/App/WatchWidgets/de.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/de.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Training beenden";"Finish workout?" = "Training beenden?";"Finish and save" = "Beenden und speichern";+"Discard workout" = "Training verwerfen";"Continue workout" = "Weitertrainieren";"Cancel" = "Abbrechen";"Rest’s over. Next set!" = "Pause vorbei. Nächster Satz!";diff --git a/frontend/ios/App/WatchWidgets/en.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/en.lproj/Localizable.stringsindex 4f4e76c16..c601e40ae 100644--- a/frontend/ios/App/WatchWidgets/en.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/en.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Finish workout";"Finish workout?" = "Finish workout?";"Finish and save" = "Finish and save";+"Discard workout" = "Discard workout";"Continue workout" = "Continue workout";"Cancel" = "Cancel";"Rest’s over. Next set!" = "Rest’s over. Next set!";diff --git a/frontend/ios/App/WatchWidgets/es.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/es.lproj/Localizable.stringsindex a09c95d10..b5f2388e3 100644--- a/frontend/ios/App/WatchWidgets/es.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/es.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminar entrenamiento";"Finish workout?" = "¿Terminar entrenamiento?";"Finish and save" = "Terminar y guardar";+"Discard workout" = "Descartar entrenamiento";"Continue workout" = "Continuar entrenamiento";"Cancel" = "Cancelar";"Rest’s over. Next set!" = "Se acabó el descanso. ¡Siguiente serie!";diff --git a/frontend/ios/App/WatchWidgets/fr.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/fr.lproj/Localizable.stringsindex c8da8658d..75c63ef63 100644--- a/frontend/ios/App/WatchWidgets/fr.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/fr.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminer la séance";"Finish workout?" = "Terminer la séance ?";"Finish and save" = "Terminer et enregistrer";+"Discard workout" = "Abandonner la séance";"Continue workout" = "Continuer la séance";"Cancel" = "Annuler";"Rest’s over. Next set!" = "Repos terminé. Série suivante !";diff --git a/frontend/ios/App/WatchWidgets/hi.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/hi.lproj/Localizable.stringsindex 7508c4564..1c11b88f3 100644--- a/frontend/ios/App/WatchWidgets/hi.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/hi.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "वर्कआउट समाप्त करें";"Finish workout?" = "वर्कआउट समाप्त करें?";"Finish and save" = "समाप्त करें और सहेजें";+"Discard workout" = "वर्कआउट छोड़ें";"Continue workout" = "वर्कआउट जारी रखें";"Cancel" = "रद्द करें";"Rest’s over. Next set!" = "आराम खत्म। अगला सेट!";diff --git a/frontend/ios/App/WatchWidgets/hu.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/hu.lproj/Localizable.stringsindex a6a737d1c..6ef2527a1 100644--- a/frontend/ios/App/WatchWidgets/hu.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/hu.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Edzés befejezése";"Finish workout?" = "Befejezed az edzést?";"Finish and save" = "Befejezés és mentés";+"Discard workout" = "Edzés elvetése";"Continue workout" = "Edzés folytatása";"Cancel" = "Mégse";"Rest’s over. Next set!" = "Vége a pihenőnek. Jöhet a következő sorozat!";diff --git a/frontend/ios/App/WatchWidgets/it.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/it.lproj/Localizable.stringsindex f66fd6c57..2c4b7f642 100644--- a/frontend/ios/App/WatchWidgets/it.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/it.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Termina allenamento";"Finish workout?" = "Terminare l’allenamento?";"Finish and save" = "Termina e salva";+"Discard workout" = "Scarta allenamento";"Continue workout" = "Continua allenamento";"Cancel" = "Annulla";"Rest’s over. Next set!" = "Riposo finito. Prossima serie!";diff --git a/frontend/ios/App/WatchWidgets/ko.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/ko.lproj/Localizable.stringsindex d9823d2fb..948ba7619 100644--- a/frontend/ios/App/WatchWidgets/ko.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/ko.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "운동 마치기";"Finish workout?" = "운동을 마칠까요?";"Finish and save" = "마치고 저장";+"Discard workout" = "운동 버리기";"Continue workout" = "운동 계속하기";"Cancel" = "취소";"Rest’s over. Next set!" = "휴식 끝. 다음 세트!";diff --git a/frontend/ios/App/WatchWidgets/pl.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/pl.lproj/Localizable.stringsindex 8d7650769..0fb802bd9 100644--- a/frontend/ios/App/WatchWidgets/pl.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/pl.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Zakończ trening";"Finish workout?" = "Zakończyć trening?";"Finish and save" = "Zakończ i zapisz";+"Discard workout" = "Odrzuć trening";"Continue workout" = "Kontynuuj trening";"Cancel" = "Anuluj";"Rest’s over. Next set!" = "Koniec przerwy. Następna seria!";diff --git a/frontend/ios/App/WatchWidgets/pt-BR.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/pt-BR.lproj/Localizable.stringsindex f65e55c24..4eae452da 100644--- a/frontend/ios/App/WatchWidgets/pt-BR.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/pt-BR.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminar treino";"Finish workout?" = "Terminar o treino?";"Finish and save" = "Terminar e salvar";+"Discard workout" = "Descartar treino";"Continue workout" = "Continuar treino";"Cancel" = "Cancelar";"Rest’s over. Next set!" = "Acabou o descanso. Próxima série!";diff --git a/frontend/ios/App/WatchWidgets/pt-PT.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/pt-PT.lproj/Localizable.stringsindex 78a9d7db9..15eb8d90d 100644--- a/frontend/ios/App/WatchWidgets/pt-PT.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/pt-PT.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Terminar treino";"Finish workout?" = "Terminar o treino?";"Finish and save" = "Terminar e guardar";+"Discard workout" = "Descartar treino";"Continue workout" = "Continuar treino";"Cancel" = "Cancelar";"Rest’s over. Next set!" = "Acabou o descanso. Próxima série!";diff --git a/frontend/ios/App/WatchWidgets/ru.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/ru.lproj/Localizable.stringsindex 42df48dce..635aedc4c 100644--- a/frontend/ios/App/WatchWidgets/ru.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/ru.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Завершить тренировку";"Finish workout?" = "Завершить тренировку?";"Finish and save" = "Завершить и сохранить";+"Discard workout" = "Отменить тренировку";"Continue workout" = "Продолжить тренировку";"Cancel" = "Отмена";"Rest’s over. Next set!" = "Отдых окончен. Следующий подход!";diff --git a/frontend/ios/App/WatchWidgets/th.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/th.lproj/Localizable.stringsindex 5bc0f111d..2eb7e35ae 100644--- a/frontend/ios/App/WatchWidgets/th.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/th.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "จบการออกกำลังกาย";"Finish workout?" = "จบการออกกำลังกายไหม?";"Finish and save" = "จบและบันทึก";+"Discard workout" = "ทิ้งการออกกำลังกายนี้";"Continue workout" = "ออกกำลังกายต่อ";"Cancel" = "ยกเลิก";"Rest’s over. Next set!" = "หมดเวลาพักแล้ว เซ็ตถัดไป!";diff --git a/frontend/ios/App/WatchWidgets/tr.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/tr.lproj/Localizable.stringsindex 33cc8fe2c..1d1daec3b 100644--- a/frontend/ios/App/WatchWidgets/tr.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/tr.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Antrenmanı bitir";"Finish workout?" = "Antrenman bitirilsin mi?";"Finish and save" = "Bitir ve kaydet";+"Discard workout" = "Antrenmanı iptal et";"Continue workout" = "Antrenmana devam et";"Cancel" = "İptal";"Rest’s over. Next set!" = "Dinlenme bitti. Sıradaki set!";diff --git a/frontend/ios/App/WatchWidgets/uk.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/uk.lproj/Localizable.stringsindex 3faf0a963..de0e5caf5 100644--- a/frontend/ios/App/WatchWidgets/uk.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/uk.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "Завершити тренування";"Finish workout?" = "Завершити тренування?";"Finish and save" = "Завершити й зберегти";+"Discard workout" = "Скасувати тренування";"Continue workout" = "Продовжити тренування";"Cancel" = "Скасувати";"Rest’s over. Next set!" = "Відпочинок скінчився. Наступний підхід!";diff --git a/frontend/ios/App/WatchWidgets/zh-Hans.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/zh-Hans.lproj/Localizable.stringsindex 30f633906..6351770db 100644--- a/frontend/ios/App/WatchWidgets/zh-Hans.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/zh-Hans.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "结束训练";"Finish workout?" = "结束训练?";"Finish and save" = "结束并保存";+"Discard workout" = "放弃训练";"Continue workout" = "继续训练";"Cancel" = "取消";"Rest’s over. Next set!" = "休息结束,下一组!";diff --git a/frontend/ios/App/WatchWidgets/zh-Hant.lproj/Localizable.strings b/frontend/ios/App/WatchWidgets/zh-Hant.lproj/Localizable.stringsindex 5d56bf434..82e2306f6 100644--- a/frontend/ios/App/WatchWidgets/zh-Hant.lproj/Localizable.strings+++ b/frontend/ios/App/WatchWidgets/zh-Hant.lproj/Localizable.strings@@ -10,6 +10,7 @@"Finish workout" = "結束訓練";"Finish workout?" = "結束訓練?";"Finish and save" = "結束並儲存";+"Discard workout" = "捨棄本次訓練";"Continue workout" = "繼續訓練";"Cancel" = "取消";"Rest’s over. Next set!" = "休息結束,下一組!";diff --git a/frontend/ios/ci/watch-strings.mjs b/frontend/ios/ci/watch-strings.mjsindex dec1d6cb8..c5d0bc194 100644--- a/frontend/ios/ci/watch-strings.mjs+++ b/frontend/ios/ci/watch-strings.mjs@@ -31,6 +31,7 @@ const FROM_APP = {'Finish workout': 'Finish workout','Finish workout?': 'Finish workout?','Finish and save': 'Finish and save',+ 'Discard workout': 'Discard workout','Continue workout': 'Continue workout','Cancel': 'Cancel','Rest’s over. Next set!': 'Rest’s over. Next set!',diff --git a/frontend/src/lib/watch-sync.js b/frontend/src/lib/watch-sync.jsindex 5c8ada0b6..ab6309417 100644--- a/frontend/src/lib/watch-sync.js+++ b/frontend/src/lib/watch-sync.js@@ -204,7 +204,7 @@ export function clipsFor (S, packs = animPacks().packs || {}) {/* ---------- applying the watch's events ---------- */-let handlers = null // the workout screen's: setDone, finish+let handlers = null // the workout screen's: setDone, finish, discardlet appHandlers = null // the app's: startconst readApplied = () => { try { return JSON.parse(localStorage.getItem(APPLIED_KEY)) || [] } catch { return [] } }const writeApplied = ids => { try { localStorage.setItem(APPLIED_KEY, JSON.stringify(ids.slice(-APPLIED_MAX))) } catch { /* the queue's ack is what counts */ } }@@ -224,6 +224,7 @@ function entryIndexOf (A, ev) {* start { routineIds, wid, at } the app starts that session with the watch's id and start* setDone { wid, exId, entryIdx, setIdx, w, r, at } the workout screen's own tick* finish { wid, at } the workout screen's own Finish and save+ * discard { wid, at } the workout screen's own Discard (confirmed on the watch)* setHr { wid, exId, entryIdx, setIdx, hr?, restHr? } heart rate on a set (lib/heart-rate.js)** A tick for a workout already saved (finished on the phone while the watch was away) is written@@ -291,12 +292,13 @@ export function applyEvents (events, getState) {if (!appHandlers) breakappHandlers.patchSet({ wid: ev.wid, exId: ev.exId, entryIdx: ev.entryIdx, setIdx: ev.setIdx }, fields)}- } else if (ev.type === 'finish' && ours) {+ } else if ((ev.type === 'finish' || ev.type === 'discard') && ours) {if (!handlers) {if (appHandlers?.openWorkout) appHandlers.openWorkout()break}- handlers.finish()+ if (ev.type === 'finish') handlers.finish()+ else handlers.discard?.()}// Applied, or meaningless now (another workout, a set that is gone): either way it is done.applied.push(ev.id)diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex d31714531..3374793c0 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -1553,10 +1553,12 @@ function ActiveWorkout() {// Ending the session without saving it, from the Finish sheet only. It used to end the header ⋯// as a red trash too, right where the exercise ⋯ keeps Remove exercise, and after a hard session// the two got mixed up (#751).+ // Named for the watch first: gone from its snapshot it would look finished, and be saved to Apple Health (#776).+ // The watch's own Discard (confirmed there) runs this too.+ const discardNow = () => { markDiscarded(useStore.getState().S.active?.id); update(s => { s.active = null }); stopRest(); stopWork(); nav('/home') }const discardWorkout = () => confirmSheet({title: t('Discard workout?'), message: t('The sets you logged in this session will be lost.'), confirmText: t('Discard'), danger: true,- // Named for the watch first: gone from its snapshot it would look finished, and be saved to Apple Health (#776).- onConfirm: () => { markDiscarded(useStore.getState().S.active?.id); update(s => { s.active = null }); stopRest(); stopWork(); nav('/home') },+ onConfirm: discardNow,})// The header ⋯, in groups: the settings you change at the gym first (their own sheet, the same// values as Settings), then what to add and what to change about this workout. Nothing in it@@ -1934,6 +1936,7 @@ function ActiveWorkout() {if (at || hr) mutEntry(idx, en => { const set = en.sets[i]; if (!(oneSide ? set?.sides?.[oneSide]?.done : set?.done)) return; if (at) set.at = at; if (hr) set.hr = hr })},finish: () => { if (!useStore.getState().S.active?.editingWorkoutId) finishWorkoutNow() },+ discard: () => { if (!useStore.getState().S.active?.editingWorkoutId) discardNow() },}), [])// The Lock Screen's Done (lib/live-activity.js) ticks its set through this same toggle, as ifdiff --git a/frontend/src/views/Workout.watch.test.jsx b/frontend/src/views/Workout.watch.test.jsxindex b5939baed..b508d45a5 100644--- a/frontend/src/views/Workout.watch.test.jsx+++ b/frontend/src/views/Workout.watch.test.jsx@@ -68,6 +68,14 @@ describe('a set ticked on the watch', () => {expect(S.workouts.at(-1)).toMatchObject({ id: 'w-watch' })expect(S.workouts.at(-1).entries[0].sets[0]).toMatchObject({ w: 60, r: 8, done: true, at })})++ it('the watch\'s Discard drops the workout without saving it', () => {+ const before = useStore.getState().S.workouts.length+ act(() => { applyEvents([{ id: 'x1', type: 'discard', wid: 'w-watch', at: Date.now() }], () => useStore.getState()) })+ const S = useStore.getState().S+ expect(S.active).toBeNull()+ expect(S.workouts.length).toBe(before)+ })})describe('the same set on both sides', () => {