Plugin System Implementation - v1 (android)#201
Open
mayansharma wants to merge 3 commits intomainfrom
Open
Conversation
|
DeputyDev will no longer review pull requests automatically.To request a review, simply comment #review on your pull request—this will trigger an on-demand review whenever you need it. |
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.
Android Internal Plugin System (Current PR State)
Context
This change evolves the earlier plugin work into an internal-only plugin architecture for Android, intended to migrate existing NativeBridge features gradually into internal plugins.
Key intent:
WEBVIEW_CONFIG.What’s Included
1) Isolated plugin bridge surface (web)
Export:
catalyst-core/PluginBridgeAPI:
bridge.init()bridge.emit({ pluginId, command, data })bridge.callback({ pluginId, eventName, handler })bridge.unregister({ pluginId, eventName })2) Android runtime plugin dispatch
Runtime path:
PluginBridge.ktreceives JSON payload from JS.pluginIdandcommandfrom generated index.handle(command, data, bridge).PluginBridgeContext.callback(...).__bridge__/PLUGIN_BRIDGE_ERROR.3) Internal-only plugin composition (Android)
Composer now discovers plugins only from core internal directories:
src/native/internal-pluginsdist/native/internal-pluginsNo app-level discovery from
<app-root>/plugin|plugins|catalyst-plugins.4) Config-driven feature toggles (
WEBVIEW_CONFIG.plugins)Users control plugin enablement only from
config/config.json:{ "WEBVIEW_CONFIG": { "plugins": { "echo": true } } }Toggle resolution:
manifest.configKeyfirst,id,configKey+idvalues hard-fail build.Default policy:
true.5) Strict cleanup semantics
Composer now reconciles plugin mutations strictly on each build:
This ensures disabling a plugin removes its managed side effects from composed outputs.
6) Manifest contract (Android, current)
Required:
idversioncommands(non-empty)android.classNameOptional:
configKey(recommended for user-facing toggle names)callbacksandroid.permissionsandroid.dependenciesExample Internal Plugin (Echo)
Folder:
Manifest:
{ "id": "io.catalyst.echo", "configKey": "echo", "version": "1.0.0", "commands": ["log"], "callbacks": ["onLogged"], "android": { "className": "io.yourname.androidproject.plugins.internal.echo.EchoPlugin", "permissions": [], "dependencies": [] } }Web usage: