Add webview communication with the frontend#2965
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughA new documentation section titled "WebView communication architecture" is added to the Android architecture guide, detailing the communication flow between Home Assistant Frontend JS and internal Android components, including architecture overview and component responsibilities. This is a documentation-only addition with no code or behavior changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/android/architecture.md (1)
119-119: Consider clarifying the arrow label for consistency.The label
"FrontendJsHandler"appears to reference an interface or type, while other labels in the diagram use method names or actions (e.g.,"getExternalAuth()","onMessageReceived()"). Consider making this label more descriptive to match the pattern, such as"implements FrontendJsHandler"or"via FrontendJsHandler".📝 Suggested clarification
- JsBridge -->|"FrontendJsHandler"| MsgHandler + JsBridge -->|"via FrontendJsHandler"| MsgHandleror
- JsBridge -->|"FrontendJsHandler"| MsgHandler + JsBridge -->|"implements FrontendJsHandler"| MsgHandler🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/android/architecture.md` at line 119, The diagram arrow label "FrontendJsHandler" is ambiguous compared to other action/method labels; update the label between JsBridge and MsgHandler to a descriptive phrase like "implements FrontendJsHandler" or "via FrontendJsHandler" so it matches the pattern of method/action labels (reference: JsBridge, FrontendJsHandler, MsgHandler).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/android/architecture.md`:
- Line 92: The two broken links in the sentence referencing external
authentication and external bus need updating: replace the paths
`/docs/api/native-app-integration/frontend/external-authentication` and
`/docs/api/native-app-integration/frontend/external-bus` with the correct
`/docs/frontend/external-authentication` and `/docs/frontend/external-bus`
respectively so the WebView paragraph links point to the actual documentation
pages.
---
Nitpick comments:
In `@docs/android/architecture.md`:
- Line 119: The diagram arrow label "FrontendJsHandler" is ambiguous compared to
other action/method labels; update the label between JsBridge and MsgHandler to
a descriptive phrase like "implements FrontendJsHandler" or "via
FrontendJsHandler" so it matches the pattern of method/action labels (reference:
JsBridge, FrontendJsHandler, MsgHandler).
|
@jpelgrom do we wait for it to be use before merging this? |
|
Mermaid styling seems to need some tweaks for dark mode...
Yes I'd wait until this is actually how the main WebView works, we might tweak it while developing. |
|
From what I understand, this isn't ready for merge yet, hence setting as draft. |
Exactly. I'll handle the merge, once the migration is going to be over. We are merging small bits at the time in debug only in the app. I'm going to probably keep this PR for a while and might update it along the way. The progress can be tracked in home-assistant/android#6424 |
Proposed change
Add a small mermaid diagram explaining how the communication with the frontend is working in the Android app.
Type of change
Checklist
Additional information
Summary by CodeRabbit