Files
James Babcock 816c4709ae Add links to the GPL and privacy policy to the "Before You Continue" page
<details>
<summary>Prompts Used</summary>
Let's add two links to the footer of the "Before you continue" page: A link to the license (GPLv3, contained in LICENSE), and a link to the privacy policy (PRIVACY).
<hr>
Continue

> Done — the build passes. The "Before You Continue" page (step 2 of onboarding) now has a footer with two tappable links, "License (GPLv3)" and "Privacy Policy", centered between the disclaimer text and the Back/Agree buttons. They're only visible on that step, so the splash and firmware steps are unchanged.
>
> What I added:
>
> - **`app/phone-ui/document-page.xml` / `.ts`** — a new phone-side viewer page with an ActionBar (title + back button) and a scrollable label. It reads the doc from `about/<fileName>` in the app bundle; webpack already copies LICENSE and PRIVACY there (webpack.config.js:12), since the glasses-side Settings About section uses them too.
> - **`onboarding-page.xml`** — a third grid row with the two links, bound to `footerVisibility` so it collapses on steps 1 and 3.
> - **`onboarding-view-model.ts`** — `onLicenseTap`/`onPrivacyTap` handlers that navigate to the document page, and the `footerVisibility` getter wired into `publish()`.
> - **`app.css`** — link styling (blue, underlined, padded for a comfortable tap target, lighter blue in dark mode) and a modest 13pt size for the doc text since both files are hard-wrapped plain text.
>
> Untested on hardware: worth a quick visual check that the links look right in dark mode and that the LICENSE text (which is 80-column preformatted) reads acceptably in the proportional font.
</details>
2026-08-25 22:26:30 -07:00

27 lines
990 B
TypeScript

import { Frame, NavigatedData, Page, knownFolders } from "@nativescript/core";
/** Phone-side viewer for the project docs that webpack.config.js copies into
* the bundle under about/ (LICENSE, PRIVACY, ...). The glasses-side
* equivalent lives in ui/dashboard/settings-menus.ts. */
type DocumentContext = { fileName?: string; title?: string } | undefined;
export function navigatingTo(args: NavigatedData): void {
const page = args.object as Page;
const context = args.context as DocumentContext;
const fileName = context?.fileName ?? "";
page.bindingContext = {
title: context?.title ?? fileName,
text: readBundledDoc(fileName),
onBackTap: () => Frame.topmost()?.goBack(),
};
}
function readBundledDoc(fileName: string): string {
try {
const text = knownFolders.currentApp().getFile(`about/${fileName}`).readTextSync();
return text || `(${fileName} is missing from this build)`;
} catch {
return `(${fileName} is missing from this build)`;
}
}