Skip to content

feat: Implement Android target and platform abstraction#251

Open
zortos293 wants to merge 18 commits intodevfrom
capy/android-capacitor-target
Open

feat: Implement Android target and platform abstraction#251
zortos293 wants to merge 18 commits intodevfrom
capy/android-capacitor-target

Conversation

@zortos293
Copy link
Copy Markdown
Collaborator

@zortos293 zortos293 commented Apr 10, 2026

This PR introduces a Capacitor-based Android target that shares the existing React renderer with the Electron desktop client. Core flows (auth, session management, signaling, game catalog, settings) are implemented on Android using Capacitor plugins and browser APIs, while desktop behavior is preserved through a new platform abstraction layer.

Platform Abstraction & Shared Runtime:

  • Created src/renderer/src/platform/ to export openNow (API), platform, and platformCapabilities, selecting Electron or Capacitor implementations at runtime.
  • Extracted shared auth constants and helpers to src/shared/gfnRuntime.ts (replacing Node-only crypto with web equivalents where possible).
  • Created src/shared/settings.ts to provide DEFAULT_SETTINGS to both Electron and Android implementations.

Android Implementation:

  • Implemented OpenNowApi in src/renderer/src/platform/android/api.ts using @capacitor/http, @capacitor/browser, @capacitor/preferences, @capacitor/filesystem, and a browser WebSocket signaling client.
  • Implemented AndroidAuthService to handle OAuth flow via an external browser launcher with deep-link callback (com.opencloudgaming.opennow://auth/callback).
  • Synchronized CloudMatch session creation/polling/claim/stop logic using the shared types and helper functions.

Renderer Refactor:

  • Replaced direct window.openNow access in src/renderer/src/App.tsx, src/renderer/src/components/SettingsPage.tsx, src/renderer/src/components/StreamView.tsx, src/renderer/src/components/ControllerLibraryPage.tsx, and src/renderer/src/gfn/webrtcClient.ts with imports from the new platform layer.

Feature Gating:

  • Added PlatformCapabilities checks in SettingsPage.tsx to hide log export and cache deletion buttons on Android.
  • Updated StreamView.tsx and ControllerLibraryPage.tsx to disable or hide folder access (show-in-folder) and screenshot export actions on Android.
  • Updated App.tsx to guard pointer-lock and quit-app shortcuts against Android platform capabilities.

Capacitor & Build Configuration:

  • Added capacitor.config.ts with appId: com.opencloudgaming.opennow and configured the server scheme.
  • Initialized android/ project with an intent filter for OAuth deep-linking.
  • Added build:web, cap:sync:android, and cap:open:android scripts to package.json.

Documentation:

  • Updated README.md and docs/development.md to describe the Android target, limitations (no log export/cache delete on Android in this pass), and build workflow.

Limitations:

  • On Android, getThanksData returns a placeholder; log export, cache deletion, and folder access are unavailable; pointer-lock and desktop shortcuts are hidden.

Open in Capy OPE-54 · 5.4

@zortos293 zortos293 added the capy Generated by capy.ai label Apr 10, 2026 — with Capy AI
Copy link
Copy Markdown
Contributor

@capy-ai capy-ai bot left a comment

Choose a reason for hiding this comment

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

Added 2 comments

Copy link
Copy Markdown
Contributor

@capy-ai capy-ai bot left a comment

Choose a reason for hiding this comment

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

Added 2 comments

@zortos293 zortos293 changed the title Implement Android target and platform abstraction feat: Implement Android target and platform abstraction Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants