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.

Apple Health on the iPhone: the Health Connect switch for iOS, and a first-start step for it

Duarte Santos7529d8ccb2f5
diff --git a/frontend/src/lib/health-sync.js b/frontend/src/lib/health-sync.js
index 530c7775a..895034597 100644
--- a/frontend/src/lib/health-sync.js
+++ b/frontend/src/lib/health-sync.js
@@ -6,8 +6,13 @@
// data directory, never in S, so it does not sync to a server, ride in a backup, or switch on a
// second phone. Off until the user turns it on; nothing is asked of Health Connect before that.
//
-// The web build never gets here (MOBILE is a build-time flag), and iOS answers 'unsupported'.
-import { MOBILE, isAndroid, readJsonFile, writeJsonFile } from './mobile.js'
+// The iPhone app does the same with Apple Health (AppleHealthPlugin.swift): the same calls, the
+// same records, the same file. There it also asks to read the heart rate and the body weight, for
+// the Apple Watch app (its workout session shows the heart rate per set), and tells the watch
+// whether it is on (setEnabled: the App Group's "healthEnabled", which the watch link passes on).
+//
+// The web build never gets here (MOBILE is a build-time flag).
+import { MOBILE, nativePlatform, readJsonFile, writeJsonFile } from './mobile.js'
import { healthRecords, planSync, writtenIds } from './health-connect.js'
import { exerciseNameFor } from './i18n-core.js'
import { EXIDX } from './exercises.js'
@@ -20,11 +25,18 @@ const OFF = { on: false, written: {}, at: 0, error: null }
// promise resolved with the bare proxy never settles.
let pluginP = null
const plugin = () => pluginP || (pluginP = (async () => {
- if (!(await isAndroid())) return null
+ const platform = await nativePlatform()
+ if (!platform) return null
const { registerPlugin } = await import('@capacitor/core')
- return { HC: registerPlugin('HealthConnect') }
+ return { HC: registerPlugin(platform === 'ios' ? 'AppleHealth' : 'HealthConnect'), platform }
})().catch(() => null))
+// iPhone: the switch as the watch reads it. Android has no watch to tell.
+async function mirrorOn(on) {
+ const p = await plugin().catch(() => null)
+ if (p?.platform === 'ios') await p.HC.setEnabled({ on: !!on }).catch(() => {})
+}
+
// The file's content, read once and then kept here: a save while it is off (the usual case) must
// not cost a file read, and every change to it goes through saveHealth anyway.
let cached = null
@@ -36,14 +48,14 @@ export async function loadHealth() {
}
const saveHealth = h => { cached = h; return writeJsonFile(HEALTH_FILE, h) }
-/** { status: 'available' | 'update' | 'missing' | 'unsupported', granted } */
+/** { status: 'available' | 'update' | 'missing' | 'unsupported', granted, platform } */
export async function healthStatus() {
- if (!MOBILE) return { status: 'unsupported', granted: false }
+ if (!MOBILE) return { status: 'unsupported', granted: false, platform: null }
try {
const p = await plugin()
- if (!p) return { status: 'unsupported', granted: false }
- return await p.HC.status()
- } catch { return { status: 'unsupported', granted: false } }
+ if (!p) return { status: 'unsupported', granted: false, platform: null }
+ return { ...(await p.HC.status()), platform: p.platform }
+ } catch { return { status: 'unsupported', granted: false, platform: null } }
}
/** Health Connect's own screen for what apps wrote, or its store page where it is missing. */
@@ -137,6 +149,7 @@ export async function enableHealth(S) {
if (!granted) return { ok: false, reason: 'denied' }
const h = await loadHealth()
await saveHealth({ ...h, on: true, error: null })
+ await mirrorOn(true)
const after = await syncHealth(S)
return { ok: !after?.error, reason: after?.error || null, health: after }
}
@@ -159,6 +172,7 @@ export async function disableHealth({ removeWritten = false } = {}) {
}
const out = { ...h, on: false, error: null, written: removeWritten ? {} : h.written }
await saveHealth(out)
+ await mirrorOn(false)
told(out)
return out
}
@@ -174,5 +188,5 @@ export function initHealthSync(getState) {
}).catch(() => {})
// Once at launch, for a workout finished just before the app was closed. Reading the file here
// also settles whether it is on, which the saves wait for (syncHealth).
- setTimeout(() => loadHealth().then(() => syncHealth(getState())).catch(() => {}), 3000)
+ setTimeout(() => loadHealth().then(h => { mirrorOn(h.on); return syncHealth(getState()) }).catch(() => {}), 3000)
}
diff --git a/frontend/src/lib/health-sync.test.js b/frontend/src/lib/health-sync.test.js
index 5f6172ba2..3d5fc126e 100644
--- a/frontend/src/lib/health-sync.test.js
+++ b/frontend/src/lib/health-sync.test.js
@@ -4,7 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
// (HealthConnectPlugin.java) and the app's data directory are played in memory.
const h = vi.hoisted(() => {
vi.stubEnv('VITE_MOBILE', '1')
- return { files: new Map(), calls: [], status: { status: 'available', granted: false }, grant: true, fail: null }
+ return { files: new Map(), calls: [], status: { status: 'available', granted: false }, grant: true, fail: null, platform: 'android', plugins: [] }
})
vi.mock('@capacitor/filesystem', () => ({
@@ -20,8 +20,8 @@ vi.mock('@capacitor/filesystem', () => ({
}))
vi.mock('@capacitor/app', () => ({ App: { addListener: () => ({ remove() {} }) } }))
vi.mock('@capacitor/core', () => ({
- Capacitor: { getPlatform: () => 'android' },
- registerPlugin: () => ({
+ Capacitor: { getPlatform: () => h.platform },
+ registerPlugin: name => (h.plugins.push(name), {
status: async () => ({ ...h.status }),
requestPermissions: async () => { h.calls.push(['request']); h.status.granted = h.grant; return { granted: h.grant } },
write: async arg => {
@@ -30,6 +30,7 @@ vi.mock('@capacitor/core', () => ({
},
remove: async arg => { h.calls.push(['remove', arg]) },
openSettings: async () => {},
+ setEnabled: async ({ on }) => { h.calls.push(['setEnabled', on]) },
}),
}))
@@ -44,7 +45,7 @@ const file = () => JSON.parse(h.files.get('opengym-health.json') || 'null')
let hs
beforeEach(async () => {
vi.resetModules()
- h.files.clear(); h.calls = []; h.status = { status: 'available', granted: false }; h.grant = true; h.fail = null
+ h.files.clear(); h.calls = []; h.status = { status: 'available', granted: false }; h.grant = true; h.fail = null; h.platform = 'android'; h.plugins = []
hs = await import('./health-sync.js')
})
@@ -143,3 +144,37 @@ describe('turning it off', () => {
expect(file()).toMatchObject({ on: false, written: {} })
})
})
+
+// The iPhone app: the same switch, the same records and file, through Apple Health
+// (AppleHealthPlugin.swift), which also tells the Apple Watch app whether it is on.
+describe('on the iPhone', () => {
+ beforeEach(async () => {
+ vi.resetModules()
+ h.platform = 'ios'
+ hs = await import('./health-sync.js')
+ })
+ it('talks to Apple Health and says which one it is', async () => {
+ expect(await hs.healthStatus()).toMatchObject({ status: 'available', platform: 'ios' })
+ expect(h.plugins).toEqual(['AppleHealth'])
+ })
+ it('writes the same records, and tells the watch when it goes on and off', async () => {
+ await hs.enableHealth(state([workout('w1', 17)]))
+ expect(writes()[0].sessions.map(r => r.id)).toEqual(['opengym-w-w1'])
+ expect(h.calls.filter(c => c[0] === 'setEnabled')).toEqual([['setEnabled', true]])
+ await hs.disableHealth({ removeWritten: false })
+ expect(h.calls.filter(c => c[0] === 'setEnabled')).toEqual([['setEnabled', true], ['setEnabled', false]])
+ })
+ it('tells the watch nothing when asking was refused', async () => {
+ h.grant = false
+ expect(await hs.enableHealth(state([]))).toMatchObject({ ok: false, reason: 'denied' })
+ expect(h.calls.filter(c => c[0] === 'setEnabled')).toEqual([])
+ })
+ it('Android has no watch to tell', async () => {
+ vi.resetModules()
+ h.platform = 'android'
+ hs = await import('./health-sync.js')
+ await hs.enableHealth(state([workout('w1', 17)]))
+ expect(h.calls.filter(c => c[0] === 'setEnabled')).toEqual([])
+ expect((await hs.healthStatus()).platform).toBe('android')
+ })
+})
diff --git a/frontend/src/lib/onboarding-perms.js b/frontend/src/lib/onboarding-perms.js
index d2d92c2e6..5fe9873ea 100644
--- a/frontend/src/lib/onboarding-perms.js
+++ b/frontend/src/lib/onboarding-perms.js
@@ -7,10 +7,15 @@
// ask, anything else ('granted', 'denied', 'unsupported') skips the step: never a screen for a
// permission already given, nor for one the OS will not show a dialog for any more. Each step is
// shown once per device, whatever the answer; "Not now" leaves the in-context ask (the first
-// rest, the reminder switch) to do its job later. Apple Health / Health Connect can join the
-// list as another step without the screen changing.
+// rest, the reminder switch) to do its job later.
+//
+// iPhone only, Apple Health: Allow asks iOS for it (saving workouts and weigh-ins, reading the
+// heart rate and the body weight) and switches the app's Apple Health setting on, the same switch
+// as Settings → Apple Health (lib/health-sync.js), which the Apple Watch app goes by too. Not now
+// leaves it off, to switch on in Settings. Android keeps Health Connect in Settings as it is.
import { MOBILE } from './mobile.js'
import { askNotifPermissionOnce } from './rest-alert.js'
+import { healthStatus, loadHealth, enableHealth } from './health-sync.js'
export const SEEN_KEY = 'gym_onboard_perms_seen'
@@ -29,11 +34,23 @@ async function notificationState() {
} catch { return 'unsupported' }
}
+// 'prompt' while the iPhone app has Apple Health to offer and it is still off.
+async function appleHealthState() {
+ const st = await healthStatus()
+ if (st.platform !== 'ios' || st.status !== 'available') return 'unsupported'
+ return (await loadHealth()).on ? 'granted' : 'prompt'
+}
+async function appleHealthRequest() {
+ const { useStore } = await import('../store/useStore.js')
+ return enableHealth(useStore.getState().S)
+}
+
export const STEPS = [
// The same request the first rest makes (rest-alert.js): it asks through LocalNotifications,
// which is POST_NOTIFICATIONS on Android 13+ and the usual alert on iOS, and records the
// answer so the first rest does not ask a second time.
{ id: 'notifications', state: notificationState, request: () => askNotifPermissionOnce() },
+ { id: 'appleHealth', state: appleHealthState, request: appleHealthRequest },
]
/** The steps this device still has to see, in order. Empty off the phone app. */
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 16932ec1a..b33216c67 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('5f0b01ecc8dcce4d1b6915c23c83de665ec915ca5650d5b6f3cafb4e8d95f9c8')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('61989f4335d38d50aca0a8c847725f26f6a6dbe4549f4639fdbc6ad2cc13c355')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 58a59429a..4863044c8 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -2365,4 +2365,24 @@ export default {
'Still only': 'صورة ثابتة فقط',
'Waiting for Wi-Fi': 'بانتظار Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple صحتي',
+ 'Write to Apple Health': 'الحفظ في Apple صحتي',
+ 'Open Apple Health': 'فتح Apple صحتي',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'تنتقل التمارين وأوزانك إلى Apple صحتي عندما تنهيها أو تغيّرها.',
+ 'Writing to Apple Health': 'جارٍ الحفظ في Apple صحتي',
+ 'Apple Health permission not granted': 'لم يُمنح إذن Apple صحتي',
+ 'Could not write to Apple Health': 'تعذّر الحفظ في Apple صحتي',
+ 'Could not remove it from Apple Health': 'تعذّرت الإزالة من Apple صحتي',
+ 'Stop writing to Apple Health?': 'إيقاف الحفظ في Apple صحتي؟',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'ما حفظه openGym بالفعل يمكن أن يبقى في Apple صحتي كبياناتك، أو أن يُزال منه.',
+ 'Your workouts in Apple Health': 'تمارينك في Apple صحتي',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'يمكن لـ openGym حفظ كل تمرين وكل وزن في Apple صحتي، ويمكن لساعة Apple Watch أن تعرض نبضك أثناء الرفع.',
+ 'Workouts and weigh-ins saved to Apple Health': 'التمارين والأوزان في Apple صحتي',
+ 'Heart rate per set on your Apple Watch': 'النبض لكل مجموعة على Apple Watch',
+ 'Switch it off anytime in Settings': 'أوقفه متى شئت من الإعدادات',
+ 'You can change it anytime in Settings.': 'يمكنك تغييره متى شئت من الإعدادات.',
+ 'Last PR': 'آخر رقم قياسي',
+ 'Workout running': 'تمرين جارٍ',
+ 'Set {0} of {1}': 'المجموعة {0} من {1}',
+ 'All sets done': 'اكتملت كل المجموعات',
}
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 219f941be..e61cd9d99 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -2389,4 +2389,24 @@ export default {
'Still only': 'শুধু স্থির ছবি',
'Waiting for Wi-Fi': 'Wi-Fi-র অপেক্ষায়',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Health',
+ 'Write to Apple Health': 'Apple Health-এ সেভ করুন',
+ 'Open Apple Health': 'Apple Health খুলুন',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'ওয়ার্কআউট আর ওজন শেষ বা বদল করলেই Apple Health-এ চলে যায়।',
+ 'Writing to Apple Health': 'Apple Health-এ সেভ হচ্ছে',
+ 'Apple Health permission not granted': 'Apple Health-এর অনুমতি দেওয়া হয়নি',
+ 'Could not write to Apple Health': 'Apple Health-এ সেভ করা গেল না',
+ 'Could not remove it from Apple Health': 'Apple Health থেকে সরানো গেল না',
+ 'Stop writing to Apple Health?': 'Apple Health-এ সেভ করা বন্ধ করবেন?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'openGym যা আগে সেভ করেছে তা আপনার ডেটা হিসেবে Apple Health-এ থাকতে পারে, বা সরানো যেতে পারে।',
+ 'Your workouts in Apple Health': 'আপনার ওয়ার্কআউট Apple Health-এ',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym প্রতিটি ওয়ার্কআউট আর ওজন Apple Health-এ সেভ করতে পারে, আর আপনার Apple Watch তোলার সময় হার্ট রেট দেখাতে পারে।',
+ 'Workouts and weigh-ins saved to Apple Health': 'ওয়ার্কআউট আর ওজন Apple Health-এ',
+ 'Heart rate per set on your Apple Watch': 'Apple Watch-এ প্রতি সেটের হার্ট রেট',
+ 'Switch it off anytime in Settings': 'সেটিংসে যেকোনো সময় বন্ধ করুন',
+ 'You can change it anytime in Settings.': 'সেটিংসে যেকোনো সময় এটি বদলাতে পারেন।',
+ 'Last PR': 'শেষ PR',
+ 'Workout running': 'ওয়ার্কআউট চলছে',
+ 'Set {0} of {1}': 'সেট {0} / {1}',
+ 'All sets done': 'সব সেট শেষ',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 5f52e7822..9e4139845 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -2330,4 +2330,24 @@ export default {
'Still only': 'Nur Standbild',
'Waiting for Wi-Fi': 'Wartet auf WLAN',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Health',
+ 'Write to Apple Health': 'In Apple Health speichern',
+ 'Open Apple Health': 'Apple Health öffnen',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Trainings und Wiegungen landen in Apple Health, sobald du sie abschließt oder änderst.',
+ 'Writing to Apple Health': 'Wird in Apple Health gespeichert',
+ 'Apple Health permission not granted': 'Apple Health nicht erlaubt',
+ 'Could not write to Apple Health': 'Konnte nicht in Apple Health speichern',
+ 'Could not remove it from Apple Health': 'Konnte es nicht aus Apple Health entfernen',
+ 'Stop writing to Apple Health?': 'Nicht mehr in Apple Health speichern?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'Was openGym schon gespeichert hat, kann als deine Daten in Apple Health bleiben oder entfernt werden.',
+ 'Your workouts in Apple Health': 'Deine Trainings in Apple Health',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym kann jedes Training und jede Wiegung in Apple Health speichern, und deine Apple Watch zeigt dir beim Heben deinen Puls.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Trainings und Wiegungen in Apple Health',
+ 'Heart rate per set on your Apple Watch': 'Puls pro Satz auf deiner Apple Watch',
+ 'Switch it off anytime in Settings': 'Jederzeit in den Einstellungen abschaltbar',
+ 'You can change it anytime in Settings.': 'Du kannst das jederzeit in den Einstellungen ändern.',
+ 'Last PR': 'Letzter Rekord',
+ 'Workout running': 'Training läuft',
+ 'Set {0} of {1}': 'Satz {0} von {1}',
+ 'All sets done': 'Alle Sätze erledigt',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 51c888a9a..5fea0abee 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'Solo imagen fija',
'Waiting for Wi-Fi': 'Esperando Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Salud',
+ 'Write to Apple Health': 'Guardar en Apple Salud',
+ 'Open Apple Health': 'Abrir Apple Salud',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Los entrenos y los pesajes van a Apple Salud cuando los terminas o los cambias.',
+ 'Writing to Apple Health': 'Guardando en Apple Salud',
+ 'Apple Health permission not granted': 'Permiso de Apple Salud no concedido',
+ 'Could not write to Apple Health': 'No se pudo guardar en Apple Salud',
+ 'Could not remove it from Apple Health': 'No se pudo quitar de Apple Salud',
+ 'Stop writing to Apple Health?': '¿Dejar de guardar en Apple Salud?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'Lo que openGym ya guardó puede quedarse en Apple Salud como tus datos o quitarse.',
+ 'Your workouts in Apple Health': 'Tus entrenos en Apple Salud',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym puede guardar cada entreno y cada pesaje en Apple Salud, y tu Apple Watch puede mostrarte el pulso mientras levantas.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Entrenos y pesajes en Apple Salud',
+ 'Heart rate per set on your Apple Watch': 'Pulso por serie en tu Apple Watch',
+ 'Switch it off anytime in Settings': 'Lo apagas cuando quieras en Ajustes',
+ 'You can change it anytime in Settings.': 'Puedes cambiarlo cuando quieras en Ajustes.',
+ 'Last PR': 'Último récord',
+ 'Workout running': 'Entreno en curso',
+ 'Set {0} of {1}': 'Serie {0} de {1}',
+ 'All sets done': 'Todas las series hechas',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index ce4401563..1b3c0b7e0 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'Image fixe seulement',
'Waiting for Wi-Fi': 'En attente du Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Santé',
+ 'Write to Apple Health': 'Enregistrer dans Apple Santé',
+ 'Open Apple Health': 'Ouvrir Apple Santé',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Les séances et les pesées vont dans Apple Santé dès que tu les termines ou les modifies.',
+ 'Writing to Apple Health': 'Enregistrement dans Apple Santé',
+ 'Apple Health permission not granted': 'Autorisation Apple Santé refusée',
+ 'Could not write to Apple Health': 'Impossible d’enregistrer dans Apple Santé',
+ 'Could not remove it from Apple Health': 'Impossible de le retirer d’Apple Santé',
+ 'Stop writing to Apple Health?': 'Arrêter d’enregistrer dans Apple Santé ?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'Ce qu’openGym a déjà enregistré peut rester dans Apple Santé comme tes données, ou en être retiré.',
+ 'Your workouts in Apple Health': 'Tes séances dans Apple Santé',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym peut enregistrer chaque séance et chaque pesée dans Apple Santé, et ton Apple Watch peut afficher ton pouls pendant que tu soulèves.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Séances et pesées dans Apple Santé',
+ 'Heart rate per set on your Apple Watch': 'Le pouls par série sur ton Apple Watch',
+ 'Switch it off anytime in Settings': 'Désactivable à tout moment dans les Réglages',
+ 'You can change it anytime in Settings.': 'Tu peux changer ça à tout moment dans les Réglages.',
+ 'Last PR': 'Dernier record',
+ 'Workout running': 'Séance en cours',
+ 'Set {0} of {1}': 'Série {0} sur {1}',
+ 'All sets done': 'Toutes les séries faites',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 2e09b9057..8c0ca598c 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'सिर्फ़ स्थिर तस्वीर',
'Waiting for Wi-Fi': 'Wi-Fi का इंतज़ार',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Health',
+ 'Write to Apple Health': 'Apple Health में सहेजें',
+ 'Open Apple Health': 'Apple Health खोलें',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'वर्कआउट और वज़न, पूरा करते या बदलते ही Apple Health में चले जाते हैं।',
+ 'Writing to Apple Health': 'Apple Health में सहेजा जा रहा है',
+ 'Apple Health permission not granted': 'Apple Health की अनुमति नहीं मिली',
+ 'Could not write to Apple Health': 'Apple Health में सहेजा नहीं जा सका',
+ 'Could not remove it from Apple Health': 'Apple Health से हटाया नहीं जा सका',
+ 'Stop writing to Apple Health?': 'Apple Health में सहेजना बंद करें?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'openGym ने जो पहले से सहेजा है, वह आपके डेटा के रूप में Apple Health में रह सकता है, या हटाया जा सकता है।',
+ 'Your workouts in Apple Health': 'आपके वर्कआउट Apple Health में',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym हर वर्कआउट और वज़न Apple Health में सहेज सकता है, और आपकी Apple Watch लिफ्ट करते समय आपकी धड़कन दिखा सकती है।',
+ 'Workouts and weigh-ins saved to Apple Health': 'वर्कआउट और वज़न Apple Health में',
+ 'Heart rate per set on your Apple Watch': 'Apple Watch पर हर सेट की धड़कन',
+ 'Switch it off anytime in Settings': 'सेटिंग्स में कभी भी बंद करें',
+ 'You can change it anytime in Settings.': 'आप इसे कभी भी सेटिंग्स में बदल सकते हैं।',
+ 'Last PR': 'पिछला PR',
+ 'Workout running': 'वर्कआउट चल रहा है',
+ 'Set {0} of {1}': 'सेट {0} / {1}',
+ 'All sets done': 'सारे सेट पूरे',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 66891f41a..ee0f30d92 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -2313,4 +2313,24 @@ export default {
'Still only': 'Csak állókép',
'Waiting for Wi-Fi': 'Wi-Fire vár',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Egészség',
+ 'Write to Apple Health': 'Mentés az Apple Egészségbe',
+ 'Open Apple Health': 'Apple Egészség megnyitása',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Az edzések és mérések az Apple Egészségbe kerülnek, amikor befejezed vagy módosítod őket.',
+ 'Writing to Apple Health': 'Mentés az Apple Egészségbe',
+ 'Apple Health permission not granted': 'Az Apple Egészség engedély nincs megadva',
+ 'Could not write to Apple Health': 'Nem sikerült menteni az Apple Egészségbe',
+ 'Could not remove it from Apple Health': 'Nem sikerült eltávolítani az Apple Egészségből',
+ 'Stop writing to Apple Health?': 'Leállítod a mentést az Apple Egészségbe?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'Amit az openGym már elmentett, maradhat az Apple Egészségben a te adataidként, vagy törölhető.',
+ 'Your workouts in Apple Health': 'Az edzéseid az Apple Egészségben',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'Az openGym minden edzést és mérést elmenthet az Apple Egészségbe, az Apple Watch pedig emelés közben mutatja a pulzusodat.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Edzések és mérések az Apple Egészségben',
+ 'Heart rate per set on your Apple Watch': 'Pulzus sorozatonként az Apple Watch-on',
+ 'Switch it off anytime in Settings': 'Bármikor kikapcsolhatod a Beállításokban',
+ 'You can change it anytime in Settings.': 'Bármikor módosíthatod a Beállításokban.',
+ 'Last PR': 'Legutóbbi rekord',
+ 'Workout running': 'Edzés folyamatban',
+ 'Set {0} of {1}': '{0}. sorozat / {1}',
+ 'All sets done': 'Minden sorozat kész',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 05bd0289c..d03a079f4 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'Solo immagine fissa',
'Waiting for Wi-Fi': 'In attesa del Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Salute',
+ 'Write to Apple Health': 'Salva in Apple Salute',
+ 'Open Apple Health': 'Apri Apple Salute',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Allenamenti e pesate finiscono in Apple Salute quando li concludi o li modifichi.',
+ 'Writing to Apple Health': 'Salvataggio in Apple Salute',
+ 'Apple Health permission not granted': 'Permesso di Apple Salute non concesso',
+ 'Could not write to Apple Health': 'Impossibile salvare in Apple Salute',
+ 'Could not remove it from Apple Health': 'Impossibile rimuoverlo da Apple Salute',
+ 'Stop writing to Apple Health?': 'Smettere di salvare in Apple Salute?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'Quello che openGym ha già salvato può restare in Apple Salute come dati tuoi, oppure essere rimosso.',
+ 'Your workouts in Apple Health': 'I tuoi allenamenti in Apple Salute',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym può salvare ogni allenamento e ogni pesata in Apple Salute, e il tuo Apple Watch può mostrarti il battito mentre sollevi.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Allenamenti e pesate in Apple Salute',
+ 'Heart rate per set on your Apple Watch': 'Battito per serie sul tuo Apple Watch',
+ 'Switch it off anytime in Settings': 'Lo spegni quando vuoi nelle Impostazioni',
+ 'You can change it anytime in Settings.': 'Puoi cambiarlo quando vuoi nelle Impostazioni.',
+ 'Last PR': 'Ultimo record',
+ 'Workout running': 'Allenamento in corso',
+ 'Set {0} of {1}': 'Serie {0} di {1}',
+ 'All sets done': 'Tutte le serie fatte',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 652f9b77a..58af1d4aa 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': '정지 이미지만',
'Waiting for Wi-Fi': 'Wi-Fi 기다리는 중',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple 건강',
+ 'Write to Apple Health': 'Apple 건강에 기록',
+ 'Open Apple Health': 'Apple 건강 열기',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': '운동과 체중 기록은 끝내거나 바꿀 때 Apple 건강으로 가요.',
+ 'Writing to Apple Health': 'Apple 건강에 기록하는 중',
+ 'Apple Health permission not granted': 'Apple 건강 권한이 허용되지 않음',
+ 'Could not write to Apple Health': 'Apple 건강에 기록하지 못했어요',
+ 'Could not remove it from Apple Health': 'Apple 건강에서 지우지 못했어요',
+ 'Stop writing to Apple Health?': 'Apple 건강 기록을 중단할까요?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'openGym이 이미 기록한 내용은 내 데이터로 Apple 건강에 남겨 두거나 지울 수 있어요.',
+ 'Your workouts in Apple Health': 'Apple 건강에 내 운동을',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym이 모든 운동과 체중을 Apple 건강에 저장하고, Apple Watch는 운동 중 심박수를 보여줄 수 있어요.',
+ 'Workouts and weigh-ins saved to Apple Health': '운동과 체중이 Apple 건강에',
+ 'Heart rate per set on your Apple Watch': 'Apple Watch에서 세트별 심박수',
+ 'Switch it off anytime in Settings': '설정에서 언제든 끌 수 있어요',
+ 'You can change it anytime in Settings.': '설정에서 언제든 바꿀 수 있어요.',
+ 'Last PR': '최근 PR',
+ 'Workout running': '운동 중',
+ 'Set {0} of {1}': '{1}세트 중 {0}세트',
+ 'All sets done': '모든 세트 완료',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index d81f603c1..64f79612f 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'Tylko obrazek',
'Waiting for Wi-Fi': 'Czeka na Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Zdrowie',
+ 'Write to Apple Health': 'Zapisuj w Apple Zdrowie',
+ 'Open Apple Health': 'Otwórz Apple Zdrowie',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Treningi i pomiary wagi trafiają do Apple Zdrowie, gdy je kończysz lub zmieniasz.',
+ 'Writing to Apple Health': 'Zapisywanie w Apple Zdrowie',
+ 'Apple Health permission not granted': 'Nie przyznano uprawnienia Apple Zdrowie',
+ 'Could not write to Apple Health': 'Nie udało się zapisać w Apple Zdrowie',
+ 'Could not remove it from Apple Health': 'Nie udało się usunąć z Apple Zdrowie',
+ 'Stop writing to Apple Health?': 'Przestać zapisywać w Apple Zdrowie?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'To, co openGym już zapisał, może zostać w Apple Zdrowie jako twoje dane albo zostać usunięte.',
+ 'Your workouts in Apple Health': 'Twoje treningi w Apple Zdrowie',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym może zapisywać każdy trening i pomiar wagi w Apple Zdrowie, a twój Apple Watch pokaże tętno, gdy dźwigasz.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Treningi i pomiary wagi w Apple Zdrowie',
+ 'Heart rate per set on your Apple Watch': 'Tętno w każdej serii na Apple Watch',
+ 'Switch it off anytime in Settings': 'Wyłączysz to w każdej chwili w Ustawieniach',
+ 'You can change it anytime in Settings.': 'Możesz to zmienić w każdej chwili w Ustawieniach.',
+ 'Last PR': 'Ostatni rekord',
+ 'Workout running': 'Trening trwa',
+ 'Set {0} of {1}': 'Seria {0} z {1}',
+ 'All sets done': 'Wszystkie serie zrobione',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 6979329a2..a2b3fbce1 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1465,6 +1465,18 @@ export const PT_BR_OVERRIDES = {
'Waiting for Wi-Fi': 'Esperando o Wi-Fi',
// --- 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.',
+ 'Write to Apple Health': 'Salvar no Apple Saúde',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Os treinos e as pesagens vão para o Apple Saúde quando você os termina ou altera.',
+ 'Writing to Apple Health': 'Salvando no Apple Saúde',
+ 'Could not write to Apple Health': 'Não foi possível salvar no Apple Saúde',
+ 'Stop writing to Apple Health?': 'Parar de salvar no Apple Saúde?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'O que o openGym já salvou pode ficar no Apple Saúde como seus dados, ou ser removido.',
+ 'Your workouts in Apple Health': 'Seus treinos no Apple Saúde',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'O openGym pode salvar cada treino e cada pesagem no Apple Saúde, e seu Apple Watch pode mostrar sua frequência cardíaca enquanto você treina.',
+ 'Heart rate per set on your Apple Watch': 'Frequência cardíaca por série no seu Apple Watch',
+ 'Switch it off anytime in Settings': 'Desligue quando quiser nas Configurações',
+ 'You can change it anytime in Settings.': 'Você pode mudar isso quando quiser nas Configurações.',
+ 'Workout running': 'Treino em andamento',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 457f2dc9e..f23f3761d 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'Só imagem fixa',
'Waiting for Wi-Fi': 'À espera de Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Saúde',
+ 'Write to Apple Health': 'Guardar no Apple Saúde',
+ 'Open Apple Health': 'Abrir o Apple Saúde',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Os treinos e as pesagens vão para o Apple Saúde quando os terminas ou alteras.',
+ 'Writing to Apple Health': 'A guardar no Apple Saúde',
+ 'Apple Health permission not granted': 'Permissão do Apple Saúde não concedida',
+ 'Could not write to Apple Health': 'Não foi possível guardar no Apple Saúde',
+ 'Could not remove it from Apple Health': 'Não foi possível remover do Apple Saúde',
+ 'Stop writing to Apple Health?': 'Deixar de guardar no Apple Saúde?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'O que o openGym já guardou pode ficar no Apple Saúde como dados teus, ou ser removido.',
+ 'Your workouts in Apple Health': 'Os teus treinos no Apple Saúde',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'O openGym pode guardar cada treino e cada pesagem no Apple Saúde, e o teu Apple Watch pode mostrar o teu ritmo cardíaco enquanto treinas.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Treinos e pesagens no Apple Saúde',
+ 'Heart rate per set on your Apple Watch': 'Ritmo cardíaco por série no teu Apple Watch',
+ 'Switch it off anytime in Settings': 'Desligas quando quiseres nas Definições',
+ 'You can change it anytime in Settings.': 'Podes mudar isto quando quiseres nas Definições.',
+ 'Last PR': 'Último recorde',
+ 'Workout running': 'Treino a decorrer',
+ 'Set {0} of {1}': 'Série {0} de {1}',
+ 'All sets done': 'Todas as séries feitas',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 4e886d6cd..83388de6c 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -2314,4 +2314,24 @@ export default {
'Still only': 'Только картинка',
'Waiting for Wi-Fi': 'Ждём Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Здоровье',
+ 'Write to Apple Health': 'Записывать в Apple Здоровье',
+ 'Open Apple Health': 'Открыть Apple Здоровье',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Тренировки и взвешивания попадают в Apple Здоровье, когда вы их завершаете или меняете.',
+ 'Writing to Apple Health': 'Запись в Apple Здоровье',
+ 'Apple Health permission not granted': 'Разрешение Apple Здоровье не выдано',
+ 'Could not write to Apple Health': 'Не удалось записать в Apple Здоровье',
+ 'Could not remove it from Apple Health': 'Не удалось удалить из Apple Здоровье',
+ 'Stop writing to Apple Health?': 'Перестать записывать в Apple Здоровье?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'То, что openGym уже записал, может остаться в Apple Здоровье как ваши данные или быть удалено.',
+ 'Your workouts in Apple Health': 'Ваши тренировки в Apple Здоровье',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym может сохранять каждую тренировку и взвешивание в Apple Здоровье, а Apple Watch покажет пульс прямо во время подходов.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Тренировки и взвешивания в Apple Здоровье',
+ 'Heart rate per set on your Apple Watch': 'Пульс по подходам на Apple Watch',
+ 'Switch it off anytime in Settings': 'Можно выключить в любой момент в Настройках',
+ 'You can change it anytime in Settings.': 'Это можно изменить в любой момент в Настройках.',
+ 'Last PR': 'Последний рекорд',
+ 'Workout running': 'Тренировка идёт',
+ 'Set {0} of {1}': 'Подход {0} из {1}',
+ 'All sets done': 'Все подходы сделаны',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 227645704..d0449559d 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -2321,4 +2321,24 @@ export default {
'Still only': 'ภาพนิ่งเท่านั้น',
'Waiting for Wi-Fi': 'รอ Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Health',
+ 'Write to Apple Health': 'บันทึกลง Apple Health',
+ 'Open Apple Health': 'เปิด Apple Health',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'การฝึกและการชั่งน้ำหนักจะไปที่ Apple Health เมื่อคุณทำเสร็จหรือแก้ไข',
+ 'Writing to Apple Health': 'กำลังบันทึกลง Apple Health',
+ 'Apple Health permission not granted': 'ไม่ได้รับสิทธิ์ Apple Health',
+ 'Could not write to Apple Health': 'บันทึกลง Apple Health ไม่ได้',
+ 'Could not remove it from Apple Health': 'ลบออกจาก Apple Health ไม่ได้',
+ 'Stop writing to Apple Health?': 'หยุดบันทึกลง Apple Health ไหม',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'สิ่งที่ openGym บันทึกไว้แล้วจะเก็บไว้ใน Apple Health เป็นข้อมูลของคุณ หรือจะลบออกก็ได้',
+ 'Your workouts in Apple Health': 'การฝึกของคุณใน Apple Health',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym บันทึกทุกการฝึกและการชั่งน้ำหนักลง Apple Health ได้ และ Apple Watch ของคุณแสดงอัตราการเต้นของหัวใจระหว่างยกได้',
+ 'Workouts and weigh-ins saved to Apple Health': 'การฝึกและน้ำหนักอยู่ใน Apple Health',
+ 'Heart rate per set on your Apple Watch': 'อัตราการเต้นของหัวใจแต่ละเซ็ตบน Apple Watch',
+ 'Switch it off anytime in Settings': 'ปิดได้ทุกเมื่อในการตั้งค่า',
+ 'You can change it anytime in Settings.': 'เปลี่ยนได้ทุกเมื่อในการตั้งค่า',
+ 'Last PR': 'สถิติล่าสุด',
+ 'Workout running': 'กำลังฝึกอยู่',
+ 'Set {0} of {1}': 'เซ็ต {0} จาก {1}',
+ 'All sets done': 'ครบทุกเซ็ตแล้ว',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 3b0e5cda0..fd34cbb34 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': 'Yalnızca sabit resim',
'Waiting for Wi-Fi': 'Wi-Fi bekleniyor',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Sağlık',
+ 'Write to Apple Health': 'Apple Sağlık’a kaydet',
+ 'Open Apple Health': 'Apple Sağlık’ı aç',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Antrenmanlar ve tartılar, bitirdiğinde ya da değiştirdiğinde Apple Sağlık’a gider.',
+ 'Writing to Apple Health': 'Apple Sağlık’a kaydediliyor',
+ 'Apple Health permission not granted': 'Apple Sağlık izni verilmedi',
+ 'Could not write to Apple Health': 'Apple Sağlık’a kaydedilemedi',
+ 'Could not remove it from Apple Health': 'Apple Sağlık’tan kaldırılamadı',
+ 'Stop writing to Apple Health?': 'Apple Sağlık’a kaydetme durdurulsun mu?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'openGym’in kaydettikleri senin verin olarak Apple Sağlık’ta kalabilir ya da kaldırılabilir.',
+ 'Your workouts in Apple Health': 'Antrenmanların Apple Sağlık’ta',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym her antrenmanı ve tartıyı Apple Sağlık’a kaydedebilir, Apple Watch’un da sen kaldırırken nabzını gösterebilir.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Antrenmanlar ve tartılar Apple Sağlık’ta',
+ 'Heart rate per set on your Apple Watch': 'Apple Watch’ta set başına nabız',
+ 'Switch it off anytime in Settings': 'Ayarlar’dan istediğin zaman kapatabilirsin',
+ 'You can change it anytime in Settings.': 'Bunu istediğin zaman Ayarlar’dan değiştirebilirsin.',
+ 'Last PR': 'Son rekor',
+ 'Workout running': 'Antrenman sürüyor',
+ 'Set {0} of {1}': 'Set {0}/{1}',
+ 'All sets done': 'Tüm setler tamam',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 9c13d9c8c..2f621c69e 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -2307,4 +2307,24 @@ export default {
'Still only': 'Лише зображення',
'Waiting for Wi-Fi': 'Чекаємо на Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple Здоров’я',
+ 'Write to Apple Health': 'Записувати в Apple Здоров’я',
+ 'Open Apple Health': 'Відкрити Apple Здоров’я',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': 'Тренування і зважування потрапляють до Apple Здоров’я, щойно ти їх завершуєш або змінюєш.',
+ 'Writing to Apple Health': 'Запис до Apple Здоров’я',
+ 'Apple Health permission not granted': 'Дозвіл Apple Здоров’я не надано',
+ 'Could not write to Apple Health': 'Не вдалося записати до Apple Здоров’я',
+ 'Could not remove it from Apple Health': 'Не вдалося прибрати з Apple Здоров’я',
+ 'Stop writing to Apple Health?': 'Припинити запис до Apple Здоров’я?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'Те, що openGym уже записав, може лишитися в Apple Здоров’я як твої дані або бути прибране.',
+ 'Your workouts in Apple Health': 'Твої тренування в Apple Здоров’я',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym може зберігати кожне тренування і зважування в Apple Здоров’я, а Apple Watch покаже пульс просто під час підходів.',
+ 'Workouts and weigh-ins saved to Apple Health': 'Тренування і зважування в Apple Здоров’я',
+ 'Heart rate per set on your Apple Watch': 'Пульс для кожного підходу на Apple Watch',
+ 'Switch it off anytime in Settings': 'Вимкнеш будь-коли в Налаштуваннях',
+ 'You can change it anytime in Settings.': 'Це можна змінити будь-коли в Налаштуваннях.',
+ 'Last PR': 'Останній рекорд',
+ 'Workout running': 'Тренування триває',
+ 'Set {0} of {1}': 'Підхід {0} з {1}',
+ 'All sets done': 'Усі підходи зроблено',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 4eb09925b..bdef2e10d 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -2303,4 +2303,24 @@ export default {
'Still only': '僅靜態圖',
'Waiting for Wi-Fi': '等待 Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple 健康',
+ 'Write to Apple Health': '寫入 Apple 健康',
+ 'Open Apple Health': '打開 Apple 健康',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': '訓練和體重紀錄在你完成或修改時寫入 Apple 健康。',
+ 'Writing to Apple Health': '正在寫入 Apple 健康',
+ 'Apple Health permission not granted': '未授予 Apple 健康權限',
+ 'Could not write to Apple Health': '無法寫入 Apple 健康',
+ 'Could not remove it from Apple Health': '無法從 Apple 健康中移除',
+ 'Stop writing to Apple Health?': '要停止寫入 Apple 健康嗎?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'openGym 已寫入的內容可以作為你的資料留在 Apple 健康中,也可以移除。',
+ 'Your workouts in Apple Health': '你的訓練,同步到 Apple 健康',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym 可以把每次訓練和量體重存入 Apple 健康,你的 Apple Watch 還能在訓練時顯示心率。',
+ 'Workouts and weigh-ins saved to Apple Health': '訓練和體重存入 Apple 健康',
+ 'Heart rate per set on your Apple Watch': 'Apple Watch 上每組的心率',
+ 'Switch it off anytime in Settings': '隨時可在設定中關閉',
+ 'You can change it anytime in Settings.': '隨時可以在設定中更改。',
+ 'Last PR': '最近紀錄',
+ 'Workout running': '訓練進行中',
+ 'Set {0} of {1}': '第 {0} 組,共 {1} 組',
+ 'All sets done': '所有組已完成',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index c5e7d7cf2..7f385bb77 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -2310,4 +2310,24 @@ export default {
'Still only': '仅静态图',
'Waiting for Wi-Fi': '等待 Wi-Fi',
'{0} px': '{0} px',
+ 'Apple Health': 'Apple 健康',
+ 'Write to Apple Health': '写入 Apple 健康',
+ 'Open Apple Health': '打开 Apple 健康',
+ 'Workouts and weigh-ins go to Apple Health when you finish or change them.': '训练和体重记录在你完成或修改时写入 Apple 健康。',
+ 'Writing to Apple Health': '正在写入 Apple 健康',
+ 'Apple Health permission not granted': '未授予 Apple 健康权限',
+ 'Could not write to Apple Health': '无法写入 Apple 健康',
+ 'Could not remove it from Apple Health': '无法从 Apple 健康中移除',
+ 'Stop writing to Apple Health?': '要停止写入 Apple 健康吗?',
+ 'What openGym already wrote can stay in Apple Health as your data, or be removed from it.': 'openGym 已写入的内容可以作为你的数据留在 Apple 健康中,也可以移除。',
+ 'Your workouts in Apple Health': '你的训练,同步到 Apple 健康',
+ 'openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.': 'openGym 可以把每次训练和称重存入 Apple 健康,你的 Apple Watch 还能在训练时显示心率。',
+ 'Workouts and weigh-ins saved to Apple Health': '训练和体重存入 Apple 健康',
+ 'Heart rate per set on your Apple Watch': 'Apple Watch 上每组的心率',
+ 'Switch it off anytime in Settings': '随时可在设置中关闭',
+ 'You can change it anytime in Settings.': '随时可以在设置中更改。',
+ 'Last PR': '最近纪录',
+ 'Workout running': '训练进行中',
+ 'Set {0} of {1}': '第 {0} 组,共 {1} 组',
+ 'All sets done': '所有组已完成',
}
diff --git a/frontend/src/views/PermissionSteps.jsx b/frontend/src/views/PermissionSteps.jsx
index 783a460cf..892a3a2cf 100644
--- a/frontend/src/views/PermissionSteps.jsx
+++ b/frontend/src/views/PermissionSteps.jsx
@@ -9,8 +9,8 @@ import { pendingSteps, markStepSeen } from '../lib/onboarding-perms.js'
import Icon from '../components/Icon.jsx'
import { Button } from '../components/ui.jsx'
-// What each step says. Literal t() calls, so check-source-strings sees them; a new step (Apple
-// Health, Health Connect) adds its own entry here and its check/request in onboarding-perms.js.
+// What each step says. Literal t() calls, so check-source-strings sees them; a new step adds its
+// own entry here and its check/request in onboarding-perms.js.
const COPY = {
notifications: () => ({
icon: 'bell',
@@ -18,6 +18,13 @@ const COPY = {
body: t('openGym can tap you on the shoulder when a rest is over, even with the phone locked in your pocket.'),
lines: [t('Rest timer, right on the lock screen'), t('Training reminders, only if you switch them on')],
}),
+ appleHealth: () => ({
+ icon: 'heart',
+ title: t('Your workouts in Apple Health'),
+ body: t('openGym can save every workout and weigh-in to Apple Health, and your Apple Watch can show your heart rate while you lift.'),
+ lines: [t('Workouts and weigh-ins saved to Apple Health'), t('Heart rate per set on your Apple Watch'), t('Switch it off anytime in Settings')],
+ foot: t('You can change it anytime in Settings.'),
+ }),
}
export default function PermissionSteps() {
@@ -49,6 +56,6 @@ export default function PermissionSteps() {
<Button variant="primary" disabled={busy} onClick={() => answer(true)}>{t('Allow')}</Button>
<div style={{ height: 10 }} />
<Button disabled={busy} onClick={() => answer(false)}>{t('Not now')}</Button>
- <div className="dim small" style={{ marginTop: 18, lineHeight: 1.5 }}>{t('You can change it anytime in your phone’s settings.')}</div>
+ <div className="dim small" style={{ marginTop: 18, lineHeight: 1.5 }}>{c.foot || t('You can change it anytime in your phone’s settings.')}</div>
</div>
}
diff --git a/frontend/src/views/PermissionSteps.test.jsx b/frontend/src/views/PermissionSteps.test.jsx
index 8a427e165..3f010bdbb 100644
--- a/frontend/src/views/PermissionSteps.test.jsx
+++ b/frontend/src/views/PermissionSteps.test.jsx
@@ -10,7 +10,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
globalThis.IS_REACT_ACT_ENVIRONMENT = true
-const h = vi.hoisted(() => ({ MOBILE: true, display: 'prompt', after: 'granted', finish: vi.fn(), requests: 0 }))
+const h = vi.hoisted(() => ({ MOBILE: true, display: 'prompt', after: 'granted', finish: vi.fn(), requests: 0, health: { status: 'unsupported', granted: false, platform: null }, healthOn: false, enable: [] }))
vi.mock('../lib/mobile.js', () => ({ get MOBILE() { return h.MOBILE }, nativePlatform: async () => (h.MOBILE ? 'ios' : null) }))
vi.mock('@capacitor/local-notifications', () => ({
LocalNotifications: {
@@ -18,8 +18,14 @@ vi.mock('@capacitor/local-notifications', () => ({
requestPermissions: async () => { h.requests++; h.display = h.after; return { display: h.after } },
},
}))
+// Apple Health (iPhone only): lib/health-sync.js is played here; its own tests cover the writing.
+vi.mock('../lib/health-sync.js', () => ({
+ healthStatus: async () => h.health,
+ loadHealth: async () => ({ on: h.healthOn, written: {} }),
+ enableHealth: async S => { h.enable.push(S); h.healthOn = true; return { ok: true } },
+}))
vi.mock('../store/useStore.js', () => {
- const snap = () => ({ finishPermSteps: h.finish })
+ const snap = () => ({ finishPermSteps: h.finish, S: { unit: 'kg', workouts: [] } })
const useStore = sel => (sel ? sel(snap()) : snap())
useStore.getState = snap
return { useStore }
@@ -31,7 +37,7 @@ const { NOTIF_ASKED_KEY, _resetNotifAsk } = await import('../lib/rest-alert.js')
let host, root
beforeEach(() => {
- Object.assign(h, { MOBILE: true, display: 'prompt', after: 'granted', requests: 0 })
+ Object.assign(h, { MOBILE: true, display: 'prompt', after: 'granted', requests: 0, health: { status: 'unsupported', granted: false, platform: null }, healthOn: false, enable: [] })
h.finish.mockReset()
localStorage.clear()
_resetNotifAsk()
@@ -93,3 +99,47 @@ describe('the screen', () => {
expect(h.finish).toHaveBeenCalledTimes(1)
})
})
+
+describe('Apple Health, on the iPhone', () => {
+ const iphone = () => { h.display = 'granted'; h.health = { status: 'available', granted: false, platform: 'ios' } }
+
+ it('is due on an iPhone with Apple Health while it is off; never on Android or once on', async () => {
+ iphone()
+ expect((await pendingSteps()).map(s => s.id)).toEqual(['appleHealth'])
+ h.healthOn = true
+ expect(await pendingSteps()).toEqual([])
+ h.healthOn = false
+ h.health = { status: 'available', granted: false, platform: 'android' }
+ expect(await pendingSteps()).toEqual([])
+ h.health = { status: 'unsupported', granted: false, platform: 'ios' }
+ expect(await pendingSteps()).toEqual([])
+ })
+
+ it('comes after notifications', async () => {
+ h.health = { status: 'available', granted: false, platform: 'ios' }
+ expect((await pendingSteps()).map(s => s.id)).toEqual(['notifications', 'appleHealth'])
+ })
+
+ it('explains it; Allow asks iOS and switches the setting on', async () => {
+ iphone()
+ await mount()
+ expect(host.textContent).toContain('Your workouts in Apple Health')
+ expect(host.textContent).toContain('Heart rate per set on your Apple Watch')
+ expect(host.textContent).toContain('You can change it anytime in Settings.')
+ expect(host.textContent).not.toMatch(/—/)
+ await click(button('Allow'))
+ expect(h.enable).toHaveLength(1)
+ expect(h.enable[0]).toMatchObject({ unit: 'kg' })
+ expect(h.finish).toHaveBeenCalledTimes(1)
+ expect(JSON.parse(localStorage.getItem(SEEN_KEY))).toEqual(['appleHealth'])
+ })
+
+ it('Not now leaves it off and goes on', async () => {
+ iphone()
+ await mount()
+ await click(button('Not now'))
+ expect(h.enable).toEqual([])
+ expect(h.healthOn).toBe(false)
+ expect(h.finish).toHaveBeenCalledTimes(1)
+ })
+})
diff --git a/frontend/src/views/Settings.health.test.jsx b/frontend/src/views/Settings.health.test.jsx
index 9c94b6017..e66af4ad6 100644
--- a/frontend/src/views/Settings.health.test.jsx
+++ b/frontend/src/views/Settings.health.test.jsx
@@ -137,3 +137,32 @@ describe('Settings — Health Connect', () => {
expect(mocks.openHealthConnect).toHaveBeenCalledTimes(1)
})
})
+
+// The iPhone app: the same card for Apple Health, the switch the Apple Watch app goes by too.
+describe('Settings — Apple Health', () => {
+ beforeEach(() => { mocks.android = false; mocks.status = { status: 'available', granted: false, platform: 'ios' } })
+ const appleSwitch = () => row('Write to Apple Health')?.querySelector('[role="switch"]')
+
+ it('is there on the iPhone app, in Apple Health words', async () => {
+ await mount()
+ expect(appleSwitch().getAttribute('aria-checked')).toBe('false')
+ expect(row('Health Connect')).toBeUndefined()
+ await act(async () => { appleSwitch().click() })
+ expect(mocks.enableHealth).toHaveBeenCalledTimes(1)
+ expect(mocks.toast).toHaveBeenCalledWith('Writing to Apple Health')
+ expect(row('Open Apple Health')).toBeTruthy()
+ })
+
+ it('asks in Apple Health words before turning it off', async () => {
+ mocks.health = { on: true, written: {}, error: null }
+ await mount()
+ act(() => { appleSwitch().click() })
+ expect(mocks.menuSheet.mock.calls[0][0].title).toBe('Stop writing to Apple Health?')
+ })
+
+ it('is not there on an iPhone without Apple Health', async () => {
+ mocks.status = { status: 'unsupported', granted: false, platform: 'ios' }
+ await mount()
+ expect(appleSwitch()).toBeUndefined()
+ })
+})
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index f9f9014e1..e25b24ad5 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -798,7 +798,7 @@ export default function Settings({ page = null, find = null, via = null, entryKe
{/* Android only: the system folder picker (#161). iOS shows Documents in Files already. */}
{MOBILE && android && S.autoBackup && <BackupFolderRow />}
</Section>
- {MOBILE && android && <HealthConnectCard S={S} toast={toast} />}
+ {MOBILE && <HealthConnectCard S={S} toast={toast} android={android} />}
<Section title={t('Bring data in')}>
<Row icon="download" iconTint="var(--teal)" title={t('Import backup')} accessory="chevron" onClick={() => fileRef.current.click()} />
<Row icon="download" iconTint="var(--teal)" title={t('Import from another app')}
@@ -1460,8 +1460,26 @@ function RegisterInline({ close, setUser, pushState, pullState, toast }) {
// own store for health data, where other apps can read them. A fact about this phone, kept in
// its own file (lib/health-sync.js) and not in S, so it never switches on anywhere else. The card
// stays out of the way on a phone without Health Connect, and only points to installing it on
-// Android 13 and lower, where it is an app of its own.
-function HealthConnectCard({ S, toast }) {
+// Android 13 and lower, where it is an app of its own. The iPhone app's card is the same switch for
+// Apple Health, which the Apple Watch app also goes by (heart rate per set).
+const HEALTH_COPY = {
+ android: () => ({
+ section: t('Health Connect'), write: t('Write to Health Connect'), open: t('Open Health Connect'),
+ footer: t('Workouts and weigh-ins go to Health Connect when you finish or change them. openGym reads nothing back.'),
+ on: t('Writing to Health Connect'), denied: t('Health Connect permission not granted'), failed: t('Could not write to Health Connect'),
+ removeFailed: t('Could not remove it from Health Connect'), stop: t('Stop writing to Health Connect?'),
+ stopSub: t('What openGym already wrote can stay in Health Connect as your data, or be removed from it.'),
+ }),
+ ios: () => ({
+ section: t('Apple Health'), write: t('Write to Apple Health'), open: t('Open Apple Health'),
+ footer: t('Workouts and weigh-ins go to Apple Health when you finish or change them.'),
+ on: t('Writing to Apple Health'), denied: t('Apple Health permission not granted'), failed: t('Could not write to Apple Health'),
+ removeFailed: t('Could not remove it from Apple Health'), stop: t('Stop writing to Apple Health?'),
+ stopSub: t('What openGym already wrote can stay in Apple Health as your data, or be removed from it.'),
+ }),
+}
+
+function HealthConnectCard({ S, toast, android }) {
const [st, setSt] = useState(null)
const [h, setH] = useState(null)
const [busy, setBusy] = useState(false)
@@ -1471,7 +1489,9 @@ function HealthConnectCard({ S, toast }) {
const off = onHealthChange(f => { if (!gone) setH(f) })
return () => { gone = true; off() }
}, [])
- if (!st || !h || st.status === 'unsupported') return null
+ const ios = st?.platform === 'ios'
+ if (!st || !h || st.status === 'unsupported' || (!android && !ios)) return null
+ const c = HEALTH_COPY[ios ? 'ios' : 'android']()
if (st.status !== 'available') return (
<Section title={t('Health Connect')}>
@@ -1489,21 +1509,21 @@ function HealthConnectCard({ S, toast }) {
const r = await enableHealth(S)
if (r.health) setH(r.health)
else setH(await loadHealth())
- if (r.ok) toast(t('Writing to Health Connect'))
- else toast(r.reason === 'denied' ? t('Health Connect permission not granted') : t('Could not write to Health Connect'))
- } catch { toast(t('Could not write to Health Connect')) }
+ if (r.ok) toast(c.on)
+ else toast(r.reason === 'denied' ? c.denied : c.failed)
+ } catch { toast(c.failed) }
setBusy(false)
}
const turnOff = removeWritten => async () => {
setBusy(true)
try { setH(await disableHealth({ removeWritten })) }
- catch { toast(t('Could not remove it from Health Connect')) }
+ catch { toast(c.removeFailed) }
setBusy(false)
}
// Off can mean two things for what is already there, so it asks; closing the sheet keeps it on.
const askOff = () => menuSheet({
- title: t('Stop writing to Health Connect?'),
- subtitle: t('What openGym already wrote can stay in Health Connect as your data, or be removed from it.'),
+ title: c.stop,
+ subtitle: c.stopSub,
items: [
{ icon: 'check', label: t('Stop, keep what it wrote'), onClick: turnOff(false) },
{ icon: 'trash', label: t('Stop and remove what it wrote'), danger: true, onClick: turnOff(true) },
@@ -1511,15 +1531,15 @@ function HealthConnectCard({ S, toast }) {
})
return (
- <Section title={t('Health Connect')}
- footer={h.on ? t('Workouts and weigh-ins go to Health Connect when you finish or change them. openGym reads nothing back.') : null}>
- <Row icon="heart" iconTint="var(--red)" title={t('Write to Health Connect')}
+ <Section title={c.section}
+ footer={h.on ? c.footer : 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())} />
</Row>
{h.on && h.error === 'permission' && <Row icon="warning" iconTint="var(--orange)"
title={t('Permission withdrawn. Tap to allow again')} accessory="chevron" onClick={turnOn} />}
- {h.on && <Row icon="list" iconTint="var(--blue)" title={t('Open Health Connect')}
+ {h.on && <Row icon="list" iconTint="var(--blue)" title={c.open}
accessory="chevron" onClick={() => openHealthConnect().catch(() => {})} />}
</Section>
)