Fitbit Air: Health Connect sync + vitals dashboard
All checks were successful
Build & Release APK / build (push) Successful in 2m5s
All checks were successful
Build & Release APK / build (push) Successful in 2m5s
- react-native-health-connect (config plugin, minSdk 26, 11 read perms) - sync-on-open + manual sync: incremental via server watermark, chunked POST to /api/health/v1/fitbit/sync (HR, resting HR, HRV, SpO2, resp rate, steps/distance/kcal/floors dailies, staged sleep sessions) - Fitbit screen: steps/RHR/HRV/SpO2 tiles + daily charts + sleep list + per-stream record counts (answers the which-types-does-Google-Health- share question empirically) - Sleep tab now merges Fitbit Air nights (wins over older sources) - Today screen Fitbit card Server side (deployed separately on VPS): hc_samples/hc_daily/hc_sleep tables + sync/latest/summary endpoints in health-api; Caddy routes POST /api/health/v1/fitbit/* behind the same basic_auth. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,27 @@ export const EP = {
|
||||
medStats: `${BASE}/api/meditation/v1/stats`,
|
||||
medSessions: `${BASE}/api/meditation/v1/sessions?limit=1000`,
|
||||
traits: `${BASE}/ancestry-traits.json`,
|
||||
fitbitSummary: `${BASE}/api/health/v1/fitbit/summary?days=30`,
|
||||
fitbitLatest: `${BASE}/api/health/v1/fitbit/latest`,
|
||||
} as const;
|
||||
|
||||
export const FITBIT_SYNC_URL = `${BASE}/api/health/v1/fitbit/sync`;
|
||||
|
||||
/* authenticated POST (fitbit sync) */
|
||||
export async function postJson<T>(url: string, body: unknown): Promise<T> {
|
||||
const r = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: 'Basic ' + token, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
if (r.status === 401 || r.status === 403) {
|
||||
onUnauthorized?.();
|
||||
throw new Error('unauthorized');
|
||||
}
|
||||
if (!r.ok) throw new Error(`${url} → ${r.status}`);
|
||||
return r.json();
|
||||
}
|
||||
|
||||
export type EpKey = keyof typeof EP;
|
||||
|
||||
const AUTH_KEY = 'hd.auth';
|
||||
|
||||
Reference in New Issue
Block a user