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.

iOS: first-start permission screens lead straight to the OS dialog (App Review 5.1.1(iv))

Duarte Santos96a0dddd8af0
diff --git a/frontend/src/lib/onboarding-perms.js b/frontend/src/lib/onboarding-perms.js
index 5fe9873ea..f2244edea 100644
--- a/frontend/src/lib/onboarding-perms.js
+++ b/frontend/src/lib/onboarding-perms.js
@@ -1,18 +1,17 @@
// The phone app's first-start permission steps: right after "Use on this device" or a finished
-// pairing, one short screen per thing the OS has to be asked about, each with Allow / Not now
-// (views/PermissionSteps.jsx renders them). The OS dialog alone says nothing about why; asked
-// cold, mid-rest, people tap "Don't allow" and the rest timer never reaches the lock screen.
+// pairing, one short screen per thing the OS has to be asked about, each with one Continue that
+// leads to the OS dialog (views/PermissionSteps.jsx renders them). The OS dialog alone says
+// nothing about why; asked cold, mid-rest, people tap "Don't allow" and the rest timer never reaches the lock screen.
//
// A step is { id, state(), request() }. state() answers 'prompt' when there is something to
// 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.
+// shown once per device, whatever the answer in the OS dialog.
//
-// iPhone only, Apple Health: Allow asks iOS for it (saving workouts and weigh-ins, reading the
+// iPhone only, Apple Health: Continue 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.
+// as Settings → Apple Health (lib/health-sync.js), which the Apple Watch app goes by too. Turning it all
+// off in the iOS sheet is the no; Settings can switch it off too. 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'
diff --git a/frontend/src/views/PermissionSteps.jsx b/frontend/src/views/PermissionSteps.jsx
index 892a3a2cf..0dc5c455c 100644
--- a/frontend/src/views/PermissionSteps.jsx
+++ b/frontend/src/views/PermissionSteps.jsx
@@ -1,6 +1,7 @@
// Phone app, first start: the permission steps between the onboarding choice and the app
-// (lib/onboarding-perms.js decides which are due). One step per screen, Allow / Not now, and
-// the app as soon as the list is through. A step with nothing to ask never renders, so a phone
+// (lib/onboarding-perms.js decides which are due). One step per screen with a single Continue
+// that always goes on to the OS dialog (App Review 5.1.1(iv): no way to skip the real ask from
+// our own screen; "Don't allow" there is the user's no), and the app as soon as the list is through. A step with nothing to ask never renders, so a phone
// that already allowed everything goes straight on without a flash of this screen.
import { useEffect, useState } from 'react'
import { useStore } from '../store/useStore.js'
@@ -37,10 +38,10 @@ export default function PermissionSteps() {
useEffect(() => { if (steps && !step) done() }, [steps, step])
if (!step) return null
- const answer = async allow => {
+ const next = async () => {
setBusy(true)
markStepSeen(step.id)
- if (allow) await Promise.resolve(step.request()).catch(() => false)
+ await Promise.resolve(step.request()).catch(() => false)
setBusy(false)
setI(i + 1)
}
@@ -53,9 +54,7 @@ export default function PermissionSteps() {
<div style={{ display: 'grid', gap: 8, marginBottom: 28, textAlign: 'start' }}>
{c.lines.map(l => <div key={l} className="row" style={{ gap: 10 }}><span style={{ color: 'var(--green)' }}><Icon name="check" /></span><span className="small">{l}</span></div>)}
</div>
- <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>
+ <Button variant="primary" disabled={busy} onClick={next}>{t('Continue')}</Button>
<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 3f010bdbb..832a4cfc1 100644
--- a/frontend/src/views/PermissionSteps.test.jsx
+++ b/frontend/src/views/PermissionSteps.test.jsx
@@ -1,9 +1,10 @@
// @vitest-environment happy-dom
// The phone app's first-start permission step (owner request, TestFlight): after "Use on this
-// device" or a finished pairing, one screen explains notifications with Allow / Not now. Shown
+// device" or a finished pairing, one screen explains notifications, and its one button, Continue, always goes on to the OS
+// dialog (App Review 5.1.1(iv): our screen must never let the real ask be skipped). Shown
// once per device, never for a permission already granted or one the OS will not ask for again,
-// never off the phone app. Allow goes through the same request the first rest makes
-// (rest-alert.js), so the first rest does not ask a second time; Not now leaves that ask alone.
+// never off the phone app. Continue goes through the same request the first rest makes
+// (rest-alert.js), so the first rest does not ask a second time.
import React, { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -62,12 +63,12 @@ describe('which steps are due', () => {
})
describe('the screen', () => {
- it('explains notifications; Allow asks the OS once and goes on to the app', async () => {
+ it('explains notifications; Continue asks the OS once and goes on to the app', async () => {
await mount()
expect(host.textContent).toContain('Never miss the end of a rest')
expect(host.textContent).toContain('Training reminders, only if you switch them on')
expect(host.textContent).not.toMatch(/—/)
- await click(button('Allow'))
+ await click(button('Continue'))
expect(h.requests).toBe(1)
expect(h.finish).toHaveBeenCalledTimes(1)
// The first rest does not ask again: the answer is on record where rest-alert.js looks.
@@ -75,17 +76,18 @@ describe('the screen', () => {
expect(JSON.parse(localStorage.getItem(SEEN_KEY))).toEqual(['notifications'])
})
- it('Not now goes on without asking, and leaves the in-context ask for later', async () => {
+ it('has no way past the OS dialog: one button, and a no there still goes on', async () => {
+ h.after = 'denied'
await mount()
- await click(button('Not now'))
- expect(h.requests).toBe(0)
+ expect([...host.querySelectorAll('button')].map(b => b.textContent.trim())).toEqual(['Continue'])
+ await click(button('Continue'))
+ expect(h.requests).toBe(1)
expect(h.finish).toHaveBeenCalledTimes(1)
- expect(localStorage.getItem(NOTIF_ASKED_KEY)).toBeNull()
})
it('is shown once per device', async () => {
await mount()
- await click(button('Not now'))
+ await click(button('Continue'))
act(() => root.unmount()); root = createRoot(host); h.finish.mockReset()
await mount()
expect(host.textContent).toBe('')
@@ -120,26 +122,24 @@ describe('Apple Health, on the iPhone', () => {
expect((await pendingSteps()).map(s => s.id)).toEqual(['notifications', 'appleHealth'])
})
- it('explains it; Allow asks iOS and switches the setting on', async () => {
+ it('explains it; Continue 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'))
+ await click(button('Continue'))
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 () => {
+ it('offers no "Not now": Continue is the only way on, to the iOS sheet (App Review 5.1.1(iv))', async () => {
iphone()
await mount()
- await click(button('Not now'))
- expect(h.enable).toEqual([])
- expect(h.healthOn).toBe(false)
- expect(h.finish).toHaveBeenCalledTimes(1)
+ expect([...host.querySelectorAll('button')].map(b => b.textContent.trim())).toEqual(['Continue'])
+ expect(host.textContent).not.toContain('Not now')
})
})