Skip to content

Add iOS and Android apps with Capacitor, CI and store releases - #7

Open
thorrsson wants to merge 5 commits into
mainfrom
thorrsson-mobile-app-builds
Open

thorrsson wants to merge 5 commits into
mainfrom
thorrsson-mobile-app-builds

Conversation

@thorrsson

Copy link
Copy Markdown
Owner

TLS Reader currently ships only as an Electron desktop app. This adds native iOS (priority) and Android apps that reuse the same reader, plus CI builds and tag-driven TestFlight / Google Play releases.

Approach

  • Shared backend logic. The library BFF code behind app/api/library/* is extracted into transport-neutral handlers in lib/library/*. Next route handlers become thin adapters, so web, desktop and mobile share one implementation.
  • Static export. pnpm mobile:build (scripts/build-mobile.cjs) stages the sources without app/api and produces a static Next export in out/.
  • Capacitor 8 shells (ios/, android/, app id com.tlslibrary.reader). Inside the WebView, a fetch interceptor answers /api/library/* with the shared handlers.
  • Native TlsNative plugin (Swift + Java):
    • Keeps the session token in the Keychain / AndroidKeyStore.
    • Makes upstream requests with bearer auth only to the configured backend origins.
    • Proxies /api/library/pub/* publication resources for the Thorium reader.
    • Debug-only cleartext to localhost on Android.
  • CI (.github/workflows/mobile.yml, same triggers and path filters as desktop CI):
    • PRs and main: an unsigned iOS simulator build on macos-26 and an Android assembleDebug.
    • v* tags run in the protected release environment. The workflow validates the tag, the HTTPS backend URLs and the store credentials, then:
      • iOS: archives and uploads to TestFlight via scripts/ios-testflight.sh (temporary keychain, App Store profile checks, xcodebuild -exportArchive with the existing App Store Connect API key).
      • Android: builds a signed AAB and uploads it to the Play internal track.
  • Versioning (scripts/mobile-version.cjs):
    • iOS marketing version: the tag's X.Y.Z, with prerelease and build metadata stripped.
    • Android versionName: the full tag version.
    • Build number on both: github.run_number.
  • Tooling and docs:
    • setup-release-secrets.sh accepts optional, all-or-none iOS and Android secret groups.
    • pnpm icons now also generates iOS/Android icons and splash screens from assets/icon.svg.
    • New docs/MOBILE.md; README and RELEASING are updated.

Verification

  • Tests (99), lint and typecheck pass.
  • End to end against a local mock backend on the iOS 26 simulator and an Android API 36 emulator:
    • Login.
    • Catalog with covers.
    • Opening a publication, with chapter images and CSS proxied natively.
    • Session restore after relaunch.
  • Signed release builds verified locally: an Xcode Release archive and a signed AAB carrying the tag-derived version.

Not yet verified / needs setup

  • The release jobs have not run on GitHub. No TestFlight or Play upload has been tested, nor a live TLS backend or physical devices.
  • Before a tag release:
    • Create an Apple Distribution certificate and an App Store profile.
    • Create the Play app and upload the first AAB manually.
    • Add the 8 new release environment secrets (see docs/MOBILE.md).
  • Each tag now needs approval for both the desktop and mobile workflows.

Review notes

  • The iOS release build keeps NSAllowsLocalNetworking. Other hosts still require HTTPS, and release tags require HTTPS backends.
  • Play uploads use r0adkll/upload-google-play pinned by SHA. iOS uploads use plain xcodebuild rather than fastlane, which avoids Ruby dependencies in CI.
  • ANDROID_PLAY_RELEASE_STATUS=draft is needed until the Play app has been published once.

thorrsson and others added 5 commits November 10, 2026 14:22
Move session, publication, progress and acquire logic into lib/library so
the same handlers can run in Next route handlers and inside a mobile WebView
where native code owns the session token.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Build the reader as a static export from a staged copy without app/api and
prerender Thorium locales and fonts so the Capacitor shells can bundle them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Scaffold Capacitor 8 projects (com.tlslibrary.reader) that load the static
export, and route /api/library calls through shared handlers backed by a
native TlsNative plugin. Pad layout by device safe areas.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Native layers hold the session token (Keychain / AndroidKeyStore),
perform upstream requests with bearer auth limited to trusted origins,
and proxy /api/library/pub/* subresources for the reader WebView.
Debug-only cleartext allowances support a local mock backend.
Also removes the list indent on narrow catalog screens.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The Mobile CI and release workflow builds an unsigned iOS simulator app
and an Android debug APK for PRs and main. On v* tags, in the protected
release environment, it validates store credentials, archives and
uploads iOS to TestFlight (scripts/ios-testflight.sh) and uploads a
signed AAB to the Google Play internal track. Versions derive from the
tag via scripts/mobile-version.cjs.

The secrets uploader accepts optional, all-or-none iOS and Android
groups. pnpm icons now also renders iOS/Android icons and splash
screens from assets/icon.svg. docs/MOBILE.md covers local development,
store setup and credentials.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch had an error being deployed

1 failed deployment
ci — 558887f1 Deployed Nov 12, 2026 by thorrsson via Build (macOS universal) #35
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