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
feat(health): ask Health Connect for the history permission with weigh-ins, read a year back (#801)
Duarte Santos4e3a5d062002
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 277e573ec..20e7a6e9e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -70,6 +70,10 @@ per muscle. Settings → Workout → Fine-tuning turns it off.other apps brings in your scale's or another app's weigh-ins from the last 30 days. Both areoff until you turn them on, read only while openGym is open, and never overwrite a heart ratethe Apple Watch already logged or a weigh-in you typed.+- **A year of weigh-ins from Health Connect** (Android, idea from #801, thanks @antoni-heredia).+ Turning on Weigh-ins from other apps now also asks for Health Connect's history permission,+ where your phone has it, so your scale's weigh-ins from the last year come in, not just the+ last 30 days. Say no and it reads the 30 days as before.- **Imported weigh-ins stay put.** Weigh-ins you import (an Apple Health export, a Google Healthor Health Connect CSV, Strong, Hevy) are no longer written back to Apple Health or HealthConnect, where they landed a second time. Only weigh-ins you enter in openGym go out.diff --git a/frontend/android/app/src/main/AndroidManifest.xml b/frontend/android/app/src/main/AndroidManifest.xmlindex 873a03a04..fe5ad82cd 100644--- a/frontend/android/app/src/main/AndroidManifest.xml+++ b/frontend/android/app/src/main/AndroidManifest.xml@@ -147,11 +147,14 @@<!-- Health Connect (#200): each asked for only when the user turns its switch on in Settings.openGym writes finished workouts and weigh-ins, and since v1.4.3 can read back the heartrate during a workout and weigh-ins from other apps (#544). Foreground only: no- background or history read permission. -->+ background read permission. The history one (v1.4.4, idea from #801) is asked for+ together with reading weigh-ins, where Health Connect has it, so the first read can go+ further back than the 30 days before the grant; the read works without it too. --><uses-permission android:name="android.permission.health.WRITE_EXERCISE" /><uses-permission android:name="android.permission.health.WRITE_WEIGHT" /><uses-permission android:name="android.permission.health.READ_HEART_RATE" /><uses-permission android:name="android.permission.health.READ_WEIGHT" />+ <uses-permission android:name="android.permission.health.READ_HEALTH_DATA_HISTORY" /><!-- Gym reminder (#614), off until switched on in Settings: where the phone is, for "I'm atthe gym right now" and to watch the gyms the user added with the platform's proximitydiff --git a/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthConnectPlugin.java b/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthConnectPlugin.javaindex 8e7da346f..763bf6879 100644--- a/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthConnectPlugin.java+++ b/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthConnectPlugin.java@@ -6,6 +6,7 @@ import android.os.Build;import androidx.activity.result.ActivityResult;import androidx.activity.result.contract.ActivityResultContract;import androidx.health.connect.client.HealthConnectClient;+import androidx.health.connect.client.HealthConnectFeatures;import androidx.health.connect.client.PermissionController;import androidx.health.connect.client.records.ExerciseSessionRecord;import androidx.health.connect.client.records.HeartRateRecord;@@ -68,8 +69,10 @@ import org.json.JSONObject;* await HC.requestPermissions({ read: ['heartRate'], write: [] }); // { granted, read: { heartRate, weight } }* await HC.readHeartRate({ from, to }); // { samples: [[ms, bpm]], origins: [package] }* await HC.readWeights({ since }); // { records: [{ t, kg, id, origin, clientId }] }- * Foreground only: no READ_HEALTH_DATA_IN_BACKGROUND, no READ_HEALTH_DATA_HISTORY (Health Connect- * then gives 30 days back from the first grant, plenty for the workout just done).+ * Foreground only: no READ_HEALTH_DATA_IN_BACKGROUND. Without READ_HEALTH_DATA_HISTORY Health+ * Connect gives 30 days back from the first grant, plenty for the workout just done; weigh-ins+ * ask for it too (read: ['weight', 'history']) where Health Connect has the feature, which+ * status() says as `history`, so a scale's older weigh-ins come along (idea from #801).*/@CapacitorPlugin(name = "HealthConnect")public class HealthConnectPlugin extends Plugin {@@ -80,6 +83,7 @@ public class HealthConnectPlugin extends Plugin {private static final String WRITE_WEIGHT = "android.permission.health.WRITE_WEIGHT";private static final String READ_HEART_RATE = "android.permission.health.READ_HEART_RATE";private static final String READ_WEIGHT = "android.permission.health.READ_WEIGHT";+ private static final String READ_HISTORY = "android.permission.health.READ_HEALTH_DATA_HISTORY";// Records per page when reading, and pages at most: a few hours of heart rate fit easily.private static final int PAGE = 1000;private static final int MAX_PAGES = 50;@@ -114,6 +118,17 @@ public class HealthConnectPlugin extends Plugin {return HealthConnectClient.Companion.getOrCreate(getContext(), PROVIDER);}+ // Whether this Health Connect knows the history permission at all (newer provider versions+ // only). Asked before it is requested: an unknown permission is not offered in the dialog.+ private boolean historyAvailable() {+ try {+ return client().getFeatures().getFeatureStatus(HealthConnectFeatures.FEATURE_READ_HEALTH_DATA_HISTORY)+ == HealthConnectFeatures.FEATURE_STATUS_AVAILABLE;+ } catch (Exception e) {+ return false;+ }+ }+@SuppressWarnings("unchecked")private Set<String> granted() throws InterruptedException {PermissionController pc = client().getPermissionController();@@ -137,6 +152,7 @@ public class HealthConnectPlugin extends Plugin {Set<String> got = granted();r.put("granted", got.containsAll(permissions()));r.put("read", readState(got));+ r.put("history", historyAvailable());call.resolve(r);} catch (Exception e) {call.reject(e.getMessage(), "failed");@@ -157,6 +173,7 @@ public class HealthConnectPlugin extends Plugin {call.reject(e.getMessage(), "failed");return;}+ if (!historyAvailable()) asked.remove(READ_HISTORY);ActivityResultContract<Set<String>, Set<String>> contract = PermissionController.createRequestPermissionResultContract(PROVIDER);Intent intent = contract.createIntent(getContext(), asked);startActivityForResult(call, intent, "permissionsResult");@@ -341,6 +358,7 @@ public class HealthConnectPlugin extends Plugin {JSObject r = new JSObject();r.put("heartRate", granted.contains(READ_HEART_RATE));r.put("weight", granted.contains(READ_WEIGHT));+ r.put("history", granted.contains(READ_HISTORY));return r;}diff --git a/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthRead.java b/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthRead.javaindex b2fa83696..2d22f2d90 100644--- a/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthRead.java+++ b/frontend/android/app/src/main/java/ch/duartesantos/opengym/HealthRead.java@@ -66,6 +66,8 @@ final class HealthRead {switch (name) {case "heartRate": return "android.permission.health.READ_HEART_RATE";case "weight": return "android.permission.health.READ_WEIGHT";+ // Not a data type: data older than 30 days before the first grant (#801).+ case "history": return "android.permission.health.READ_HEALTH_DATA_HISTORY";default: return null;}}diff --git a/frontend/android/app/src/test/java/ch/duartesantos/opengym/HealthReadTest.java b/frontend/android/app/src/test/java/ch/duartesantos/opengym/HealthReadTest.javaindex acad3aef6..f14c6d4bf 100644--- a/frontend/android/app/src/test/java/ch/duartesantos/opengym/HealthReadTest.java+++ b/frontend/android/app/src/test/java/ch/duartesantos/opengym/HealthReadTest.java@@ -68,6 +68,7 @@ public class HealthReadTest {public void permissionNamesMatchTheManifest() {assertEquals("android.permission.health.READ_HEART_RATE", HealthRead.readPermission("heartRate"));assertEquals("android.permission.health.READ_WEIGHT", HealthRead.readPermission("weight"));+ assertEquals("android.permission.health.READ_HEALTH_DATA_HISTORY", HealthRead.readPermission("history"));assertEquals("android.permission.health.WRITE_EXERCISE", HealthRead.writePermission("exercise"));assertNull(HealthRead.readPermission("steps"));}diff --git a/frontend/src/lib/health-sync.js b/frontend/src/lib/health-sync.jsindex 1a25ddbbd..6ced89403 100644--- a/frontend/src/lib/health-sync.js+++ b/frontend/src/lib/health-sync.js@@ -26,7 +26,7 @@ import { EXIDX } from './exercises.js'import { speedUnitOf } from './speed.js'export const HEALTH_FILE = 'opengym-health.json'-const OFF = { on: false, written: {}, at: 0, error: null, readHr: false, readWeight: false, wCursor: 0, seen: {}, hrTried: {}, readError: null }+const OFF = { on: false, written: {}, at: 0, error: null, readHr: false, readWeight: false, wHistory: false, wCursor: 0, seen: {}, hrTried: {}, readError: null }// Wrapped in an object, as in rest-alert.js: a Capacitor plugin proxy answers `then`, so a// promise resolved with the bare proxy never settles.@@ -227,6 +227,10 @@ const RESUME_EVERY_MS = 2 * 60e3// The first read of weigh-ins goes this far back (what Health Connect gives without the history// permission); later ones from the newest seen, minus a margin for a scale that syncs late.export const WEIGHT_FIRST_MS = 30 * 24 * 3600e3+// With Health Connect's history permission (Android, idea from #801) the first read goes back a+// year instead, so a scale's weigh-ins from before openGym arrive too. Asked for with the weight;+// refused, the read simply stays at 30 days.+export const WEIGHT_HISTORY_MS = 365 * 24 * 3600e3const WEIGHT_MARGIN_MS = 2 * 24 * 3600e3const SEEN_KEEP_MS = 60 * 24 * 3600e3@@ -248,13 +252,16 @@ export async function enableRead(kind, getState, { apply = null } = {}) {const st = await p.HC.status().catch(() => ({ status: 'unsupported' }))if (st.status !== 'available') return { ok: false, reason: st.status }const perm = kind === 'hr' ? 'heartRate' : 'weight'- const res = await p.HC.requestPermissions({ read: [perm], write: [] }).catch(() => null)+ // The history permission only where Health Connect has it (status says so); Apple Health has none.+ const history = kind === 'weight' && p.platform !== 'ios' && st.history === true+ const res = await p.HC.requestPermissions({ read: history ? [perm, 'history'] : [perm], write: [] }).catch(() => null)// Apple Health never says whether reading was allowed (that it was refused is itself private):// `read` is then missing, and a refusal just reads nothing.const ok = res && (res.read ? res.read[perm] !== false : true)if (!ok) return { ok: false, reason: 'denied' }const h = await loadHealth()const out = { ...h, [kind === 'hr' ? 'readHr' : 'readWeight']: true, readError: null }+ if (kind === 'weight') out.wHistory = history && res.read?.history === trueawait saveHealth(out)told(out)if (getState) await readHealth(getState, { force: true, apply }).catch(() => {})@@ -321,9 +328,17 @@ async function readOnce(getState, force, now, applyFn) {}if (h.readWeight && (force ? now - lastWeightRead >= RESUME_EVERY_MS : now - lastWeightRead >= READ_EVERY_MS)) {- const since = h.wCursor > 0 ? Math.max(h.wCursor - WEIGHT_MARGIN_MS, now - WEIGHT_FIRST_MS) : now - WEIGHT_FIRST_MS+ const sinceFor = back => (h.wCursor > 0 ? Math.max(h.wCursor - WEIGHT_MARGIN_MS, now - back) : now - back)try {- const res = await p.HC.readWeights({ since })+ let res+ try {+ res = await p.HC.readWeights({ since: sinceFor(h.wHistory ? WEIGHT_HISTORY_MS : WEIGHT_FIRST_MS) })+ } catch (e) {+ // The history permission taken back in Health Connect's settings: the 30 days still read.+ if (!(h.wHistory && e?.code === 'permission')) throw e+ h.wHistory = false+ res = await p.HC.readWeights({ since: sinceFor(WEIGHT_FIRST_MS) })+ }lastWeightRead = nowconst records = Array.isArray(res?.records) ? res.records : []// The memo is filled in on the copy that decides; the store's update replays the same merge.diff --git a/frontend/src/lib/health-sync.read.test.js b/frontend/src/lib/health-sync.read.test.jsindex 2bce4bf2b..2cf93ec28 100644--- a/frontend/src/lib/health-sync.read.test.js+++ b/frontend/src/lib/health-sync.read.test.js@@ -179,3 +179,66 @@ describe('weigh-ins', () => {expect(S.bodyweight[0].src).toBe('ah')})})++// Idea from #801 (antoni-heredia): Health Connect's history permission lets the first read of+// weigh-ins go further back than the 30 days before the grant.+describe('weigh-ins with the history permission', () => {+ const rec = (dAgo, kg) => ({ t: NOW - dAgo * 24 * 3600e3, kg, id: 'd' + dAgo, origin: 'com.withings.wiscale2', clientId: null })+ const withHistory = async (granted, platform = 'android') => {+ vi.resetModules()+ h.platform = platform+ h.granted = { heartRate: true, weight: true, history: granted }+ const core = await import('@capacitor/core')+ const hc = core.registerPlugin()+ vi.spyOn(core, 'registerPlugin').mockReturnValue({ ...hc, status: async () => ({ status: 'available', granted: false, read: { ...h.granted }, history: true }) })+ hs = await import('./health-sync.js')+ }++ it('asks for it with the weight and then reads a year back', async () => {+ await withHistory(true)+ h.weights = [rec(200, 84), rec(1, 80)]+ await hs.enableRead('weight', getState, { apply })+ expect(h.calls[0]).toEqual(['request', { read: ['weight', 'history'], write: [] }])+ expect(reads('readWeights')[0][1].since).toBe(NOW - 365 * 24 * 3600e3)+ expect(S.bodyweight.map(b => b.w)).toEqual([84, 80])+ expect(file().wHistory).toBe(true)+ })++ it('refused, it still reads the 30 days', async () => {+ await withHistory(false)+ h.weights = [rec(200, 84), rec(1, 80)]+ expect((await hs.enableRead('weight', getState, { apply })).ok).toBe(true)+ expect(reads('readWeights')[0][1].since).toBe(NOW - 30 * 24 * 3600e3)+ expect(S.bodyweight.map(b => b.w)).toEqual([80])+ expect(file().wHistory).toBe(false)+ })++ it('taken back later, the read falls back to 30 days instead of failing', async () => {+ await withHistory(true)+ await hs.enableRead('weight', getState, { apply })+ h.calls = []+ const core = await import('@capacitor/core')+ const plugin = core.registerPlugin()+ let first = true+ const readWeights = plugin.readWeights+ plugin.readWeights = async arg => {+ if (first) { first = false; h.calls.push(['readWeights', arg]); throw Object.assign(new Error('no'), { code: 'permission' }) }+ return readWeights(arg)+ }+ h.weights = [rec(1, 79.5)]+ await hs.readHealth(getState, { force: true, now: NOW + 3 * 60e3, apply })+ expect(reads('readWeights').map(c => c[1].since)).toEqual([NOW + 3 * 60e3 - 365 * 24 * 3600e3, NOW + 3 * 60e3 - 30 * 24 * 3600e3])+ expect(file().wHistory).toBe(false)+ expect(file().readError).toBe(null)+ })++ it('heart rate and the iPhone never ask for it', async () => {+ await withHistory(true)+ await hs.enableRead('hr', getState, { apply })+ expect(h.calls[0]).toEqual(['request', { read: ['heartRate'], write: [] }])+ await withHistory(true, 'ios')+ h.calls = []+ await hs.enableRead('weight', getState, { apply })+ expect(h.calls[0]).toEqual(['request', { read: ['weight'], write: [] }])+ })+})diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex ccb3e133e..c6ed76428 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -2617,4 +2617,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'تبقى تمارين الدمبل خارج المكتبة والمنتقي وخطط المدرب.','Everything but dumbbells': 'كل شيء ما عدا الدمبلز','None, so dumbbell lifts stay hidden.': 'لا شيء، لذا تبقى تمارين الدمبل مخفية.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'يقرأ openGym فقط وهو مفتوح: نبض القلب لتمارين آخر يوم، وقياسات الوزن لآخر سنة. تبقى التمارين الأقدم كما هي.',}diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.jsindex 2d3fc41dc..e6a19aed8 100644--- a/frontend/src/locales/bn.js+++ b/frontend/src/locales/bn.js@@ -2641,4 +2641,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'ডাম্বেলের ব্যায়াম লাইব্রেরি, পিকার আর কোচের প্ল্যানের বাইরে থাকবে।','Everything but dumbbells': 'ডাম্বেল ছাড়া সবকিছু','None, so dumbbell lifts stay hidden.': 'একটাও নেই, তাই ডাম্বেলের ব্যায়াম লুকানো থাকবে।',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym শুধু খোলা থাকলেই পড়ে: শেষ এক দিনের ওয়ার্কআউটের হার্ট রেট, শেষ এক বছরের ওজন। পুরোনো ওয়ার্কআউট যেমন আছে তেমনই থাকে।',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex c565e0a9d..e50b6d3c2 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -2582,4 +2582,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Kurzhantelübungen bleiben aus der Bibliothek, der Auswahl und den Plänen des Coachs draußen.','Everything but dumbbells': 'Alles außer Kurzhanteln','None, so dumbbell lifts stay hidden.': 'Keine, also bleiben Kurzhantelübungen ausgeblendet.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym liest nur, solange es offen ist: Puls für Trainings vom letzten Tag, Wiegungen des letzten Jahres. Ältere Trainings bleiben, wie sie sind.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex e593a1d8c..4cfe79d16 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Los ejercicios con mancuernas no aparecen en la biblioteca, el selector ni los planes del Coach.','Everything but dumbbells': 'Todo menos mancuernas','None, so dumbbell lifts stay hidden.': 'Ninguna, así que los ejercicios con mancuernas quedan ocultos.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym solo lee mientras está abierto: pulso de los entrenos del último día, pesajes del último año. Los entrenos anteriores se quedan como están.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex ba106f131..575f4f717 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Les exercices aux haltères restent hors de la bibliothèque, du sélecteur et des plans du Coach.','Everything but dumbbells': 'Tout sauf les haltères','None, so dumbbell lifts stay hidden.': 'Aucun, donc les exercices aux haltères restent cachés.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym ne lit que lorsqu’il est ouvert : fréquence cardiaque des séances du dernier jour, pesées de la dernière année. Les séances plus anciennes restent telles quelles.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 24220864c..083eafbeb 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'डंबल वाली एक्सरसाइज़ लाइब्रेरी, पिकर और कोच के प्लान से बाहर रहेंगी।','Everything but dumbbells': 'डंबल के अलावा सब कुछ','None, so dumbbell lifts stay hidden.': 'कोई नहीं, इसलिए डंबल वाली एक्सरसाइज़ छिपी रहेंगी।',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym सिर्फ़ तब पढ़ता है जब वह खुला हो: पिछले एक दिन के वर्कआउट की धड़कन, पिछले एक साल का वज़न। पुराने वर्कआउट जैसे हैं वैसे ही रहते हैं।',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 9750ef8fe..fe96c9f79 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -2565,4 +2565,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'A kézisúlyzós gyakorlatok kimaradnak a könyvtárból, a választóból és az Edző terveiből.','Everything but dumbbells': 'Minden, kivéve a kézisúlyzót','None, so dumbbell lifts stay hidden.': 'Nincs, így a kézisúlyzós gyakorlatok rejtve maradnak.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'Az openGym csak nyitott állapotban olvas: az utolsó nap edzéseinek pulzusát és az utolsó egy év mérlegeléseit. A régebbi edzések maradnak, ahogy vannak.',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex d5d3a90fa..6e643b379 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Gli esercizi con manubri restano fuori da libreria, selettore e piani del Coach.','Everything but dumbbells': 'Tutto tranne i manubri','None, so dumbbell lifts stay hidden.': 'Nessuno, quindi gli esercizi con manubri restano nascosti.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym legge solo mentre è aperto: battito degli allenamenti dell’ultimo giorno, pesate dell’ultimo anno. Gli allenamenti più vecchi restano come sono.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 1906ec946..e769dd254 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': '덤벨 운동은 라이브러리, 선택 목록, 코치의 계획에서 빠져요.','Everything but dumbbells': '덤벨 빼고 전부','None, so dumbbell lifts stay hidden.': '없음, 그래서 덤벨 운동은 숨겨져요.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym은 열려 있을 때만 읽어요: 최근 하루 동안의 운동 심박수와 최근 1년의 체중 기록. 그보다 오래된 운동은 그대로 둬요.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 6285c4031..2ac98053c 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Ćwiczenia z hantlami znikają z biblioteki, wyboru i planów Trenera.','Everything but dumbbells': 'Wszystko oprócz hantli','None, so dumbbell lifts stay hidden.': 'Brak, więc ćwiczenia z hantlami są ukryte.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym czyta tylko, gdy jest otwarty: tętno z treningów z ostatniej doby, pomiary wagi z ostatniego roku. Starsze treningi zostają bez zmian.',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex aaead2a41..dbb038cbb 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1655,6 +1655,7 @@ export const PT_BR_OVERRIDES = {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Os exercícios com halteres ficam fora da biblioteca, do seletor e dos planos do Coach.','Everything but dumbbells': 'Tudo menos halteres','None, so dumbbell lifts stay hidden.': 'Nenhum, então os exercícios com halteres ficam escondidos.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'O openGym só lê enquanto está aberto: frequência cardíaca dos treinos do último dia, pesagens do último ano. Os treinos mais antigos ficam como estão.',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 81ae74286..1d78e0ab1 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Os exercícios com halteres ficam fora da biblioteca, do seletor e dos planos do Coach.','Everything but dumbbells': 'Tudo menos halteres','None, so dumbbell lifts stay hidden.': 'Nenhum, por isso os exercícios com halteres ficam escondidos.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'O openGym só lê enquanto está aberto: frequência cardíaca dos treinos do último dia, pesagens do último ano. Os treinos mais antigos ficam como estão.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex feee66f17..f82dbc62a 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -2566,4 +2566,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Упражнения с гантелями не попадут в библиотеку, выбор и планы Тренера.','Everything but dumbbells': 'Всё, кроме гантелей','None, so dumbbell lifts stay hidden.': 'Нет, поэтому упражнения с гантелями скрыты.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym читает данные, только пока открыт: пульс тренировок за последние сутки, взвешивания за последний год. Старые тренировки остаются как есть.',}diff --git a/frontend/src/locales/sv.js b/frontend/src/locales/sv.jsindex 7b7b2e92a..204f2eb21 100644--- a/frontend/src/locales/sv.js+++ b/frontend/src/locales/sv.js@@ -2609,4 +2609,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Hantelövningar hålls borta från biblioteket, väljaren och Coachens planer.','Everything but dumbbells': 'Allt utom hantlar','None, so dumbbell lifts stay hidden.': 'Inga, så hantelövningar förblir dolda.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym läser bara medan appen är öppen: puls för pass från det senaste dygnet, vägningar från det senaste året. Äldre pass förblir som de är.',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 293aa5115..e15e49a14 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -2573,4 +2573,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'ท่าที่ใช้ดัมเบลจะไม่อยู่ในคลัง ตัวเลือก และแผนของโค้ช','Everything but dumbbells': 'ทุกอย่างยกเว้นดัมเบล','None, so dumbbell lifts stay hidden.': 'ไม่มี ท่าที่ใช้ดัมเบลจึงถูกซ่อนไว้',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym อ่านเฉพาะตอนที่เปิดอยู่: อัตราการเต้นของหัวใจของการฝึกในวันล่าสุด และน้ำหนักในหนึ่งปีล่าสุด การฝึกที่เก่ากว่านั้นจะเหมือนเดิม',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 9b9a1fe9d..35b021214 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Dambıl hareketleri kütüphanede, seçicide ve Koçun planlarında yer almaz.','Everything but dumbbells': 'Dambıl hariç her şey','None, so dumbbell lifts stay hidden.': 'Yok, bu yüzden dambıl hareketleri gizli kalır.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym yalnızca açıkken okur: son bir günün antrenmanları için nabız, son bir yılın tartılmaları. Daha eski antrenmanlar olduğu gibi kalır.',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex 8f9d4efbe..df7e8d842 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -2559,4 +2559,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': 'Вправи з гантелями не потраплять у бібліотеку, вибір і плани Тренера.','Everything but dumbbells': 'Усе, крім гантелей','None, so dumbbell lifts stay hidden.': 'Немає, тож вправи з гантелями приховані.',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym читає дані, лише поки відкритий: пульс тренувань за останню добу, зважування за останній рік. Старіші тренування лишаються як є.',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex d05f7475b..91dff9445 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -2555,4 +2555,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': '啞鈴動作不會出現在動作庫、選擇器和教練的計畫裡。','Everything but dumbbells': '除啞鈴外的全部','None, so dumbbell lifts stay hidden.': '沒有,所以啞鈴動作會隱藏。',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym 只在開啟時讀取:最近一天訓練的心率,最近一年的體重紀錄。更早的訓練維持不變。',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex c35297756..7d0c2dd8c 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -2562,4 +2562,5 @@ export default {'Dumbbell lifts stay out of the library, the picker and the Coach’s plans.': '哑铃动作不会出现在动作库、选择器和教练的计划里。','Everything but dumbbells': '除哑铃外的全部','None, so dumbbell lifts stay hidden.': '没有,所以哑铃动作会隐藏。',+ 'openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.': 'openGym 只在打开时读取:最近一天训练的心率,最近一年的称重。更早的训练保持不变。',}diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex 1e3eab13e..239984232 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -1651,7 +1651,7 @@ function HealthConnectCard({ S, toast, android }) {return (<Section title={c.section}- footer={[h.on && c.footer, reading && t('openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last 30 days. Older workouts stay as they are.')].filter(Boolean).join(' ') || null}>+ footer={[h.on && c.footer, reading && (h.readWeight && h.wHistory ? t('openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last year. Older workouts stay as they are.') : t('openGym reads only while it is open: heart rate for workouts of the last day, weigh-ins of the last 30 days. Older workouts stay as they are.'))].filter(Boolean).join(' ') || null}><Row icon="heart" iconTint="var(--red)" title={c.write}subtitle={t('Finished workouts and weigh-ins, from this phone only.')}><Switch checked={!!h.on} disabled={busy} onChange={v => (v ? turnOn() : askOff())} />