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
Settings: App icon row in Look & Home on the iPhone only, Halloween shortcut on Seasonal themes, strings in every language
Duarte Santosd30177d562de
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d7421bee6..7bfba3d0a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -60,6 +60,12 @@ itself, and Settings → Look & Home → Seasonal themes has Auto, On (all year,Off, plus Spooky colors for a pumpkin orange accent. Reduce motion gets a still version, and withthe theme off nothing of it is even loaded.+**Pick your own app icon** (iPhone). Settings → Look & Home → App icon swaps the icon on your+home screen: the original, Light, Mono, one in green, blue, orange, pink or purple, or Halloween,+a pumpkin orange dumbbell with jack-o'-lantern faces under a moon, with a spider in the corner. The+Halloween one stays all year, and while the theme is on, Seasonal themes has a shortcut to it. It's+per phone and iOS asks you to confirm. Android gets the picker in the next version.+**In the workout**- **Machine taken? One tap to your backup** (#649). A routine exercise with planned backups listseach one in its ⋯ menu during a workout. Tap it and the backup takes over with the slot's owndiff --git a/docs/MOBILE.md b/docs/MOBILE.mdindex 2d90c1182..e77f28969 100644--- a/docs/MOBILE.md+++ b/docs/MOBILE.md@@ -460,6 +460,17 @@ so `npx` fetches it for that one run.(If the generator won't take the SVG directly, export it to `resources/icon.png` at1024×1024 first; any image tool can do it.)+The alternate icons people can pick in Settings → Look & Home → App icon (iPhone only in 1.4.3;+Android gets them in 1.4.4) are not made by that generator. `node scripts/app-icons.mjs` draws+them from the list in `src/lib/app-icon-variants.js` and the glyph in `resources/icon.svg`, with+no dependencies: the SVG per icon in `resources/icons/`, an `AppIcon-<Name>` set (1024 px, opaque)+per icon in the iOS asset catalog, and the previews in `public/app-icons/`. An icon with `art`+(Halloween) is a hand-made SVG in `resources/icons/` instead, which the script renders; it may use+only rect, circle, line, polyline, polygon and one two-stop radialGradient. `--check` says whether+the committed files still match. A new icon also needs its name in `AppIconPlugin.swift` and its+set in `ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES`; `scripts/app-icons.test.mjs` fails until+all of them agree.+## Distributing your own buildThe signed APK stays the way to get openGym on Android without a store, and it updates itself.diff --git a/frontend/src/components/AppIconRow.jsx b/frontend/src/components/AppIconRow.jsxnew file mode 100644index 000000000..aba433dec--- /dev/null+++ b/frontend/src/components/AppIconRow.jsx@@ -0,0 +1,50 @@+import { useEffect, useState } from 'react'+import { t } from '../lib/i18n.js'+import { appIconState, setAppIcon } from '../lib/app-icon.js'+import { APP_ICON_VARIANTS } from '../lib/app-icon-variants.js'+import { useUI } from '../store/useUI.js'+import Icon from './Icon.jsx'++/* Settings → Look & Home → App icon: the icon on this iPhone's home screen. The phone keeps the+ choice (lib/app-icon.js), so it is asked here and never synced. In a browser, on Android (1.4.3+ has no plugin there) or on a phone that cannot switch icons, the row is not there at all. */+export default function AppIconRow() {+ const [state, setState] = useState(null)+ const [busy, setBusy] = useState(false)+ useEffect(() => {+ let live = true+ appIconState().then(s => { if (live) setState(s) })+ return () => { live = false }+ }, [])+ if (!state) return null++ const pick = async id => {+ if (busy || id === state.name) return+ setBusy(true)+ try {+ // iOS confirms with its own alert, nothing to add here.+ const r = await setAppIcon(id)+ setState({ name: r.name })+ } catch (e) {+ useUI.getState().toast(t('The icon could not be changed.'))+ } finally { setBusy(false) }+ }+ const current = APP_ICON_VARIANTS.find(v => v.id === state.name) || APP_ICON_VARIANTS[0]++ return <div className="lrow app-icon-row" style={{ flexWrap: 'wrap', rowGap: 12, paddingBottom: 14 }}>+ <span className="lrow-i" style={{ '--tint': 'var(--indigo)' }}><Icon name="grid" /></span>+ <span className="lrow-m">+ <span className="lrow-t">{t('App icon')}</span>+ <span className="lrow-s">{t('Just for this phone. Some home screens take a moment to catch up.')}</span>+ </span>+ <span className="lrow-v">{t(current.name)}</span>+ <div className="app-icons" role="radiogroup" aria-label={t('App icon')}>+ {APP_ICON_VARIANTS.map(v => (+ <button key={v.id} type="button" role="radio" aria-checked={v.id === state.name} disabled={busy}+ className={'app-icon' + (v.id === state.name ? ' on' : '')} onClick={() => pick(v.id)} aria-label={t(v.name)}>+ <img src={`app-icons/${v.id}.png`} alt="" width="56" height="56" draggable="false" />+ </button>+ ))}+ </div>+ </div>+}diff --git a/frontend/src/components/AppIconRow.test.jsx b/frontend/src/components/AppIconRow.test.jsxnew file mode 100644index 000000000..53c75b8c7--- /dev/null+++ b/frontend/src/components/AppIconRow.test.jsx@@ -0,0 +1,117 @@+// @vitest-environment happy-dom+// Settings → Look & Home → App icon: the home-screen icons the phone can switch to, the one in use+// ringed, and a switch through the AppIcon plugin. iPhone only in 1.4.3: on Android (no plugin until+// 1.4.4), in a browser, or where the phone says it cannot switch icons, the row is not there at all.+import React, { act } from 'react'+import { createRoot } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { APP_ICON_VARIANTS } from '../lib/app-icon-variants.js'++globalThis.IS_REACT_ACT_ENVIRONMENT = true++const m = vi.hoisted(() => ({ state: { supported: true, name: 'default' }, later: false, fail: false, calls: [], asked: 0, toast: null }))+vi.mock('../lib/mobile.js', () => ({ MOBILE: true }))+vi.mock('../store/useUI.js', () => ({ useUI: { getState: () => ({ toast: m.toast }) } }))+// Like the real proxy: `then` is a native call that never settles (lib/app-icon.js keeps it in an object).+vi.mock('@capacitor/core', () => ({+ registerPlugin: () => new Proxy({}, {+ get: (_, prop) => {+ if (prop === 'then') return () => new Promise(() => {})+ if (prop === 'getIcon') return async () => { m.asked++; return { ...m.state } }+ if (prop === 'setIcon') return async arg => {+ m.calls.push(arg)+ if (m.fail) throw new Error('refused')+ m.state = { ...m.state, name: arg.name }+ return { name: arg.name, later: m.later }+ }+ return undefined+ },+ }),+}))++const { default: AppIconRow } = await import('./AppIconRow.jsx')+const { _resetAppIconForTests } = await import('../lib/app-icon.js')+const { searchSettings } = await import('../views/settings-pages.js')++let host, root+beforeEach(() => {+ Object.assign(m, { state: { supported: true, name: 'default' }, later: false, fail: false, calls: [], asked: 0, toast: vi.fn() })+ globalThis.Capacitor = { getPlatform: () => 'ios' }+ _resetAppIconForTests()+ host = document.createElement('div'); document.body.appendChild(host); root = createRoot(host)+})+afterEach(() => { act(() => root.unmount()); host.remove(); delete globalThis.Capacitor })++const mount = async () => { await act(async () => { root.render(<AppIconRow />) }) }+const buttons = () => [...host.querySelectorAll('.app-icon')]+const chosen = () => buttons().filter(b => b.classList.contains('on')).map(b => b.getAttribute('aria-label'))+const tap = async label => { await act(async () => { buttons().find(b => b.getAttribute('aria-label') === label).click() }) }++describe('App icon row', () => {+ it('shows every icon with its preview and rings the one on the home screen', async () => {+ m.state.name = 'mono'+ await mount()+ expect(host.querySelector('.lrow-t').textContent).toBe('App icon')+ expect(buttons().map(b => b.getAttribute('aria-label'))).toEqual(APP_ICON_VARIANTS.map(v => v.name))+ expect(buttons().map(b => b.querySelector('img').getAttribute('src'))).toEqual(APP_ICON_VARIANTS.map(v => `app-icons/${v.id}.png`))+ expect(chosen()).toEqual(['Mono'])+ expect(host.querySelector('.lrow-v').textContent).toBe('Mono')+ })++ it('switches on iOS, where the system alert is all the confirmation there is', async () => {+ await mount()+ await tap('Pink')+ expect(m.calls).toEqual([{ name: 'pink' }])+ expect(chosen()).toEqual(['Pink'])+ expect(m.toast).not.toHaveBeenCalled()+ })++ it('offers the Halloween icon last, all year', async () => {+ await mount()+ expect(buttons().at(-1).getAttribute('aria-label')).toBe('Halloween')+ await tap('Halloween')+ expect(m.calls).toEqual([{ name: 'halloween' }])+ expect(chosen()).toEqual(['Halloween'])+ })++ it('a tap on the icon in use asks the phone nothing', async () => {+ await mount()+ await tap('Original')+ expect(m.calls).toEqual([])+ })++ it('keeps the old ring and says so when the phone refuses', async () => {+ m.fail = true+ await mount()+ await tap('Light')+ expect(chosen()).toEqual(['Original'])+ expect(m.toast).toHaveBeenCalledWith('The icon could not be changed.')+ })++ it('is not there where the phone cannot switch icons', async () => {+ m.state.supported = false+ await mount()+ expect(host.innerHTML).toBe('')+ })++ it('is not there on Android in 1.4.3, and the phone is not even asked', async () => {+ globalThis.Capacitor = { getPlatform: () => 'android' }+ await mount()+ expect(host.innerHTML).toBe('')+ expect(m.asked).toBe(0)+ })++ it('is not there in a browser', async () => {+ delete globalThis.Capacitor+ await mount()+ expect(host.innerHTML).toBe('')+ expect(m.calls).toEqual([])+ })++ it('the settings search offers it only where the row can show', () => {+ const tr = s => s+ const ctx = { user: null, mobile: true, android: true, demo: false }+ expect(searchSettings('app icon', { ...ctx, appIcons: true }, tr).map(h => h.title)).toEqual(['App icon'])+ expect(searchSettings('app icon', { ...ctx, mobile: false, appIcons: false }, tr)).toEqual([])+ })+})diff --git a/frontend/src/index.css b/frontend/src/index.cssindex cba4b6ab5..acb41bac8 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -1935,6 +1935,13 @@ body.no-tabbar.resting #toast{bottom:calc(100px + var(--sab))}}.swatch-input{position:absolute;inset:0;width:100%;height:100%;opacity:0;border:0;padding:0;margin:0;border-radius:50%;cursor:pointer;-webkit-appearance:none;appearance:none}.swatch-note{margin-top:-4px}+/* Settings → App icon: the previews in the shape of a home-screen icon, the chosen one ringed like a swatch. */+.app-icons{flex-basis:100%;padding-inline-start:41px;display:grid;grid-template-columns:repeat(auto-fill,minmax(52px,1fr));gap:12px}+.app-icon{position:relative;aspect-ratio:1;max-width:60px;border-radius:23%;padding:0;transition:transform var(--fast)}+.app-icon img{width:100%;height:100%;display:block;border-radius:inherit;box-shadow:0 0 0 .5px var(--sep)}+.app-icon:active{transform:scale(.92)}+.app-icon:disabled{opacity:1}+.app-icon.on::after{content:'';position:absolute;inset:-4px;border-radius:27%;box-shadow:0 0 0 2px var(--acc);pointer-events:none}/* --- supersets --- */.ss-label{diff --git a/frontend/src/lib/app-icon.js b/frontend/src/lib/app-icon.jsnew file mode 100644index 000000000..df207ef15--- /dev/null+++ b/frontend/src/lib/app-icon.js@@ -0,0 +1,43 @@+// The home-screen icon of the iPhone app (Settings → Look & Home → App icon). iOS itself keeps the+// choice, as its alternate icon (AppIconPlugin.swift). Nothing goes into the synced state, so two+// phones can wear different icons. 1.4.3 has no Android plugin (1.4.4 adds launcher aliases), and+// a browser has no icon to change: there this answers null and the row stays away.+import { MOBILE } from './mobile.js'+import { platformNow } from './platform-now.js'+import { APP_ICON_IDS } from './app-icon-variants.js'++// Kept inside an object: a Capacitor plugin proxy answers `then` with a native call that never+// settles, so a promise resolved with the bare proxy would hang (the Coach hang, #42).+let pluginP = null+const iconPlugin = () => pluginP || (pluginP = (async () => {+ if (!MOBILE || platformNow() !== 'ios') return null+ const { registerPlugin } = await import('@capacitor/core')+ return { p: registerPlugin('AppIcon') }+})().catch(() => null))++/** { name } of the icon on the home screen now (or the one about to be), or null without the option. */+export async function appIconState() {+ try {+ const w = await iconPlugin()+ if (!w) return null+ const r = await w.p.getIcon()+ if (!r || !r.supported) return null+ return { name: APP_ICON_IDS.includes(r.name) ? r.name : 'default' }+ } catch {+ return null+ }+}++/**+ * Switches the icon. Resolves { name, later }; `later` is for 1.4.4's Android launcher, which only+ * takes the new icon once the app is in the background. Throws when the phone refused.+ */+export async function setAppIcon(name) {+ if (!APP_ICON_IDS.includes(name)) throw new Error('unknown icon')+ const w = await iconPlugin()+ if (!w) throw new Error('no app icon plugin')+ const r = await w.p.setIcon({ name })+ return { name: r?.name || name, later: !!r?.later }+}++export function _resetAppIconForTests() { pluginP = null }diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex fcbbe27ca..790a911d5 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('f18b915a058ef3d5bed71edb043b1726f61c082b0174c52dbcbe61bd45fc812d')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1c950a515a382619480bf3db78786914c95b20d2904f85517cc6c8e0f86fd8a9')})// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button thatdiff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex 9a38e2746..d5afaa70a 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -2636,4 +2636,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'بوو! الخفافيش لم تكن جزءًا من الإحماء.','Boo! Found it. The spiders owe you a rep.': 'بوو! وجدتها. العناكب مدينة لك بتكرار.','The pumpkin is napping. Come back tomorrow.': 'اليقطينة تأخذ قيلولة. عد غدًا.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'أيقونة التطبيق',+ 'Original': 'الأصلية',+ 'Mono': 'أحادية',+ 'Just for this phone. Some home screens take a moment to catch up.': 'لهذا الهاتف فقط. بعض الشاشات الرئيسية تحتاج لحظة لتلحق.',+ 'The icon could not be changed.': 'تعذّر تغيير الأيقونة.',+ 'Try the Halloween app icon': 'جرّب أيقونة التطبيق الخاصة بالهالوين',}diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.jsindex 1079c97db..d3d5852d2 100644--- a/frontend/src/locales/bn.js+++ b/frontend/src/locales/bn.js@@ -2660,4 +2660,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'বু! বাদুড়গুলো ওয়ার্ম-আপের অংশ ছিল না।','Boo! Found it. The spiders owe you a rep.': 'বু! পেয়ে গেছেন। মাকড়সাদের কাছে আপনার একটা রেপ পাওনা।','The pumpkin is napping. Come back tomorrow.': 'কুমড়োটা ঘুমোচ্ছে। কাল আবার আসুন।',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'অ্যাপ আইকন',+ 'Original': 'আসল',+ 'Mono': 'মনো',+ 'Just for this phone. Some home screens take a moment to catch up.': 'শুধু এই ফোনের জন্য। কিছু হোম স্ক্রিন বুঝতে একটু সময় নেয়।',+ 'The icon could not be changed.': 'আইকন বদলানো গেল না।',+ 'Try the Halloween app icon': 'হ্যালোইন অ্যাপ আইকন চেষ্টা করুন',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 0ff043d2a..f0beeb6d6 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -2601,4 +2601,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Buh! Die Fledermäuse gehörten nicht zum Aufwärmen.','Boo! Found it. The spiders owe you a rep.': 'Buh! Gefunden. Die Spinnen schulden dir eine Wiederholung.','The pumpkin is napping. Come back tomorrow.': 'Der Kürbis macht ein Nickerchen. Komm morgen wieder.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'App-Icon',+ 'Original': 'Original',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Nur für dieses Handy. Manche Startbildschirme brauchen einen Moment, bis sie mitkommen.',+ 'The icon could not be changed.': 'Das Icon ließ sich nicht ändern.',+ 'Try the Halloween app icon': 'Probier das Halloween-App-Icon',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 2e84d8723..20dd2450b 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': '¡Bu! Los murciélagos no eran parte del calentamiento.','Boo! Found it. The spiders owe you a rep.': '¡Bu! Encontrada. Las arañas te deben una repetición.','The pumpkin is napping. Come back tomorrow.': 'La calabaza está echando la siesta. Vuelve mañana.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Icono de la app',+ 'Original': 'Original',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Solo para este móvil. Algunas pantallas de inicio tardan un momento en enterarse.',+ 'The icon could not be changed.': 'No se pudo cambiar el icono.',+ 'Try the Halloween app icon': 'Prueba el icono de Halloween',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex a6e10eba2..c7d1bd3f8 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bouh ! Les chauves-souris ne faisaient pas partie de l\'échauffement.','Boo! Found it. The spiders owe you a rep.': 'Bouh ! Trouvée. Les araignées te doivent une répétition.','The pumpkin is napping. Come back tomorrow.': 'La citrouille fait la sieste. Reviens demain.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Icône de l’app',+ 'Original': 'Originale',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Rien que pour ce téléphone. Certains écrans d’accueil mettent un instant à suivre.',+ 'The icon could not be changed.': 'Impossible de changer l’icône.',+ 'Try the Halloween app icon': 'Essaie l’icône d’app Halloween',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 8d300abd8..6feb640bf 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'बू! चमगादड़ वार्म-अप का हिस्सा नहीं थे।','Boo! Found it. The spiders owe you a rep.': 'बू! मिल गया। मकड़ियों पर आपका एक रेप उधार है।','The pumpkin is napping. Come back tomorrow.': 'कद्दू झपकी ले रहा है। कल फिर आइए।',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'ऐप आइकन',+ 'Original': 'मूल',+ 'Mono': 'मोनो',+ 'Just for this phone. Some home screens take a moment to catch up.': 'सिर्फ़ इस फ़ोन के लिए। कुछ होम स्क्रीन को समझने में थोड़ा समय लगता है।',+ 'The icon could not be changed.': 'आइकन बदला नहीं जा सका।',+ 'Try the Halloween app icon': 'हैलोवीन ऐप आइकन आज़माएँ',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex d643bca0b..b19e60407 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -2584,4 +2584,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bú! A denevérek nem voltak a bemelegítés részei.','Boo! Found it. The spiders owe you a rep.': 'Bú! Megvan. A pókok tartoznak neked egy ismétléssel.','The pumpkin is napping. Come back tomorrow.': 'A tök épp szundikál. Gyere vissza holnap.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Alkalmazásikon',+ 'Original': 'Eredeti',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Csak ezen a telefonon. Néhány kezdőképernyőnek kell egy pillanat, mire észreveszi.',+ 'The icon could not be changed.': 'Nem sikerült megváltoztatni az ikont.',+ 'Try the Halloween app icon': 'Próbáld ki a halloweeni alkalmazásikont',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 457ab333a..9984a4c12 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bu! I pipistrelli non facevano parte del riscaldamento.','Boo! Found it. The spiders owe you a rep.': 'Bu! Trovata. I ragni ti devono una ripetizione.','The pumpkin is napping. Come back tomorrow.': 'La zucca sta facendo un pisolino. Torna domani.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Icona dell’app',+ 'Original': 'Originale',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Solo per questo telefono. Alcune schermate Home ci mettono un attimo ad accorgersene.',+ 'The icon could not be changed.': 'Non è stato possibile cambiare l’icona.',+ 'Try the Halloween app icon': 'Prova l’icona di Halloween',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex ab1e31f92..41a4301e4 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': '왁! 박쥐는 워밍업에 없던 거예요.','Boo! Found it. The spiders owe you a rep.': '왁! 찾았다. 거미들이 1회 빚졌어요.','The pumpkin is napping. Come back tomorrow.': '호박이 낮잠 자는 중이에요. 내일 다시 와 주세요.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': '앱 아이콘',+ 'Original': '기본',+ 'Mono': '모노',+ 'Just for this phone. Some home screens take a moment to catch up.': '이 휴대폰에만 적용돼요. 홈 화면에 따라 바뀌는 데 잠깐 걸릴 수 있어요.',+ 'The icon could not be changed.': '아이콘을 바꾸지 못했어요.',+ 'Try the Halloween app icon': '핼러윈 앱 아이콘 써 보기',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 08c0eac1a..fc41e0187 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bu! Nietoperze nie były częścią rozgrzewki.','Boo! Found it. The spiders owe you a rep.': 'Bu! Mam ją. Pająki są Ci winne jedno powtórzenie.','The pumpkin is napping. Come back tomorrow.': 'Dynia ucina sobie drzemkę. Wróć jutro.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Ikona aplikacji',+ 'Original': 'Oryginalna',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Tylko na tym telefonie. Niektóre ekrany główne potrzebują chwili, żeby to załapać.',+ 'The icon could not be changed.': 'Nie udało się zmienić ikony.',+ 'Try the Halloween app icon': 'Wypróbuj halloweenową ikonę aplikacji',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex e19b048b3..8b06bdaaa 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1666,6 +1666,10 @@ export const PT_BR_OVERRIDES = {'Boo! Found it. The spiders owe you a rep.': 'Bu! Achou. As aranhas te devem uma repetição.','The pumpkin is napping. Come back tomorrow.': 'A abóbora está tirando uma soneca. Volte amanhã.','Back next October. The spiders are on holiday.': 'Volta em outubro. As aranhas estão de férias.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Ícone do app',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Só para este celular. Algumas telas iniciais demoram um pouco para perceber.',+ 'Try the Halloween app icon': 'Experimente o ícone de Halloween do app',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 779f65a50..9d9706552 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bu! Os morcegos não faziam parte do aquecimento.','Boo! Found it. The spiders owe you a rep.': 'Bu! Encontrada. As aranhas devem-te uma repetição.','The pumpkin is napping. Come back tomorrow.': 'A abóbora está a dormir a sesta. Volta amanhã.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Ícone da app',+ 'Original': 'Original',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Só para este telemóvel. Alguns ecrãs principais demoram um momento a perceber.',+ 'The icon could not be changed.': 'Não foi possível mudar o ícone.',+ 'Try the Halloween app icon': 'Experimenta o ícone de Halloween da app',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 12d74ea25..4756c48b1 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -2585,4 +2585,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Бу! Летучие мыши не входили в разминку.','Boo! Found it. The spiders owe you a rep.': 'Бу! Есть! Пауки должны тебе один повтор.','The pumpkin is napping. Come back tomorrow.': 'Тыква дремлет. Загляни завтра.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Значок приложения',+ 'Original': 'Оригинал',+ 'Mono': 'Моно',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Только для этого телефона. Некоторым рабочим столам нужна минутка, чтобы заметить.',+ 'The icon could not be changed.': 'Не удалось сменить значок.',+ 'Try the Halloween app icon': 'Попробуй хеллоуинский значок приложения',}diff --git a/frontend/src/locales/sv.js b/frontend/src/locales/sv.jsindex 86d33fd0f..045ddcb93 100644--- a/frontend/src/locales/sv.js+++ b/frontend/src/locales/sv.js@@ -2628,4 +2628,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bu! Fladdermössen var inte en del av uppvärmningen.','Boo! Found it. The spiders owe you a rep.': 'Bu! Hittad. Spindlarna är skyldiga dig en rep.','The pumpkin is napping. Come back tomorrow.': 'Pumpan tar en tupplur. Kom tillbaka i morgon.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Appikon',+ 'Original': 'Original',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Bara för den här telefonen. Vissa hemskärmar behöver en stund på sig att hänga med.',+ 'The icon could not be changed.': 'Ikonen gick inte att byta.',+ 'Try the Halloween app icon': 'Testa Halloween-appikonen',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 50c0bd1c8..c45aa067f 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -2592,4 +2592,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'แฮ่! ค้างคาวไม่ได้อยู่ในการวอร์มอัพนะ','Boo! Found it. The spiders owe you a rep.': 'แฮ่! เจอแล้ว แมงมุมติดคุณหนึ่งครั้ง','The pumpkin is napping. Come back tomorrow.': 'ฟักทองกำลังงีบ พรุ่งนี้มาใหม่นะ',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'ไอคอนแอป',+ 'Original': 'ดั้งเดิม',+ 'Mono': 'โมโน',+ 'Just for this phone. Some home screens take a moment to catch up.': 'เฉพาะโทรศัพท์เครื่องนี้ หน้าจอโฮมบางแบบต้องใช้เวลาสักครู่ถึงจะเปลี่ยน',+ 'The icon could not be changed.': 'เปลี่ยนไอคอนไม่ได้',+ 'Try the Halloween app icon': 'ลองไอคอนแอปฮาโลวีน',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 72affc211..72eb2d772 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Bö! Yarasalar ısınmanın bir parçası değildi.','Boo! Found it. The spiders owe you a rep.': 'Bö! Buldun. Örümcekler sana bir tekrar borçlu.','The pumpkin is napping. Come back tomorrow.': 'Balkabağı şekerleme yapıyor. Yarın tekrar gel.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Uygulama simgesi',+ 'Original': 'Orijinal',+ 'Mono': 'Mono',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Yalnızca bu telefon için. Bazı ana ekranların fark etmesi biraz sürer.',+ 'The icon could not be changed.': 'Simge değiştirilemedi.',+ 'Try the Halloween app icon': 'Cadılar Bayramı uygulama simgesini dene',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex bea8f0072..3d341808a 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -2578,4 +2578,11 @@ export default {'Boo! The bats were not part of the warm-up.': 'Бу! Кажани не входили в розминку.','Boo! Found it. The spiders owe you a rep.': 'Бу! Є! Павуки винні тобі одне повторення.','The pumpkin is napping. Come back tomorrow.': 'Гарбуз дрімає. Зазирни завтра.',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'Значок застосунку',+ 'Original': 'Оригінал',+ 'Mono': 'Моно',+ 'Just for this phone. Some home screens take a moment to catch up.': 'Лише для цього телефона. Деяким домашнім екранам треба хвилинка, щоб помітити.',+ 'The icon could not be changed.': 'Не вдалося змінити значок.',+ 'Try the Halloween app icon': 'Спробуй гелловінський значок застосунку',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex a9e7a28e2..bee3b2c4a 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -2574,4 +2574,11 @@ export default {'Boo! The bats were not part of the warm-up.': '嚇!蝙蝠可不在熱身組裡。','Boo! Found it. The spiders owe you a rep.': '嚇!找到了。蜘蛛們欠你一下。','The pumpkin is napping. Come back tomorrow.': '南瓜在打盹,明天再來吧。',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': 'App 圖示',+ 'Original': '原版',+ 'Mono': '單色',+ 'Just for this phone. Some home screens take a moment to catch up.': '只限這支手機。有些主畫面要過一下才會跟上。',+ 'The icon could not be changed.': '無法更換圖示。',+ 'Try the Halloween app icon': '試試萬聖節 App 圖示',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex bf2b4e51a..ca1479573 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -2581,4 +2581,11 @@ export default {'Boo! The bats were not part of the warm-up.': '吓!蝙蝠可不在热身计划里。','Boo! Found it. The spiders owe you a rep.': '吓!找到了。蜘蛛们欠你一次。','The pumpkin is napping. Come back tomorrow.': '南瓜在打盹,明天再来吧。',+ // --- Settings → App icon (the phone app's home-screen icon) ---+ 'App icon': '应用图标',+ 'Original': '原版',+ 'Mono': '单色',+ 'Just for this phone. Some home screens take a moment to catch up.': '仅限这部手机。有些主屏幕要过一会儿才会跟上。',+ 'The icon could not be changed.': '无法更换图标。',+ 'Try the Halloween app icon': '试试万圣节应用图标',}diff --git a/frontend/src/views/Settings.app-icon.test.jsx b/frontend/src/views/Settings.app-icon.test.jsxnew file mode 100644index 000000000..ba08d2806--- /dev/null+++ b/frontend/src/views/Settings.app-icon.test.jsx@@ -0,0 +1,128 @@+// @vitest-environment happy-dom+// Settings → Look & Home → App icon in 1.4.3: the row only in the iPhone app (no Android plugin+// until 1.4.4, nothing to change on the web), and while Halloween shows, a shortcut to it from+// Seasonal themes on the iPhone.+import React, { act } from 'react'+import { createRoot } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import Settings from './Settings.jsx'+import { bindUI } from '../components/ui.jsx'++globalThis.IS_REACT_ACT_ENVIRONMENT = true++const mocks = vi.hoisted(() => {+ const state = { S: null, MOBILE: false, user: null, nav: null }+ state.snapshot = () => ({+ S: state.S,+ user: state.user,+ update: mut => {+ const next = structuredClone(state.S)+ mut(next)+ state.S = next+ },+ replaceState: vi.fn(), setUser: vi.fn(), pullState: vi.fn(), pushState: vi.fn(),+ signOut: vi.fn(), signOutAll: vi.fn(), resetDemo: vi.fn(), disconnectServer: vi.fn(),+ })+ return state+})+vi.mock('../store/useStore.js', () => {+ const useStore = selector => selector ? selector(mocks.snapshot()) : mocks.snapshot()+ useStore.getState = mocks.snapshot+ return { useStore, DEF: { reminder: { time: '17:30' } }, hasData: () => false }+})+vi.mock('../store/useUI.js', () => {+ const snap = () => ({ toast: vi.fn(), openSheet: vi.fn() })+ const useUI = selector => selector ? selector(snap()) : snap()+ useUI.getState = snap+ return { useUI }+})+vi.mock('react-router-dom', () => ({ useNavigate: () => mocks.nav }))+// The row itself has its own test (components/AppIconRow.test.jsx); here only where it shows.+vi.mock('../components/AppIconRow.jsx', () => ({ default: () => <div className="app-icon-stub" /> }))+vi.mock('../lib/api.js', () => ({+ api: vi.fn(), webauthnOK: () => false, passkeyLogin: vi.fn(), passkeyRegister: vi.fn(), IS_ANDROID: false,+}))+vi.mock('../lib/push.js', () => ({ pushSupported: () => false, enablePush: vi.fn(), disablePush: vi.fn(), sendTestPush: vi.fn() }))+vi.mock('../lib/wakelock.js', () => ({ wakeLockSupported: () => false }))+vi.mock('../lib/mobile.js', () => ({ get MOBILE() { return mocks.MOBILE }, isAndroid: () => Promise.resolve(false), shareExport: vi.fn(), syncReminder: vi.fn() }))+vi.mock('./MobileOnboarding.jsx', () => ({ ConnectSheet: () => null }))+vi.mock('../sheets.jsx', () => ({+ loadStarterPlan: vi.fn(), starterPlanSheet: vi.fn(), confirmSheet: vi.fn(), importFromApp: vi.fn(),+ importFromHevy: vi.fn(), equipmentProfileSheet: vi.fn(),+}))++// The Settings view reads the build-time version constant at render time.+globalThis.__APP_VERSION__ ??= 'test'++bindUI({ getState: () => ({ openSheet: () => ({ close: () => {} }) }) })++let host, root+beforeEach(() => {+ mocks.S = {+ unit: 'kg', restSec: 90, restPauseSec: 15, sound: false, effort: 'none',+ gifSize: 'full', workouts: [], routines: [], exWeights: {}, seasonal: { halloween: 'on' },+ }+ mocks.MOBILE = true+ mocks.user = null+ mocks.nav = vi.fn()+ globalThis.Capacitor = { getPlatform: () => 'ios' }+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})+afterEach(() => {+ act(() => root.unmount())+ host.remove()+ delete globalThis.Capacitor+})++const mount = page => act(() => root.render(<Settings page={page} />))+const rowOf = title => [...host.querySelectorAll('.lrow')].find(r => r.querySelector('.lrow-t')?.textContent === title)+const picker = () => !!host.querySelector('.app-icon-stub')+const shortcut = () => rowOf('Try the Halloween app icon')++describe('App icon row in Look & Home', () => {+ it('is there in the iPhone app', async () => {+ await mount('look')+ expect(picker()).toBe(true)+ })++ it('is not there in the Android app (1.4.3 keeps its one launcher icon)', async () => {+ globalThis.Capacitor = { getPlatform: () => 'android' }+ await mount('look')+ expect(picker()).toBe(false)+ })++ it('is not there on the web', async () => {+ mocks.MOBILE = false+ delete globalThis.Capacitor+ await mount('look')+ expect(picker()).toBe(false)+ })+})++describe('Seasonal themes: the Halloween icon shortcut', () => {+ it('shows on the iPhone while Halloween is on and opens the picker', async () => {+ await mount('themes')+ expect(shortcut()).toBeTruthy()+ await act(async () => { shortcut().click() })+ expect(mocks.nav).toHaveBeenCalledWith('/settings/look', { state: { find: 'App icon' } })+ })++ it('stays away when Halloween is off', async () => {+ mocks.S.seasonal = { halloween: 'off' }+ await mount('themes')+ expect(shortcut()).toBeFalsy()+ })++ it('stays away on Android and on the web', async () => {+ globalThis.Capacitor = { getPlatform: () => 'android' }+ await mount('themes')+ expect(shortcut()).toBeFalsy()+ act(() => root.unmount()); root = createRoot(host)+ mocks.MOBILE = false+ delete globalThis.Capacitor+ await mount('themes')+ expect(shortcut()).toBeFalsy()+ })+})diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex 17314fb3d..479d7fa68 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -44,6 +44,7 @@ import Icon from '../components/Icon.jsx'import { durationSheet } from '../components/DurationWheel.jsx'import { showsConnection, showsLocalLine } from '../components/SyncBanner.jsx'import BackupFolderRow, { useBackupFolder, autoBackupSubtitle } from '../components/BackupFolderRow.jsx'+import AppIconRow from '../components/AppIconRow.jsx'import { AnimationQualityRow } from '../components/Animations.jsx'import { ServerSyncSection, KeptChangesRows, leaveServer, connectServer, passkeySignIn } from '../components/ServerSync.jsx'import { passwordOn, PasswordRow, openPasswordSignIn, openPasswordRegister } from '../components/PasswordAuth.jsx'@@ -428,7 +429,7 @@ export default function Settings({ page = null, find = null, via = null, entryKe/* ---------------- what the pages and the search need to know about this device ---------------- */const canVibrate = vibrateSupported()const ctx = {- user, mobile: MOBILE, android, ios: MOBILE && ios, demo: DEMO, wakeOK, hasMedia, pwOn, webauthn: webauthnOK(),+ user, mobile: MOBILE, android, ios: MOBILE && ios, appIcons: MOBILE && platformNow() === 'ios', demo: DEMO, wakeOK, hasMedia, pwOn, webauthn: webauthnOK(),sound: !!S.sound, playOnSilent: playOnSilentSupported(), canVibrate, vibrate: S.vibrate !== false,profiles: (S.equipProfiles || []).length > 0, nameLang: EXERCISE_NAME_LANGS.includes(baseLang(lang)),pushOK: !MOBILE && pushSupported(), reminderOn: !!S.reminder?.on, nudge: !!S.reminder?.nudge,@@ -827,6 +828,8 @@ export default function Settings({ page = null, find = null, via = null, entryKe<span className="lrow-v">{accentLabel(S)}</span><AccentSwatches S={S} update={update} /></div>+ {/* The home-screen icon: the phone's own, not synced. iPhone only in 1.4.3 (Android follows). */}+ {MOBILE && platformNow() === 'ios' && <AppIconRow />}{/* How the muscle map is drawn. The exercise drawings follow it until they are set below. */}<Row icon="figureStrength" iconTint="var(--teal)" title={t('Body diagram')}><Segmented@@ -901,6 +904,11 @@ export default function Settings({ page = null, find = null, via = null, entryKe</Row>}</Section>})}+ {/* While Halloween shows, a way to the matching icon in Look & Home (it is there all year). */}+ {MOBILE && platformNow() === 'ios' && activeSeason(S) === 'halloween' && <Section>+ <Row icon="pumpkin" iconTint="var(--orange)" title={t('Try the Halloween app icon')} accessory="chevron"+ onClick={() => nav('/settings/look', { state: { find: 'App icon' } })} />+ </Section>}</>,data: () => <>diff --git a/frontend/src/views/settings-pages.js b/frontend/src/views/settings-pages.jsindex 9142d889b..dc74e4d2f 100644--- a/frontend/src/views/settings-pages.js+++ b/frontend/src/views/settings-pages.js@@ -122,6 +122,7 @@ export const SEARCH = [// Look & Home{ page: 'look', title: 'Theme', icon: 'moon', tint: 'var(--indigo)', kw: 'dark mode light mode theme appearance night', opts: ['Dark', 'Light', 'System'] },{ page: 'look', title: 'Accent color', icon: 'palette', tint: 'var(--purple)', kw: 'color colour accent tint custom own picker hex rgb', opts: [...Object.values(ACCENT_NAMES), 'Your own color'], tkw: () => t('custom color picker') },+ { page: 'look', title: 'App icon', icon: 'grid', tint: 'var(--indigo)', kw: 'app icon home screen launcher logo dark light', when: c => !!c.appIcons },{ page: 'look', title: 'Body diagram', icon: 'figureStrength', tint: 'var(--teal)', kw: 'muscle map body male female', opts: ['Male', 'Female'] },{ page: 'look', title: 'Exercise drawings', icon: 'figureStrength', tint: 'var(--teal)', kw: 'figure male female woman man picture', opts: ['Male', 'Female'] },{ page: 'look', title: 'Gym check-in', icon: 'qr', tint: 'var(--blue)', kw: 'qr code membership card check in barcode' },