Conversation
Contributor
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)); |
Comment on lines
+15
to
+16
| 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)); |
Comment on lines
58
to
+60
| background: var(--md-sys-color-background); | ||
| height: calc(env(titlebar-area-height, 33px) - 4px); | ||
| background: transparent; |
Comment on lines
+284
to
+291
| window.postMessage( | ||
| { | ||
| type: 'push-notification', | ||
| notificationType: data.notification_type, | ||
| notificationId: data.notification_id, | ||
| }, | ||
| '*' | ||
| ); |
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.
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