feat: Implement Android target and platform abstraction#251
Open
feat: Implement Android target and platform abstraction#251
Conversation
opennow-stable/android/app/src/main/java/com/opencloudgaming/opennow/LocalhostAuthPlugin.java
Outdated
Show resolved
Hide resolved
This reverts commit c24021b.
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 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:
src/renderer/src/platform/to exportopenNow(API),platform, andplatformCapabilities, selecting Electron or Capacitor implementations at runtime.src/shared/gfnRuntime.ts(replacing Node-only crypto with web equivalents where possible).src/shared/settings.tsto provideDEFAULT_SETTINGSto both Electron and Android implementations.Android Implementation:
OpenNowApiinsrc/renderer/src/platform/android/api.tsusing@capacitor/http,@capacitor/browser,@capacitor/preferences,@capacitor/filesystem, and a browser WebSocket signaling client.AndroidAuthServiceto handle OAuth flow via an external browser launcher with deep-link callback (com.opencloudgaming.opennow://auth/callback).Renderer Refactor:
window.openNowaccess insrc/renderer/src/App.tsx,src/renderer/src/components/SettingsPage.tsx,src/renderer/src/components/StreamView.tsx,src/renderer/src/components/ControllerLibraryPage.tsx, andsrc/renderer/src/gfn/webrtcClient.tswith imports from the new platform layer.Feature Gating:
PlatformCapabilitieschecks inSettingsPage.tsxto hide log export and cache deletion buttons on Android.StreamView.tsxandControllerLibraryPage.tsxto disable or hide folder access (show-in-folder) and screenshot export actions on Android.App.tsxto guard pointer-lock and quit-app shortcuts against Android platform capabilities.Capacitor & Build Configuration:
capacitor.config.tswithappId: com.opencloudgaming.opennowand configured the server scheme.android/project with an intent filter for OAuth deep-linking.build:web,cap:sync:android, andcap:open:androidscripts topackage.json.Documentation:
README.mdanddocs/development.mdto describe the Android target, limitations (no log export/cache delete on Android in this pass), and build workflow.Limitations:
getThanksDatareturns a placeholder; log export, cache deletion, and folder access are unavailable; pointer-lock and desktop shortcuts are hidden.