Commit Graph

7 Commits

Author SHA1 Message Date
1d2cbda50d Ship a signed release APK
The release build type reuses the debug signing config, so a downloaded APK
installs over an existing one instead of demanding an uninstall. This never
goes to Play, which rejects debug keys anyway, so there is no private key
worth safeguarding for years and no way to strand anyone on a version that
can no longer be updated.

That choice is load-bearing in one direction: a release build is not
DEBUGGABLE, so adb shell run-as stops reading app data back out, and there is
no in-app restore. A signature change would have cost the drill progress.

npm run release stages release/404-Layers-<version>.apk with a checksum and
verifies the signature, since an unsigned APK builds fine and only fails at
install time, on someone else's phone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 21:51:01 +03:00
283c5d8d0a Rename to 404 Layers, and give it a real icon
The name was SP-404MK2 layers, which is 16 characters and truncates in
the launcher. It is set in five places, one of which cap sync
regenerates from appName, so all five move together: capacitor.config,
strings.xml, index.html, package.json and CLAUDE.md. reference/ keeps
the old name because it is frozen. appId is untouched - changing it
would make this a different app to Android, meaning a fresh install and
the drill progress on the phone orphaned.

The icon is a 3x3 pad grid with the centre pad lit: the app's own
subject, legible when a launcher masks it to a circle, and in the
settled palette. Three columns rather than the hardware's four so the
cells survive 48px, which I checked at 800% magnification.

scripts/make-icon.mjs draws it with ImageMagick primitives, because
there is no SVG rasteriser here - no Inkscape, no rsvg-convert, and no
SVG delegate in ImageMagick 6. It is in the repo because the icon would
otherwise be 15 binary PNGs with no record of how they were made.

Two things that took a few attempts. The draw commands have to be built
as a real array: three tries in bash collapsed all nine into one
argument, which ImageMagick read as a filename. And the convert calls
need -strip, because without it the pixels are identical between runs
but the bytes are not, so the PNGs churned and the script could not be
shown to be their source. Two consecutive runs are now byte-identical.

Also removed two orphaned Capacitor vectors, 204 lines of gradient
swoosh and grid pattern that nothing referenced once the adaptive icon
pointed at @mipmap and @color.

Icons total 52KB. Built and installed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 21:22:09 +03:00
7ddaf3d949 Phase 2: cut the APK over to the React app
webDir moves from www to dist, and npm run apk now builds with Vite
instead of copying the reference. The Phase 1 pipeline is still there as
apk:phase1, so the wrapper that has been installable throughout can be
rebuilt if the port turns out to have a problem on the device.

Verified without the phone: Vite builds, Capacitor copies dist, all three
plugins are still found, Gradle packages, and the APK now contains the
React bundle and the three self-hosted woff2 files with none of the old
Phase 1 assets left behind.

What cannot be checked from here is the part that matters most - a real
two-finger chord, haptics, the back button, and whether the drill boxes
already on the phone survive the switch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 10:52:43 +03:00
956dc57763 Phase 2: React scaffolding, self-hosted fonts, design tokens
Vite builds to dist/, deliberately not www/. www/ is still produced by
sync-www.sh for the Phase 1 APK, which stays installable throughout the
port; cutover is a one-line webDir change in capacitor.config.json.
base is relative because Capacitor serves the bundle from the APK, where
absolute asset paths would 404.

index.html omits viewport-fit=cover on purpose. That string is what
makes Capacitor's SystemBars plugin pass insets through to the page;
without it the plugin pads the decor view and the layout is always
between the status and gesture bars. Phase 1 learned this the hard way.

Fonts are self-hosted for offline use, latin subsets only: three files
at 68K, against the 133K Barlow costs today. Space Grotesk is variable,
so one file covers 400-700. Dropped latin-ext and vietnamese.

Carets are drawn as SVG, not typed. U+25BE and U+23EE sit outside every
Latin subset and would fall back to a system font mid-label.

base.css carries the settled palette and the measured vertical budget as
tokens, so a component cannot quietly exceed it:
  8 + 44 + 8 + 525 + 8 + 84 + 8 + 50 = 735

Verified: typecheck clean, 103 tests, vite build emits with the fonts
copied, and www/ is untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 01:05:09 +03:00
b32c38019e Phase 2: domain layer with tests
Vite + React + TypeScript + Vitest. No router, state library or UI kit.

The 159-row combo table is extracted from reference/index.html by
scripts/extract-reference-data.mjs rather than retyped: it balances
brackets past string literals to slice out the pure-data declarations and
evaluates them in a vm with no DOM. raw.ts and labels.ts are generated.
The extracted count matches the 159 the Phase 1 app reported on device.

Entry.id keeps the reference's format verbatim (shift>p1@S#FIX VEL),
built from the unsplit context string, so drill progress already on the
phone migrates instead of being orphaned.

The domain is pure where the reference was not: boxes go in and new
boxes come out, and the random source is injected. That is what made
card selection testable.

Two bugs found by doing so:

- pickCard returned the card just answered when random() gave exactly 0.
  A zero-weight card does not move the accumulator, so "r <= 0" matched
  it. The reference has this; at one draw in 2^53 it is invisible in use,
  but a pinned random source hits it every time. Fixed to "r < 0".
- boxDistribution incremented through an index that
  noUncheckedIndexedAccess types as possibly undefined.

65 tests. Several assert numbers observed on the device: 159 entries,
sample-mode layers of 3 / 35 / 2, a 16-card SHIFT+pads deck.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 00:54:34 +03:00
f8565c35cd Fix phone strip ergonomics; add device launch helper
The two chip rows sat flush: the reference spaces them with
'#strip .chips + .chips', but the .lbl between them is display:none on
phones and still in the DOM, so the sibling selector never matched.
Measured gap was 0px, and both selected chips are light-filled and
left-aligned, so they merged into one shape.

- collapse the 7 context chips into one 44px control opening the existing
  sheet, whose rows now show CTXHINT (never surfaced on phones before)
- chip targets 34.9px -> 44px; they scroll, so a mis-hit scrolled instead
  of tapping
- right-edge fade only on rows that actually overflow (703px and 952px of
  content in a 360px viewport, scrollbars hidden)

Applied in native/ so reference/ stays frozen; CLAUDE.md records what the
React port must carry.

scripts/device.sh makes the screen-off renderer denial unmissable: it
verifies the phone is awake, waits for the page to parse rather than for
the activity, and reads the pid after start (adb install -r kills the old
process, which produced one false 'page never loaded').

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 22:34:50 +03:00
1a8a12f7f3 Phase 1: wrap the reference web app in Capacitor for Android
Wraps reference/sp404-layers as a sideloadable APK without editing the
reference, which stays the frozen spec for the Phase 2 React port.

- sync-www.sh builds www/ from reference/ + native/, asserting each patch
  anchor so a reference change fails loudly rather than shipping broken
- drops the service worker (would serve a stale app after an APK update)
- haptics via a navigator.vibrate override, so buzz() needs no change
- localStorage mirrored into Preferences; sync load()/save() untouched
- hardware back: sheet -> Explore tab -> exit
- edge-to-edge handled in MainActivity: Android 16 + targetSdk 36 removes
  the opt-out, and a WebView never fills env(safe-area-inset-*), so insets
  are pushed into CSS custom properties instead

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 00:26:35 +03:00