Skip to content

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.

Settings and docs: say what the background check does, and that the phone decides when

Duarte Santos6cf2bd8fdf5d
diff --git a/docs/MOBILE.md b/docs/MOBILE.md
index 6d2c80012..e5b72a1ff 100644
--- a/docs/MOBILE.md
+++ b/docs/MOBILE.md
@@ -351,7 +351,19 @@ membership, the distribution certificate and profile as protected file variables
alarms (Android 14 no longer grants it at install). The opt-in missed-workout nudge is
scheduled the same way, beside the reminder: one notification on the evening (20:00–21:30) of
each upcoming planned day, at most 3 past the last workout, rescheduled whenever a workout is
- logged. The rest countdown does not depend on
+ logged. A workout logged on another device (the web, a second phone) reaches these only when
+ the app syncs, so a paired phone also runs a **background check** before them
+ (`lib/nudge-check.js`, the native `NudgeCheck` plugin): it asks the server
+ `GET /api/nudge-check?date=…` (a few bytes: was the day trained or excused, would the server
+ still nudge it) and takes back that day's reminder and nudge when the answer says so. Offline,
+ an error or no answer leaves everything as it was, and the app resyncs in full whenever it is
+ opened. On Android a `JobScheduler` job runs in the half hour before the notification, with a
+ network if there is one. On iOS it is a `BGAppRefreshTask` asked for an hour before, and
+ **iOS decides when it actually runs**: it learns from how often the app is opened, holds back
+ in Low Power Mode, and never runs it after the app was swiped away from the app switcher or
+ with Background App Refresh off, so there the check is a good chance, not a promise. The
+ pairing token it needs is kept in the Keychain (iOS) or encrypted with a Keystore key (Android).
+ The rest countdown does not depend on
it: a foreground service (`specialUse`) keeps the countdown in the notification and holds a
wake lock until the end, so the end of a rest sounds on time with the screen locked; the
rest-over alarm is only its fallback.
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 64bcfb9f2..8a23f95d5 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1861,6 +1861,7 @@ export default {
'Guilt trip': 'تأنيب الضمير',
'Drill sergeant': 'رقيب التدريب',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'تنبيه واحد مساء يوم مخطط لم يُسجَّل فيه شيء، بين 20:00 و21:30. بعد 3 أيام فائتة متتالية يصمت حتى تمرينك التالي.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'سجّلت تمرينًا على جهاز آخر؟ قبل التنبيه يتحقق الهاتف من خادمك، متى سمح للتطبيق بالعمل في الخلفية. فتح التطبيق يحدّث كل شيء دائمًا.',
'Everything okay?': 'هل كل شيء على ما يرام؟',
'{0} is still waiting. What’s up?': '{0} ما زال ينتظرك. ما الأمر؟',
'No {0} today? Even a short session tomorrow counts.': 'لا {0} اليوم؟ حتى جلسة قصيرة غدًا تُحسب.',
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 2aeac828d..73c476291 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -1850,6 +1850,7 @@ export default {
'Guilt trip': 'অপরাধবোধ জাগানো',
'Drill sergeant': 'ড্রিল সার্জেন্ট',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'পরিকল্পিত দিনে কিছু লগ না হলে সন্ধ্যায় 20:00 থেকে 21:30-এর মধ্যে একবার মনে করানো হয়। টানা 3 দিন বাদ গেলে আপনার পরের ওয়ার্কআউট পর্যন্ত চুপ থাকে।',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'অন্য ডিভাইসে ওয়ার্কআউট লিখেছেন? মনে করানোর আগে ফোন আপনার সার্ভারে যাচাই করে, যখনই সে অ্যাপকে ব্যাকগ্রাউন্ডে চলতে দেয়। অ্যাপ খুললে সবসময় সব আপডেট হয়ে যায়।',
'Everything okay?': 'সব ঠিক আছে তো?',
'{0} is still waiting. What’s up?': '{0} এখনও অপেক্ষা করছে। কী হলো?',
'No {0} today? Even a short session tomorrow counts.': 'আজ {0} হলো না? কাল ছোট একটা সেশনও কাজে দেবে।',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 6c1d20739..3300d3dfd 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1829,6 +1829,7 @@ export default {
'Guilt trip': 'Schlechtes Gewissen',
'Drill sergeant': 'Drill-Sergeant',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Ein Stups am Abend eines geplanten Tages ohne Eintrag, zwischen 20:00 und 21:30. Nach 3 verpassten Tagen in Folge ist Ruhe bis zu deinem nächsten Training.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Auf einem anderen Gerät trainiert? Bevor der Stups kommt, fragt das Handy bei deinem Server nach, sofern es die App im Hintergrund laufen lässt. Beim Öffnen der App ist sowieso alles wieder aktuell.',
'Everything okay?': 'Alles okay?',
'{0} is still waiting. What’s up?': '{0} wartet noch auf dich. Was ist los?',
'No {0} today? Even a short session tomorrow counts.': 'Heute kein {0}? Auch eine kurze Einheit morgen zählt.',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 739db5d55..c0e9b0682 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Chantaje emocional',
'Drill sergeant': 'Sargento instructor',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Un aviso por la noche de un día planificado sin nada registrado, entre las 20:00 y las 21:30. Tras 3 días seguidos sin entrenar, se calla hasta tu próximo entrenamiento.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': '¿Entrenaste en otro dispositivo? Antes del aviso, el teléfono consulta a tu servidor siempre que deje a la app funcionar en segundo plano. Al abrir la app, todo se pone al día.',
'Everything okay?': '¿Todo bien?',
'{0} is still waiting. What’s up?': '{0} sigue esperando. ¿Qué pasa?',
'No {0} today? Even a short session tomorrow counts.': '¿Hoy no hubo {0}? Mañana, hasta una sesión corta cuenta.',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index febb6c23f..3a72230da 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Culpabilisant',
'Drill sergeant': 'Sergent instructeur',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Une relance le soir d’un jour prévu sans séance enregistrée, entre 20:00 et 21:30. Après 3 jours manqués d’affilée, elle se tait jusqu’à ta prochaine séance.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Séance notée sur un autre appareil ? Avant la relance, le téléphone vérifie auprès de ton serveur, quand il laisse l’app tourner en arrière-plan. Ouvrir l’app remet toujours tout à jour.',
'Everything okay?': 'Tout va bien ?',
'{0} is still waiting. What’s up?': '{0} t’attend toujours. Que se passe-t-il ?',
'No {0} today? Even a short session tomorrow counts.': 'Pas de {0} aujourd’hui ? Même une courte séance demain compte.',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 83a21171f..604abd9dd 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'भावुक ताना',
'Drill sergeant': 'ड्रिल सार्जेंट',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'प्लान किए गए दिन, जब कुछ दर्ज न हो, शाम 20:00 से 21:30 के बीच एक संदेश। लगातार 3 दिन छूटने के बाद यह आपके अगले वर्कआउट तक चुप रहता है।',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'किसी दूसरे डिवाइस पर वर्कआउट दर्ज किया? संदेश भेजने से पहले फ़ोन आपके सर्वर से जाँच करता है, जब भी वह ऐप को बैकग्राउंड में चलने देता है। ऐप खोलते ही सब हमेशा अपडेट हो जाता है।',
'Everything okay?': 'सब ठीक है?',
'{0} is still waiting. What’s up?': '{0} अब भी इंतज़ार कर रहा है। क्या हुआ?',
'No {0} today? Even a short session tomorrow counts.': 'आज {0} नहीं हुआ? कल एक छोटा सेशन भी गिना जाएगा।',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 4ac114a5b..05e29ded6 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Lelkiismeret-furdalás',
'Drill sergeant': 'Kiképző őrmester',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Egy bökés egy tervezett nap estéjén, ha nincs rögzítve semmi, 20:00 és 21:30 között. 3 egymás után kihagyott nap után elhallgat a következő edzésedig.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Másik eszközön edzettél? A bökés előtt a telefon rákérdez a szerveredre, ha engedi az appnak, hogy a háttérben fusson. Az app megnyitásakor minden mindig frissül.',
'Everything okay?': 'Minden rendben?',
'{0} is still waiting. What’s up?': 'A(z) {0} még mindig vár. Mi a helyzet?',
'No {0} today? Even a short session tomorrow counts.': 'Ma nem volt {0}? Holnap egy rövid edzés is számít.',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 9bb817ead..8a4707b1c 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Senso di colpa',
'Drill sergeant': 'Sergente istruttore',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Un avviso la sera di un giorno pianificato senza niente registrato, tra le 20:00 e le 21:30. Dopo 3 giorni saltati di fila tace fino al tuo prossimo allenamento.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Allenamento registrato su un altro dispositivo? Prima dell’avviso il telefono chiede al tuo server, quando lascia girare l’app in background. Aprire l’app aggiorna sempre tutto.',
'Everything okay?': 'Tutto bene?',
'{0} is still waiting. What’s up?': '{0} ti sta ancora aspettando. Che succede?',
'No {0} today? Even a short session tomorrow counts.': 'Niente {0} oggi? Anche una sessione breve domani conta.',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 84a89edbc..062e36738 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': '죄책감 자극',
'Drill sergeant': '훈련 교관',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': '계획된 날에 기록이 없으면 저녁 20:00~21:30 사이에 한 번 알려 드립니다. 3일 연속으로 건너뛰면 다음 운동까지 조용히 있습니다.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': '다른 기기에서 운동을 기록했나요? 휴대폰이 앱을 백그라운드에서 실행하게 해 주면, 알림을 보내기 전에 서버에 확인해요. 앱을 열면 언제나 최신 상태가 돼요.',
'Everything okay?': '괜찮으세요?',
'{0} is still waiting. What’s up?': '{0}이(가) 아직 기다리고 있어요. 무슨 일 있어요?',
'No {0} today? Even a short session tomorrow counts.': '오늘은 {0} 안 했나요? 내일은 짧게라도 하면 돼요.',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 48f45ecb7..ee0105f57 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Wyrzuty sumienia',
'Drill sergeant': 'Sierżant musztry',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Jedno szturchnięcie wieczorem w zaplanowany dzień bez zapisanego treningu, między 20:00 a 21:30. Po 3 opuszczonych dniach z rzędu milknie aż do twojego następnego treningu.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Trening zapisany na innym urządzeniu? Przed szturchnięciem telefon sprawdza to na Twoim serwerze, o ile pozwala aplikacji działać w tle. Otwarcie aplikacji zawsze wszystko aktualizuje.',
'Everything okay?': 'Wszystko w porządku?',
'{0} is still waiting. What’s up?': 'Trening „{0}” wciąż czeka. Co się dzieje?',
'No {0} today? Even a short session tomorrow counts.': 'Dziś bez treningu „{0}”? Jutro nawet krótka sesja się liczy.',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 8d92b5144..4cef90e58 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1444,6 +1444,8 @@ export const PT_BR_OVERRIDES = {
'Not confirmed on this phone. Nothing was deleted.': 'Não foi confirmado neste celular. Nada foi excluído.',
'This phone has no screen lock, so the name you typed is the only check.': 'Este celular não tem bloqueio de tela, então o nome que você digitou é a única verificação.',
'Your phone checks that it’s you (face, fingerprint or passcode), then the account is deleted.': 'Seu celular confirma que é você (rosto, digital ou senha) e depois a conta é excluída.',
+ // --- background check before the nudge ---
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Registrou um treino em outro dispositivo? Antes do aviso, o celular confirma com o seu servidor, sempre que deixar o aplicativo rodar em segundo plano. Abrir o aplicativo sempre deixa tudo em dia.',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 17fdcf599..d60825f87 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Chantagem emocional',
'Drill sergeant': 'Sargento instrutor',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Um aviso à noite num dia planeado sem nada registado, entre as 20:00 e as 21:30. Depois de 3 dias falhados seguidos fica calado até ao teu próximo treino.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Registaste um treino noutro dispositivo? Antes do aviso, o telemóvel confirma com o teu servidor, sempre que deixa a app correr em segundo plano. Abrir a app põe sempre tudo em dia.',
'Everything okay?': 'Está tudo bem?',
'{0} is still waiting. What’s up?': '{0} ainda está à tua espera. Então?',
'No {0} today? Even a short session tomorrow counts.': 'Hoje não houve {0}? Amanhã até um treino curto conta.',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index df09aebac..22db7d681 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1813,6 +1813,7 @@ export default {
'Guilt trip': 'Давить на совесть',
'Drill sergeant': 'Сержант-инструктор',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Одно напоминание вечером запланированного дня без записанной тренировки, с 20:00 до 21:30. После 3 пропущенных дней подряд оно замолкает до вашей следующей тренировки.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Записали тренировку на другом устройстве? Перед напоминанием телефон сверяется с вашим сервером, если разрешает приложению работать в фоне. При открытии приложения всё обновляется в любом случае.',
'Everything okay?': 'Всё в порядке?',
'{0} is still waiting. What’s up?': 'Тренировка «{0}» всё ещё ждёт. Что случилось?',
'No {0} today? Even a short session tomorrow counts.': 'Сегодня без тренировки «{0}»? Завтра засчитается даже короткая.',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 1428faafd..df335f396 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1817,6 +1817,7 @@ export default {
'Guilt trip': 'ทำให้รู้สึกผิด',
'Drill sergeant': 'ครูฝึกทหาร',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'สะกิดหนึ่งครั้งในตอนเย็นของวันที่วางแผนไว้แต่ยังไม่มีการบันทึก ระหว่าง 20:00 ถึง 21:30 หลังพลาดติดกัน 3 วันจะเงียบไปจนกว่าคุณจะออกกำลังกายครั้งถัดไป',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'บันทึกการออกกำลังกายบนอุปกรณ์อื่นแล้วใช่ไหม ก่อนส่งการสะกิด โทรศัพท์จะเช็กกับเซิร์ฟเวอร์ของคุณ เมื่อใดที่ระบบยอมให้แอปทำงานเบื้องหลัง เปิดแอปเมื่อไหร่ก็อัปเดตครบทุกครั้ง',
'Everything okay?': 'ทุกอย่างโอเคไหม?',
'{0} is still waiting. What’s up?': '{0} ยังรอคุณอยู่นะ เป็นอะไรหรือเปล่า?',
'No {0} today? Even a short session tomorrow counts.': 'วันนี้ไม่มี {0} เหรอ? พรุ่งนี้แค่เล่นสั้นๆ ก็นับแล้ว',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index b551a763a..d71501c34 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': 'Vicdan azabı',
'Drill sergeant': 'Eğitim çavuşu',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Kayıt girilmemiş planlı bir günün akşamında, 20:00 ile 21:30 arasında tek bir dürtme. Üst üste 3 kaçırılan günden sonra bir sonraki antrenmanına kadar sessiz kalır.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Başka bir cihazda antrenman mı kaydettin? Dürtme gelmeden önce telefon, uygulamanın arka planda çalışmasına izin verdiği sürece sunucuna sorar. Uygulamayı açınca her şey zaten güncellenir.',
'Everything okay?': 'Her şey yolunda mı?',
'{0} is still waiting. What’s up?': '{0} hâlâ seni bekliyor. Ne oldu?',
'No {0} today? Even a short session tomorrow counts.': 'Bugün {0} yok mu? Yarın kısa bir seans bile sayılır.',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 90c149fe0..430b749e3 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1803,6 +1803,7 @@ export default {
'Guilt trip': 'Тиснути на совість',
'Drill sergeant': 'Сержант-інструктор',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': 'Одне нагадування ввечері запланованого дня без записаного тренування, з 20:00 до 21:30. Після 3 пропущених днів поспіль воно замовкає до твого наступного тренування.',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Записали тренування на іншому пристрої? Перед нагадуванням телефон звіряється з вашим сервером, якщо дозволяє застосунку працювати у фоні. Під час відкриття застосунку все оновлюється в будь-якому разі.',
'Everything okay?': 'Усе гаразд?',
'{0} is still waiting. What’s up?': 'Тренування «{0}» досі чекає. Що сталося?',
'No {0} today? Even a short session tomorrow counts.': 'Сьогодні без тренування «{0}»? Завтра зарахується навіть коротке.',
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index d705365ab..041d4a523 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1799,6 +1799,7 @@ export default {
'Guilt trip': '情感勒索',
'Drill sergeant': '魔鬼教官',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': '在排定訓練的日子沒有紀錄時,於晚上 20:00 到 21:30 之間提醒一次。連續錯過 3 天後會保持安靜,直到你下次訓練。',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': '在其他裝置上記錄了訓練?在送出提醒之前,只要手機允許 App 在背景執行,它就會先向你的伺服器確認。開啟 App 時總會同步到最新。',
'Everything okay?': '一切還好嗎?',
'{0} is still waiting. What’s up?': '{0} 還在等你。怎麼了?',
'No {0} today? Even a short session tomorrow counts.': '今天沒練 {0}?明天就算練一下下也算數。',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index a078b13a8..79406e7aa 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1809,6 +1809,7 @@ export default {
'Guilt trip': '情感攻势',
'Drill sergeant': '魔鬼教官',
'One nudge in the evening of a planned day with nothing logged, between 20:00 and 21:30. After 3 missed days in a row it goes quiet until your next workout.': '在计划训练日没有记录时,于晚上 20:00 到 21:30 之间提醒一次。连续错过 3 天后会保持安静,直到你下次训练。',
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': '在其他设备上记录了训练?在发出提醒之前,只要手机允许应用在后台运行,它就会先向你的服务器确认。打开应用时总会同步到最新。',
'Everything okay?': '一切还好吗?',
'{0} is still waiting. What’s up?': '{0}还在等你。怎么了?',
'No {0} today? Even a short session tomorrow counts.': '今天没练{0}?明天哪怕练一小会儿也算数。',
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index e9beafb5c..122152ddf 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -1087,6 +1087,9 @@ function NotificationsCard({ S, update, toast }) {
// no push server involved. The schedule itself is (re)synced by the store on every persist;
// this card only owns the OS permission prompt when the switch turns on.
function MobileReminderCard({ S, update, toast }) {
+ // A paired phone checks with the server before a nudge (lib/nudge-check.js); the footer says
+ // so, and that the phone decides when.
+ const paired = useStore(s => !!s.user)
const setReminder = patch => update(s => { s.reminder = { ...(s.reminder || DEF.reminder), ...patch, tz: localTZ() } })
const toggle = async () => {
const on = !S.reminder?.on
@@ -1098,7 +1101,7 @@ function MobileReminderCard({ S, update, toast }) {
}
return (
<Section title={t('Notifications')}
- footer={S.reminder?.on ? t('Reminds you at this time on days that have a routine planned.') + nudgeNote(S) : null}>
+ footer={S.reminder?.on ? t('Reminds you at this time on days that have a routine planned.') + nudgeNote(S) + (paired && S.reminder?.nudge ? ' ' + t('Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.') : '') : null}>
<Row icon="calendar" iconTint="var(--orange)" title={t('Workout day reminder')}>
<Switch checked={!!S.reminder?.on} onChange={toggle} />
</Row>
diff --git a/frontend/src/views/Settings.nudge.test.jsx b/frontend/src/views/Settings.nudge.test.jsx
index 8cf0b3be1..e9410a139 100644
--- a/frontend/src/views/Settings.nudge.test.jsx
+++ b/frontend/src/views/Settings.nudge.test.jsx
@@ -11,10 +11,10 @@ globalThis.IS_REACT_ACT_ENVIRONMENT = true
// switch, and once it is on, a tone. Both the self-hosted card (web push) and the mobile card
// (native notifications) carry it, and only while the reminder itself is on.
const mocks = vi.hoisted(() => {
- const state = { S: null, MOBILE: false }
+ const state = { S: null, MOBILE: false, user: { id: 'u1', name: 'One' } }
state.snapshot = () => ({
S: state.S,
- user: { id: 'u1', name: 'One' },
+ user: state.user,
update: mut => {
const next = structuredClone(state.S)
mut(next)
@@ -64,6 +64,7 @@ let host, root
beforeEach(() => {
sheet = null
mocks.MOBILE = false
+ mocks.user = { id: 'u1', name: 'One' }
mocks.S = {
unit: 'kg', restSec: 90, restPauseSec: 15, sound: false, effort: 'none',
gifSize: 'full', workouts: [], routines: [], exWeights: {},
@@ -134,3 +135,26 @@ describe.each([['self-hosted (web push)', false], ['mobile (native)', true]])('S
expect(nudgeRow()).toBeFalsy()
})
})
+
+// A paired phone checks with the server before the nudge (lib/nudge-check.js): the footer says
+// so, and that the phone decides when. A phone kept local has no server to ask.
+describe('Settings — the background check before the nudge (mobile)', () => {
+ const NOTE = 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background.'
+ beforeEach(() => { mocks.MOBILE = true })
+
+ it('is said on a paired phone with the nudge on', async () => {
+ mocks.S.reminder = { on: true, time: '08:00', nudge: true }
+ await mount()
+ expect(host.textContent).toContain(NOTE)
+ })
+
+ it('is not said with the nudge off, or on a phone kept local', async () => {
+ mocks.S.reminder = { on: true, time: '08:00', nudge: false }
+ await mount()
+ expect(host.textContent).not.toContain(NOTE)
+ mocks.S.reminder = { on: true, time: '08:00', nudge: true }
+ mocks.user = null
+ await mount()
+ expect(host.textContent).not.toContain(NOTE)
+ })
+})