feat: package frontend as Capacitor Android APK + backend merge fixes#62
Open
ericmt-98 wants to merge 2 commits into
Open
feat: package frontend as Capacitor Android APK + backend merge fixes#62ericmt-98 wants to merge 2 commits into
ericmt-98 wants to merge 2 commits into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
6a24a4f): unifies the error taxonomy so both legacy 1-arg (new NotFoundError('msg')) and the new 4-arg form compile, repairs the duplicatecancelTrade+ duplicateauthRateLimit/usermerge artifacts that were leavingtscred, and hardens CORS for the Capacitor WebView origins.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.*.localare gitignored so the release signing material never enters the repo.Test plan
tsc --noEmitclean on both backend and frontendadb installadb reverse tcp:3002 tcp:3002— verifiedPOST /users/register,GET /account/balance(real testnet 8388 XLM),GET /trades/historyin backend logsapksigner verify→CN=Micopay).env.productionstill points at the unreachablehttps://api.micopay.app; needs a real deployment before the release APK is shippable🤖 Generated with Claude Code