refactor(wan_external): migrate JNAP logic to service layer - #547
Conversation
- Create WanExternalService encapsulating JNAP communication - Create WanExternalUIModel to isolate JNAP model from provider layer - Refactor WANExternalNotifier to use service instead of direct JNAP calls - Update WANExternalState to use UI model - Update instant_verify_state.dart consumer to use UI model type - Add comprehensive unit tests for service, provider, state, and UI model (33 tests) - Add test data builder for WAN external tests
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
…an_external - Resolved conflict in instant_verify_state.dart - Kept unified UI Models from dev-2.0.0 - WanExternalUIModel is included in instant_verify_ui_models.dart
- Remove duplicate WanExternalUIModel from core/jnap/models - Use unified WanExternalUIModel from instant_verify_ui_models.dart - Remove transformWanExternal method and related test mocks - Update imports to use consistent UI model definition
User description
Summary
Refactor WanExternal provider to comply with constitution guidelines by migrating JNAP logic to service layer.
Changes
WanExternalServiceencapsulating JNAP communicationWanExternalUIModelisolating JNAP model from provider layerWANExternalNotifiernow uses service instead of direct JNAP callsinstant_verify_state.dartuses UI model typeTests
Architecture Compliance
PR Type
Enhancement
Description
Create WanExternalService encapsulating JNAP communication logic
Create WanExternalUIModel isolating JNAP model from provider layer
Refactor WANExternalNotifier to use service instead of direct JNAP calls
Update state and consumers to use UI model type
Add 33 comprehensive unit tests covering service, provider, state, and UI model
Diagram Walkthrough
File Walkthrough
5 files
New UI model isolating JNAP data from presentationNew service layer encapsulating JNAP communicationRefactor provider to use service layerUpdate state to use UI model instead of JNAP modelUpdate consumer to use UI model type5 files
Add comprehensive UI model unit testsAdd service layer unit tests with error handlingAdd provider unit tests with cache and error scenariosAdd state serialization and equality unit testsAdd reusable test data builder for WAN external tests