Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ example
# local native module build output
modules/*/android/build/
modules/*/android/.cxx/
modules/*/android/.gradle/
modules/*/android/.kotlin/
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Routes are in `src/app/`. Path alias: `@/*` -> `src/*` (tests use it, and jest m
- `writeQueue.ts`: serial FIFO. A failed op stays at the head and blocks later ops until `retry()`.
- `src/report/`: `buildReport()` returns one model, used by both the report screen and `renderReportHtml()` (escaped, no external assets) for expo-print.
- `src/platform/`: the only React Native / Expo-module code outside the UI (`clock`, `database`, `phone`, `exportPdf`).
- `src/legal/privacyPolicy.ts`: privacy policy text, shown in-app at `/privacy` (linked from Home) and mirrored to `docs/privacy-policy.md` for the Play Console URL. `tests/privacyPolicy.test.ts` fails if the doc drifts or a claim (backup, permissions, no network or analytics SDKs) stops matching the app. Edit the TS, then `UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts`.
- `src/state/store.ts`: `appStore` singleton (DB, active controller, controller cache, session list, clock-format pref) plus hooks. `useClockTick` is display-only at 4 Hz.
- `modules/clock-snapshot/`: Swift (`mach_continuous_time`, `kern.boottime` boot id, `isExcludedFromBackup`) and Kotlin (`elapsedRealtimeNanos`, `Settings.Global.BOOT_COUNT`). Loaded with `requireOptionalNativeModule`.
- Tests: `tests/helpers/sqlite.ts` wraps better-sqlite3 in the `Db` interface. It includes `failNext(regex)` to simulate disk-full errors. `tests/helpers/fakeClock.ts` provides `advance`, `setWallBy`, and `reboot`. Name tests after spec IDs.
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
},
"android": {
"package": "com.birthmark.app",
"package": "com.htpdevs.birthmark",
"allowBackup": false,
"softwareKeyboardLayoutMode": "resize",
"adaptiveIcon": {
Expand Down
47 changes: 47 additions & 0 deletions docs/privacy-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Birthmark privacy policy

Effective 2026-10-10

This policy explains how the Birthmark app, published by HTPdevs, handles information. Birthmark works offline on one device. It has no accounts, no backend server, no advertising, and no analytics.

## What the app stores

Birthmark stores what you record during a session: the time of each captured moment, milestone names, optional labels you type (up to 80 characters), event timers, APGAR scores, corrections and their history, and timing details from the device clock (timezone, UTC offset, and a boot identifier used to recover elapsed time after a restart). It also stores your 12-hour or 24-hour clock display preference.

Birthmark does not ask for names, dates of birth, addresses, medical record numbers, or any patient profile. A label is free text, so it can still contain identifying details if you type them. Do not enter names or identifying details in labels.

## Where it is stored

All records are kept in a database inside the app on this device. Birthmark does not send session data to HTPdevs or to anyone else, and it has no account or cloud sync.

Session data is excluded from automatic device backups: Android app backup is turned off, and on iOS the database folder is excluded from iCloud and computer backups.

## What the app does not use

Birthmark does not use the microphone, camera, location, contacts, or photos. It does not record audio. It contains no advertising, analytics, crash-reporting, or tracking services.

## Exported reports

When you export a report, Birthmark creates a PDF on the device and opens your device's share sheet. You choose where it goes, for example a file location or another app. Nothing is sent automatically.

Once you save or share a PDF outside Birthmark, that copy is handled by the destination you chose and its own privacy terms. Deleting a session in Birthmark cannot remove copies saved elsewhere. Birthmark clears its own cached export files when a session is deleted.

## Emergency button

After you confirm, the Emergency button opens your device's phone app with 911 entered. The call is placed by your phone app and carrier, not by Birthmark. Birthmark does not record that you used it.

## Keeping and deleting data

Records stay on the device until you delete them. You can delete a finished session from its report. This removes its database records and cached exports. Uninstalling Birthmark removes all of its data from the device.

## Security and medical use

Records are protected by the security of your device, such as its screen lock. Birthmark does not make records anonymous, and it is not certified for HIPAA or any other medical records standard. It records observations you choose and gives no clinical guidance.

## Changes to this policy

If this policy changes, the updated version will ship in the app with a new effective date.

## Contact

Questions about this policy: support@htpdevs.tech
9 changes: 9 additions & 0 deletions docs/release-notes/1.0.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<en-US>
First release of Birthmark.
- Record birth moments with one tap: ROM, Crown, Head, Body, First Cry, Separation Gush, Placenta
- Dedicated Resuscitate button and APGAR scores at 1 and 5 minutes
- Large real-time clock and time since the last moment
- Review and correct the timeline, then export a PDF report
- Emergency button opens your phone app to call 911
- Works offline. Records stay on this device
</en-US>
16 changes: 15 additions & 1 deletion src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ export default function Home() {
) : null}
</ScrollView>
<View style={styles.topBar}>
<Button
label="Privacy"
icon="shield-checkmark-outline"
variant="ghost"
accessibilityHint="Opens the privacy policy"
onPress={() => router.push("/privacy")}
testID="open-privacy"
/>
<Button
label="History"
icon="time-outline"
Expand All @@ -133,10 +141,16 @@ const styles = StyleSheet.create({
screen: { flex: 1, backgroundColor: colors.paper },
// Inside the safe-area padding, so the absolute top bar stays clear of notches.
body: { flex: 1 },
// Absolute so the History button does not push the centered content down.
// Absolute so the Privacy and History buttons do not push the centered content down.
// Privacy sits top left and History top right, so neither reaches the centered
// lockup on a short landscape phone. box-none keeps the gap between them tappable.
topBar: {
position: "absolute",
flexDirection: "row",
justifyContent: "space-between",
pointerEvents: "box-none",
top: 0,
left: 0,
right: 0,
zIndex: 1,
paddingHorizontal: space.lg,
Expand Down
74 changes: 74 additions & 0 deletions src/app/privacy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { router } from "expo-router";
import { ScrollView, StyleSheet, Text, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";

import {
PRIVACY_EFFECTIVE_DATE,
PRIVACY_INTRO,
PRIVACY_SECTIONS,
PRIVACY_TITLE,
} from "../legal/privacyPolicy";
import { Button } from "../ui/Button";
import { colors, space } from "../ui/theme";

// Bundled text, not a web link: the app is offline, and Google Play requires
// the policy to be readable inside the app as well as at the listing URL.
export default function Privacy() {
return (
<SafeAreaView
style={styles.screen}
edges={["left", "right", "top", "bottom"]}
>
<View style={styles.toolbar}>
<Button
label="Home"
icon="home"
iconOnly
variant="ghost"
onPress={() =>
router.canGoBack() ? router.back() : router.replace("/")
}
/>
<Text style={styles.title} accessibilityRole="header" numberOfLines={1}>
{PRIVACY_TITLE}
</Text>
</View>
<ScrollView contentContainerStyle={styles.body}>
<Text style={styles.date}>Effective {PRIVACY_EFFECTIVE_DATE}</Text>
<Text style={styles.paragraph}>{PRIVACY_INTRO}</Text>
{PRIVACY_SECTIONS.map((s) => (
<View key={s.heading} style={styles.section}>
<Text style={styles.heading} accessibilityRole="header">
{s.heading}
</Text>
{s.paragraphs.map((p) => (
<Text key={p} style={styles.paragraph} selectable>
{p}
</Text>
))}
</View>
))}
</ScrollView>
</SafeAreaView>
);
}

const styles = StyleSheet.create({
screen: { flex: 1, backgroundColor: colors.paper },
toolbar: {
flexDirection: "row",
alignItems: "center",
gap: space.sm,
paddingHorizontal: space.lg,
paddingVertical: space.sm,
borderBottomWidth: 1,
borderBottomColor: colors.line,
},
title: { flex: 1, fontSize: 22, fontWeight: "800", color: colors.ink },
// Line length capped for reading in landscape.
body: { padding: space.xl, gap: space.lg, maxWidth: 760, alignSelf: "center" },
date: { fontSize: 14, color: colors.slate },
section: { gap: space.sm },
heading: { fontSize: 19, fontWeight: "700", color: colors.ink },
paragraph: { fontSize: 16, lineHeight: 24, color: colors.ink },
});
87 changes: 87 additions & 0 deletions src/legal/privacyPolicy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* Privacy policy text. Single source for the in-app Privacy screen and
* docs/privacy-policy.md (the copy hosted for the Play Console URL field).
* tests/privacyPolicy.test.ts fails when the two drift, and checks each claim
* below against the code and config it describes. Change the text here, then
* regenerate the doc: UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts
*/

export const PRIVACY_DEVELOPER = 'HTPdevs';
export const PRIVACY_CONTACT = 'support@htpdevs.tech';
/** ISO date. Bump it whenever the text changes. */
export const PRIVACY_EFFECTIVE_DATE = '2026-10-10';

export type PolicySection = { heading: string; paragraphs: string[] };

export const PRIVACY_TITLE = 'Birthmark privacy policy';

export const PRIVACY_INTRO = `This policy explains how the Birthmark app, published by ${PRIVACY_DEVELOPER}, handles information. Birthmark works offline on one device. It has no accounts, no backend server, no advertising, and no analytics.`;

export const PRIVACY_SECTIONS: PolicySection[] = [
{
heading: 'What the app stores',
paragraphs: [
'Birthmark stores what you record during a session: the time of each captured moment, milestone names, optional labels you type (up to 80 characters), event timers, APGAR scores, corrections and their history, and timing details from the device clock (timezone, UTC offset, and a boot identifier used to recover elapsed time after a restart). It also stores your 12-hour or 24-hour clock display preference.',
'Birthmark does not ask for names, dates of birth, addresses, medical record numbers, or any patient profile. A label is free text, so it can still contain identifying details if you type them. Do not enter names or identifying details in labels.',
],
},
{
heading: 'Where it is stored',
paragraphs: [
'All records are kept in a database inside the app on this device. Birthmark does not send session data to HTPdevs or to anyone else, and it has no account or cloud sync.',
'Session data is excluded from automatic device backups: Android app backup is turned off, and on iOS the database folder is excluded from iCloud and computer backups.',
],
},
{
heading: 'What the app does not use',
paragraphs: [
'Birthmark does not use the microphone, camera, location, contacts, or photos. It does not record audio. It contains no advertising, analytics, crash-reporting, or tracking services.',
],
},
{
heading: 'Exported reports',
paragraphs: [
"When you export a report, Birthmark creates a PDF on the device and opens your device's share sheet. You choose where it goes, for example a file location or another app. Nothing is sent automatically.",
"Once you save or share a PDF outside Birthmark, that copy is handled by the destination you chose and its own privacy terms. Deleting a session in Birthmark cannot remove copies saved elsewhere. Birthmark clears its own cached export files when a session is deleted.",
],
},
{
heading: 'Emergency button',
paragraphs: [
"After you confirm, the Emergency button opens your device's phone app with 911 entered. The call is placed by your phone app and carrier, not by Birthmark. Birthmark does not record that you used it.",
],
},
{
heading: 'Keeping and deleting data',
paragraphs: [
'Records stay on the device until you delete them. You can delete a finished session from its report. This removes its database records and cached exports. Uninstalling Birthmark removes all of its data from the device.',
],
},
{
heading: 'Security and medical use',
paragraphs: [
'Records are protected by the security of your device, such as its screen lock. Birthmark does not make records anonymous, and it is not certified for HIPAA or any other medical records standard. It records observations you choose and gives no clinical guidance.',
],
},
{
heading: 'Changes to this policy',
paragraphs: [
'If this policy changes, the updated version will ship in the app with a new effective date.',
],
},
{
heading: 'Contact',
paragraphs: [`Questions about this policy: ${PRIVACY_CONTACT}`],
},
];

/** The policy as Markdown, for docs/privacy-policy.md. */
export function privacyPolicyMarkdown(): string {
const parts = [
`# ${PRIVACY_TITLE}`,
`Effective ${PRIVACY_EFFECTIVE_DATE}`,
PRIVACY_INTRO,
...PRIVACY_SECTIONS.flatMap((s) => [`## ${s.heading}`, ...s.paragraphs]),
];
return parts.join('\n\n') + '\n';
}
12 changes: 12 additions & 0 deletions tests/appConfig.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { readFileSync } from 'fs';
import { join } from 'path';

const appJson = JSON.parse(readFileSync(join(__dirname, '..', 'app.json'), 'utf8')).expo;

// The Play Store listing is keyed to this id and it can never change after the
// first upload, so a rename here would publish a different app.
describe('app config', () => {
it('Android application id is com.htpdevs.birthmark', () => {
expect(appJson.android.package).toBe('com.htpdevs.birthmark');
});
});
92 changes: 92 additions & 0 deletions tests/privacyPolicy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';

import { EMERGENCY_NUMBER } from '@/domain/emergency';
import { LABEL_MAX_LENGTH } from '@/domain/types';
import {
PRIVACY_CONTACT,
PRIVACY_DEVELOPER,
PRIVACY_EFFECTIVE_DATE,
PRIVACY_INTRO,
PRIVACY_SECTIONS,
privacyPolicyMarkdown,
} from '@/legal/privacyPolicy';

const ROOT = join(__dirname, '..');
const DOC = join(ROOT, 'docs', 'privacy-policy.md');
const read = (p: string) => readFileSync(join(ROOT, p), 'utf8');
const fullText = [PRIVACY_INTRO, ...PRIVACY_SECTIONS.flatMap((s) => s.paragraphs)].join('\n');

describe('privacy policy', () => {
it('docs/privacy-policy.md matches the in-app text', () => {
const md = privacyPolicyMarkdown();
if (process.env.UPDATE_PRIVACY_MD) writeFileSync(DOC, md);
// On failure: UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts
expect(readFileSync(DOC, 'utf8')).toBe(md);
});

// Google Play User Data policy: the policy must name the developer and a
// privacy point of contact.
it('names the developer and a contact address', () => {
expect(PRIVACY_DEVELOPER).toBe('HTPdevs');
expect(PRIVACY_CONTACT).toMatch(/^[^\s@]+@[^\s@]+\.[a-z]{2,}$/);
expect(fullText).toContain(PRIVACY_DEVELOPER);
expect(fullText).toContain(PRIVACY_CONTACT);
});

it('effective date is a real ISO date', () => {
expect(PRIVACY_EFFECTIVE_DATE).toMatch(/^\d{4}-\d{2}-\d{2}$/);
expect(new Date(PRIVACY_EFFECTIVE_DATE).toISOString().slice(0, 10)).toBe(PRIVACY_EFFECTIVE_DATE);
});

it('never claims anonymity or HIPAA approval', () => {
expect(fullText).not.toMatch(/\b(is|are) (anonymous|anonymized|HIPAA[- ]compliant|HIPAA approved)\b/i);
expect(fullText).toContain('does not make records anonymous');
expect(fullText).toContain('not certified for HIPAA');
});

// Each claim below is a fact about the code or config. If one of these
// fails, the app changed and the policy text has to change with it.
describe('claims match the app', () => {
const appJson = JSON.parse(read('app.json')).expo;
const pkg = JSON.parse(read('package.json'));

it('label length', () => {
expect(fullText).toContain(`up to ${LABEL_MAX_LENGTH} characters`);
});

it('emergency number', () => {
expect(fullText).toContain(`with ${EMERGENCY_NUMBER} entered`);
});

it('Android backup is off and iOS excludes the database folder', () => {
expect(appJson.android.allowBackup).toBe(false);
expect(read('src/platform/database.ts')).toMatch(/excludeFromBackup\(dir\)/);
expect(read('modules/clock-snapshot/ios/ClockSnapshotModule.swift')).toContain('isExcludedFromBackup = true');
});

it('requests no microphone, camera, location, contacts, or photos permission', () => {
const android: string[] = appJson.android.permissions ?? [];
expect(android.filter((p) => /AUDIO|CAMERA|LOCATION|CONTACTS|MEDIA_IMAGES|MEDIA_VIDEO/.test(p))).toEqual([]);
const plistKeys = Object.keys(appJson.ios.infoPlist ?? {});
expect(
plistKeys.filter((k) => /Microphone|Camera|Location|Contacts|PhotoLibrary/.test(k)),
).toEqual([]);
});

it('ships no analytics, ads, crash-reporting, or network-sync SDKs', () => {
const deps = Object.keys({ ...pkg.dependencies });
const banned = /analytics|firebase|sentry|bugsnag|crashlytics|posthog|amplitude|mixpanel|segment|admob|ads|appsflyer|adjust|datadog|expo-updates|expo-notifications|expo-location|expo-camera|expo-av|expo-audio|expo-contacts|expo-image-picker|expo-media-library/;
expect(deps.filter((d) => banned.test(d))).toEqual([]);
});

it('source makes no network requests', () => {
const hits = execSync(
"grep -rlE 'fetch\\(|XMLHttpRequest|WebSocket|EventSource' src || true",
{ cwd: ROOT, encoding: 'utf8' },
).trim();
expect(hits).toBe('');
});
});
});
Loading
Loading