Skip to content

feat: package frontend as Capacitor Android APK + backend merge fixes#62

Open
ericmt-98 wants to merge 2 commits into
mainfrom
feat/capacitor-apk-packaging
Open

feat: package frontend as Capacitor Android APK + backend merge fixes#62
ericmt-98 wants to merge 2 commits into
mainfrom
feat/capacitor-apk-packaging

Conversation

@ericmt-98
Copy link
Copy Markdown
Owner

Summary

  • Backend (commit 6a24a4f): unifies the error taxonomy so both legacy 1-arg (new NotFoundError('msg')) and the new 4-arg form compile, repairs the duplicate cancelTrade + duplicate authRateLimit/user merge artifacts that were leaving tsc red, and hardens CORS for the Capacitor WebView origins.
  • Frontend (commit 1f94874): wraps the existing React/Vite app as a Capacitor 8.3 Android APK (com.micopay.app). Adds native plugin integration (geolocation, QR scanner, SecureStorage, StatusBar) with web fallbacks, safe-area-inset padding on every full-screen header, per-mode env files, brand asset pipeline (scripts/build-brand-assets.mjs), and Gradle signing scaffold.

The dev keystore, local.properties, and .env.*.local are gitignored so the release signing material never enters the repo.

Test plan

  • tsc --noEmit clean on both backend and frontend
  • Debug APK installs on Redmi Note 12 (Android 15) via adb install
  • App reaches local backend via adb reverse tcp:3002 tcp:3002 — verified POST /users/register, GET /account/balance (real testnet 8388 XLM), GET /trades/history in backend logs
  • Signed release APK builds and verifies (apksigner verifyCN=Micopay)
  • iOS scaffold — not yet exercised on macOS
  • HTTPS backend for production — .env.production still points at the unreachable https://api.micopay.app; needs a real deployment before the release APK is shippable

🤖 Generated with Claude Code

ericmt-98 and others added 2 commits May 18, 2026 12:27
…vice

Unify the error class hierarchy so both legacy 1-arg calls
(`new NotFoundError('Trade not found')`) and the 4-arg taxonomy form
(`new NotFoundError(code, userMsg, devMsg, status)`) compile. Adds the
missing classes (`ForbiddenError`, `ConflictError`, `BadRequestError`,
`MerchantLimitError`) that were referenced across the codebase but
never exported, and keeps `RateLimitError`/`ReplayError` with their
specialized constructors plus a `statusCode` getter for legacy tests.

Repairs the parse-breaking duplicate `cancelTrade` in trade.service.ts
by merging the rich state-machine branch (pending/locked/revealing)
with the audit-logging branch (reason param + audit on success/failure)
into a single function. Removes the duplicate `authRateLimit` and
duplicate `user` declarations in routes/users.ts left by the same
merge.

Fills in missing named imports in trade.service.ts, stellar.service.ts,
and routes/auth.ts now that the parse error no longer masks them, and
casts the rate-limit test invocation so its 2-arg async form satisfies
the 3-arg `preHandlerHookHandler` signature.

Hardens CORS in index.ts with an explicit allowlist for the Capacitor
WebView origins (https://localhost, capacitor://localhost) plus local
dev ports, with optional CORS_EXTRA_ORIGINS for additional staging
origins.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wraps the existing React/Vite frontend as a native Android binary so
the demo can be installed on a phone instead of relying on a desktop
browser. Adds the Capacitor scaffold under `micopay/frontend/android`
(Gradle 8.14, AGP 8.13, Capacitor 8.3) with `appId com.micopay.app`,
the brand splash/icon mipmaps generated from `public/mushroom_gold.png`
via `scripts/build-brand-assets.mjs`, and a signing config that reads
keystore credentials from `keystore.properties` (gitignored alongside
`*.jks` and `local.properties` so the dev keystore never leaks).

Integrates native plugins behind web fallbacks so the same React tree
runs on both targets: `useGeolocation` and `useQRScanner` route to the
@capacitor/geolocation and @capacitor-mlkit/barcode-scanning plugins
on device and to the browser APIs on web; `services/secureStorage`
hydrates auth tokens from @aparajita/capacitor-secure-storage on
device and from `localStorage` on web. `App.tsx` gates rendering on
an `authReady` flag so the asynchronous SecureStorage read no longer
flashes the unauthenticated UI.

Patches every full-screen page header with
`pt-[max(1rem,env(safe-area-inset-top))]` and the bottom nav with the
mirror `pb-[…inset-bottom]` so the layout clears notches/gesture bars
on the Redmi Note 12 form factor. Lazy-loads @capacitor/status-bar in
`main.tsx` to apply the brand color without dragging the plugin into
the web bundle.

Splits API base URL into per-mode env files (`.env.development`,
`.env.staging`, `.env.production`) so the same build pipeline can
target localhost, staging, and prod without code changes. Documents
the full implementation plan in `docs/APK_IMPLEMENTATION_PLAN.md`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant