feat: drive RPC connection banner from NetworkConnectionBannerController (WPC-1014)#31225
feat: drive RPC connection banner from NetworkConnectionBannerController (WPC-1014)#31225cryptodev-2s wants to merge 7 commits into
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"This check is informational while the PR is in draft. It will start blocking once you mark the PR as Ready for review.
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
53f5fc2 to
2abcc76
Compare
Wires the new core package into mobile via the standard messenger-client init pattern. The controller is alongside the existing useNetworkConnectionBanner hook — clients can now subscribe to its state-change events, and a follow-up PR will migrate the hook to read from the controller's state instead of the local Redux reducer. Mobile's installed controller versions are older than the preview package's resolved peer ranges (network-controller@31 vs ^32, connectivity-controller@0.1 vs ^0.2). Runtime shapes are compatible — all event names and state field names align — so the type-level mismatch at the messenger boundary is bridged with a single cast in the messenger factory. The cast can be dropped once mobile bumps its controller versions to match.
…Controller The new controller registered in the previous commit owns the show/hide rule, 5s/30s timer escalation, and the switch-to-Infura action. With it in place, the in-app duplicates are dead code: - delete app/reducers/networkConnectionBanner and app/actions/networkConnectionBanner - selector now reads from engine.backgroundState.NetworkConnectionBannerController and adapts to the existing UI shape (visible: boolean + flat fields) - useNetworkConnectionBanner hook drops the inline checkNetworkStatus function, the two timers, the rpcEndpointChainAvailable subscription, and the dispatch calls; switchToInfura now calls the controller via NetworkConnectionBannerController:switchToDefaultInfuraRpc - UI component and analytics events are unchanged
After the connectivity-controller bump to ^0.2.0 the version-skew at the messenger boundary narrows to event-name aliases: the preview package's messenger expects each peer's `:stateChanged` event while mobile's GlobalEvents union still registers the legacy `:stateChange` flavor. BaseController publishes both at runtime, so wiring works.
2abcc76 to
8f62d2b
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
Description
Replaces the in-app duplicate of the RPC connection banner rule + 5s/30s timer escalation with the new
@metamask/network-connection-banner-controller, registered in mobile's Engine.Wiring
package.jsondeclares the controller as@metamask/network-connection-banner-controllerwith a Yarnresolutionsalias to the preview tarball (@metamask-previews/network-connection-banner-controller@0.1.0-preview-7507a11). When the package ships under its real name, only the resolution line gets removed — no code changes.app/core/Engine/; registered inEngine.ts,messengers/index.ts, andtypes.ts.network-controller@^32vs@31,connectivity-controller@^0.2vs@0.1). Runtime shapes match (same event names + state fields); the type-only mismatch at the messenger boundary is bridged with oneas unknown ascast in the messenger factory — removable once mobile bumps versions.Cleanup
app/reducers/networkConnectionBanner/andapp/actions/networkConnectionBanner/.engine.backgroundState.NetworkConnectionBannerControllerand adapts to the existing UI's{ visible: boolean }shape, so the banner component is untouched.useNetworkConnectionBannerhook drops the inlinecheckNetworkStatus, the twosetTimeouts, therpcEndpointChainAvailablesubscription, and allshowNetworkConnectionBanner/hideNetworkConnectionBannerdispatches.switchToInfuranow callsNetworkConnectionBannerController:switchToDefaultInfuraRpc. Analytics + navigation unchanged.Net diff: −2,310 LOC. No user-visible behavior change.
Core PR: MetaMask/core#9041
Changelog
CHANGELOG entry: null
Related issues
Fixes: WPC-1014
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist