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>
This commit is contained in:
James Babcock committed 2026-08-25 22:26:30 -07:00
1 parent a7a5005e8d
commit 816c4709ae
5 files changed
+89 -2

No files matched your search

+25
View File
@@ -50,6 +50,31 @@ Button.-primary {
tint-color: #e6e6e6;
}
/* License / privacy-policy links in the onboarding disclaimer footer. The
* padding widens the tap target beyond the small text. */
.footer-link {
color: #3b6fd6;
font-size: 15;
text-decoration: underline;
padding: 4 8;
}
.ns-dark .footer-link {
color: #8ab0ff;
}
.footer-link-separator {
color: #777777;
font-size: 15;
padding: 4 0;
}
/* Bundled project docs (phone-ui/document-page). LICENSE and PRIVACY are
* hard-wrapped plain text, so keep the size modest to limit rewrapping. */
.document-text {
font-size: 13;
}
/*
* Stands in for the lens preview when showing it would be misleading (silent
* mode, or a disconnect explained by a flat battery). Sized by the view model
+26
View File
@@ -0,0 +1,26 @@
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)`;
}
}
+9
View File
@@ -0,0 +1,9 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<ActionBar title="{{ title }}">
<NavigationButton android.systemIcon="ic_menu_back" tap="{{ onBackTap }}" />
</ActionBar>
<ScrollView>
<Label text="{{ text }}" textWrap="true" class="document-text p-16" />
</ScrollView>
</Page>
+8 -2
View File
@@ -1,5 +1,5 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" actionBarHidden="true">
<GridLayout rows="*,auto" class="p-20">
<GridLayout rows="*,auto,auto" class="p-20">
<StackLayout row="0" verticalAlignment="middle" visibility="{{ splashVisibility }}">
<Label text="{{ headline }}" class="h1 text-center" textWrap="true" />
<Label text="{{ tagline }}" class="body-text text-center m-t-8" textWrap="true" />
@@ -13,7 +13,13 @@
</StackLayout>
</ScrollView>
<GridLayout row="1" columns="*,*" class="m-t-20">
<StackLayout row="1" orientation="horizontal" horizontalAlignment="center" class="m-t-16" visibility="{{ footerVisibility }}">
<Label text="License (GPLv3)" class="footer-link" tap="{{ onLicenseTap }}" />
<Label text="·" class="footer-link-separator" />
<Label text="Privacy Policy" class="footer-link" tap="{{ onPrivacyTap }}" />
</StackLayout>
<GridLayout row="2" columns="*,*" class="m-t-20">
<Button col="0" text="{{ secondaryLabel }}" tap="{{ onSecondaryTap }}" visibility="{{ secondaryVisibility }}" />
<Button col="1" text="{{ primaryLabel }}" tap="{{ onPrimaryTap }}" class="-primary" />
</GridLayout>
+21
View File
@@ -77,6 +77,21 @@ export class OnboardingViewModel extends Observable {
Frame.topmost()?.navigate({ moduleName: "phone-ui/onboarding-unpair-page" });
}
onLicenseTap(): void {
this.openDocument("LICENSE", "License (GPLv3)");
}
onPrivacyTap(): void {
this.openDocument("PRIVACY", "Privacy Policy");
}
private openDocument(fileName: string, title: string): void {
Frame.topmost()?.navigate({
moduleName: "phone-ui/document-page",
context: { fileName, title },
});
}
onSecondaryTap(): void {
if (this._step === 2) {
this.setStep(1);
@@ -138,6 +153,11 @@ export class OnboardingViewModel extends Observable {
return this.showSecondary ? "visible" : "collapse";
}
/** License and privacy-policy links, shown only under the disclaimer step. */
get footerVisibility(): "visible" | "collapse" {
return this._step === 2 ? "visible" : "collapse";
}
private setStep(step: OnboardingStep): void {
if (this._step === step) return;
this._step = step;
@@ -154,5 +174,6 @@ export class OnboardingViewModel extends Observable {
this.notifyPropertyChange("splashVisibility", this.splashVisibility);
this.notifyPropertyChange("contentVisibility", this.contentVisibility);
this.notifyPropertyChange("secondaryVisibility", this.secondaryVisibility);
this.notifyPropertyChange("footerVisibility", this.footerVisibility);
}
}