Skip to content

Android build with Capacitor#403

Open
jgw96 wants to merge 21 commits intomainfrom
profile-header-photo
Open

Android build with Capacitor#403
jgw96 wants to merge 21 commits intomainfrom
profile-header-photo

Conversation

@jgw96
Copy link
Owner

@jgw96 jgw96 commented Mar 17, 2026

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

  • Added a complete Android project structure under the android/ directory, including:
    • Gradle build files (build.gradle, capacitor.build.gradle, etc.) for project and app configuration. [1] [2]
    • AndroidManifest and core Java entry point (AndroidManifest.xml, MainActivity.java). [1] [2]
    • Resource files for app icons, splash screens, layouts, and colors. [1] [2] [3] [4]
    • Firebase configuration for push notifications (google-services.json).
    • ProGuard rules and gitignore files for proper build and version control management. [1] [2] [3]

Testing and Instrumentation

  • Added a sample instrumented test for the Android app to verify the application context.

Documentation and Safety Standards

  • Updated the README.md to link to the new safety standards documentation needed for Google Play

Copilot AI review requested due to automatic review settings March 17, 2026 06:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
},
'*'
);
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.

2 participants