Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Android native app support via Capacitor to the existing Mastodon PWA client (Coho). It bridges the web app into a native Android shell with deep link support for OAuth, FCM-based push notifications via a Firebase Cloud Function relay, and safe-area CSS adjustments for native device displays.
Changes:
- Adds Capacitor Android project scaffolding, platform detection utilities, and conditional logic throughout the app to handle native vs. web behavior (OAuth flow, push notifications, PWA install prompt, service worker).
- Implements a Firebase Cloud Function push relay (
pushRelay/pushRelayPush) that bridges Mastodon's Web Push to FCM, including Web Push payload decryption. - Adds safe-area-inset CSS adjustments across all page and component styles to accommodate Android notches/status bars.
Reviewed changes
Copilot reviewed 65 out of 113 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
capacitor.config.ts |
Capacitor project configuration |
package.json |
Adds Capacitor dependencies |
src/utils/platform.ts |
Utility to detect native vs web platform |
src/services/push-native.ts |
Native FCM push subscription, listeners, and relay registration |
src/services/auth-platform.ts |
OAuth flow helpers for native (Browser plugin, deep link handling) |
src/services/notifications.ts |
Delegates to native push on Capacitor |
src/services/account.ts |
Uses native redirect_uri and opens OAuth via Browser plugin |
src/pages/auth-callback.ts |
New OAuth callback page component |
src/pages/app-login.ts |
Handles native OAuth callback after login |
src/pages/app-home.ts |
Skips PWA install prompt on native |
src/app-index.ts |
Native launch callback handling, native push setup |
src/router/routes.ts |
Adds /auth/callback route |
src/config/firebase.ts |
Prevents local API usage in Capacitor WebView |
src/components/header.ts |
Safe-area-inset-top for header positioning |
src/components/notifications.ts |
Native push subscription status check |
src/components/post-dialog.ts, post-detail-dialog.ts |
Safe-area CSS |
src/styles/shared-styles.ts, home-styles.ts |
Safe-area CSS adjustments |
src/pages/app-*.ts, edit-page.ts, create-account.ts |
Safe-area CSS |
src/generated/locales/es.ts, de.ts |
New locale entries (untranslated) |
vite.config.ts |
Changed console stripping to pure_funcs approach |
functions/src/push-relay.ts |
Firebase push relay function |
functions/src/index.ts |
Re-exports relay, adds Capacitor CORS origin |
functions/package.json |
Adds http_ece dependency |
scripts/test-push.mjs |
Dev script for testing FCM push |
firebase.json |
Asset links hosting headers |
public/.well-known/assetlinks.json |
Android App Links verification |
android/** |
Full Android Capacitor project |
SAFETY_STANDARDS.md, README.md |
Safety policy documentation |
.gitignore |
Android build artifacts |
Files not reviewed (1)
- functions/package-lock.json: Language not supported
You can also share your feedback on Copilot code review. Take the survey.
| console.log('[NativePush] FCM token refreshed, re-registering'); | ||
|
|
||
| // Clean up old relay registration | ||
| if (registrationId) { |
| } | ||
|
|
||
| otter-drawer::part(base) { | ||
| margin-top: calc(env(safe-area-inset-top, 0px)); |
| const FCM_TOKEN = | ||
| 'cwLimXX-QJ2ku6R8dtYZQr:APA91bEZ-NHZIEph_KKpEamRXC0GvsdHnIUdLm2GKzAreL5m3VDx616oz5sE9ET6aTbIheKo0AGrSGIPHYnOXA2R0oDtzI6dOU4PvIweA2SclEg5rSkDcgk'; |
| md-dialog::part(dialog) { | ||
| min-width: 100vw; | ||
| min-height: 100vh; | ||
| margin-top: calc(env(safe-area-inset-top, 0px)); |
| background: var(--md-sys-color-background); | ||
| height: calc(env(titlebar-area-height, 33px) - 4px); | ||
| background: transparent; |
| window.postMessage( | ||
| { | ||
| type: 'push-notification', | ||
| notificationType: data.notification_type, | ||
| notificationId: data.notification_id, | ||
| }, | ||
| '*' | ||
| ); |
…n in the android app
|
Visit the preview URL for this PR (updated for commit 1321999): https://coho-mastodon--pr403-profile-header-photo-7n5zzk9y.web.app (expires Sat, 28 Mar 2026 06:16:49 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 22a5c1adab53191fa6702e9454dee7bd02b2edd7 |
This pull request introduces the initial Android app project structure for the Coho Mastodon client, including configuration, build scripts, resources, and safety documentation. The most significant changes are the addition of the Android app codebase, project configuration files, and a new safety standards policy.
Android App Project Initialization
android/directory, including:build.gradle,capacitor.build.gradle, etc.) for project and app configuration. [1] [2]AndroidManifest.xml,MainActivity.java). [1] [2]google-services.json).Testing and Instrumentation
Documentation and Safety Standards
README.mdto link to the new safety standards documentation needed for Google Play