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.

Merge branch 'bg-check' into stores

Duarte Santos6957ddec83b0
diff --cc frontend/ios/App/App/MainViewController.swift
index b68593f35,2c89f200f..10804c122
--- a/frontend/ios/App/App/MainViewController.swift
+++ b/frontend/ios/App/App/MainViewController.swift
@@@ -12,51 -11,6 +12,52 @@@ class MainViewController: CAPBridgeView
bridge?.registerPluginInstance(PrintPlugin())
bridge?.registerPluginInstance(RestAlertPlugin())
bridge?.registerPluginInstance(DeviceAuthPlugin())
+ bridge?.registerPluginInstance(NudgeCheckPlugin())
+ // After loadView has finished: the view is the web view only once it has.
+ if ProcessInfo.processInfo.arguments.contains(MainViewController.pendingProbeArgument) {
+ DispatchQueue.main.async { [weak self] in self?.showPendingProbe() }
+ }
+ }
+
+ /**
+ * For the UI tests only (ios/App/AppUITests): launched with this argument, the app shows the
+ * ids of the local notifications iOS holds for it, as a tiny label a test can read. A UI test
+ * runs in its own process and cannot ask UNUserNotificationCenter about another app, and this
+ * is what iOS really has pending, not what the page meant to schedule. Never shown otherwise:
+ * nothing but XCUIApplication.launchArguments passes the argument.
+ */
+ static let pendingProbeArgument = "-OpenGymUITestPending"
+
+ private func showPendingProbe() {
+ // On the window, not inside the web view: what a WKWebView holds is its page as far as
+ // accessibility goes, and a label among its subviews may never reach the test.
+ guard let host = view.window else {
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in self?.showPendingProbe() }
+ return
+ }
+ let label = UILabel()
+ label.accessibilityIdentifier = "og-pending-notifications"
+ label.font = .systemFont(ofSize: 8)
+ label.textColor = .systemGray
+ label.numberOfLines = 1
+ label.isUserInteractionEnabled = false
+ label.text = "pending:"
+ label.translatesAutoresizingMaskIntoConstraints = false
+ host.addSubview(label)
+ NSLayoutConstraint.activate([
+ label.leadingAnchor.constraint(equalTo: host.leadingAnchor, constant: 2),
+ label.bottomAnchor.constraint(equalTo: host.bottomAnchor, constant: -2),
+ ])
+ Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak label] _ in
+ UNUserNotificationCenter.current().getPendingNotificationRequests { requests in
+ let ids = requests.map { $0.identifier }.sorted().joined(separator: ",")
+ DispatchQueue.main.async {
+ guard let label = label else { return }
+ label.text = "pending:" + ids
+ label.accessibilityLabel = "pending:" + ids
+ label.superview?.bringSubviewToFront(label)
+ }
+ }
+ }
}
}
diff --cc frontend/src/locales/pt-BR.js
index 6ba2f34e5,4cef90e58..13bed3bdd
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@@ -1444,13 -1444,8 +1444,15 @@@ export const PT_BR_OVERRIDES =
'Not confirmed on this phone. Nothing was deleted.': 'Não foi confirmado neste celular. Nada foi excluído.',
'This phone has no screen lock, so the name you typed is the only check.': 'Este celular não tem bloqueio de tela, então o nome que você digitou é a única verificação.',
'Your phone checks that it’s you (face, fingerprint or passcode), then the account is deleted.': 'Seu celular confirma que é você (rosto, digital ou senha) e depois a conta é excluída.',
+ // --- first-start permission steps ---
+ 'Never miss the end of a rest': 'Nunca perca o fim de um descanso',
+ 'One quick thing': 'Só uma coisa rápida',
+ 'Rest timer, right on the lock screen': 'Timer de descanso, direto na tela de bloqueio',
+ 'Training reminders, only if you switch them on': 'Lembretes de treino, só se você ativar',
+ 'You can change it anytime in your phone’s settings.': 'Você pode mudar isso quando quiser nas configurações do celular.',
+ 'openGym can tap you on the shoulder when a rest is over, even with the phone locked in your pocket.': 'O openGym pode te dar um toque no ombro quando um descanso acaba, mesmo com o celular bloqueado no bolso.',
+ // --- background check before the nudge ---
+ 'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Registrou um treino em outro dispositivo? Antes do aviso, o celular confirma com o seu servidor, sempre que deixar o aplicativo rodar em segundo plano. Abrir o aplicativo sempre deixa tudo em dia.',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --cc frontend/src/views/Settings.jsx
index 3e8f77766,122152ddf..f8d28de9d
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@@ -1098,9 -1101,9 +1101,9 @@@ function MobileReminderCard({ S, update
}
return (
<Section title={t('Notifications')}
- footer={S.reminder?.on ? t('Reminds you at this time on days that have a routine planned.') + nudgeNote(S) : null}>
+ footer={S.reminder?.on ? t('Reminds you at this time on days that have a routine planned.') + nudgeNote(S) + (paired && S.reminder?.nudge ? ' ' + t('Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.') : '') : null}>
<Row icon="calendar" iconTint="var(--orange)" title={t('Workout day reminder')}>
- <Switch checked={!!S.reminder?.on} onChange={toggle} />
+ <Switch checked={!!S.reminder?.on} onChange={toggle} aria-label={t('Workout day reminder')} />
</Row>
{S.reminder?.on && (
<Row icon="clock" iconTint="var(--purple)" title={t('Reminder time')}>