Modules
This section provides a detailed breakdown of each major feature module.
1. Onboarding Module (/lib/onboarding)
This module is responsible for the user's first experience with the app.
Splash Screen: A visually rich, animated splash screen that appears for 3 seconds on the first launch. Managed by
SplashController.Onboarding Flow: An engaging, 4-step onboarding process with auto-advancing screens and animated progress bars.
State Persistence: The
OnboardingProviderusesshared_preferencesto track whether the user has completed the flow, ensuring it's only shown once.
[Placeholder for a GIF showing the animated onboarding flow.]
2. Authentication Module (/lib/auth)
This module handles user registration and login, architected with a clear separation of data, application, and presentation layers.
UI Flow: The
LoginScreenpresents a multi-step input process, first asking for a username, then for a password.State Management: The
AuthProvidermanages the user's authentication state (isAuthenticated,isLoading,error).Routing: The app's router logic listens to
AuthProviderand directs the user to theHomePageupon successful login.
[Placeholder for a screenshot of the Login Screen.]
3. Agent Interaction Module (/lib/agent)
This is the core feature where the user has a real-time conversation with the D-ID avatar.
The process is a sophisticated orchestration of several services:
Code snippet
Copy
sequenceDiagram
participant User
participant AgentPage (UI)
participant AgentController
participant TranscriptService (Socket.IO)
participant Backend
participant DidApi
participant D-ID
User->>AgentPage (UI): Taps record button
AgentPage (UI)->>AgentController: toggleVoiceRecording()
AgentController->>TranscriptService (Socket.IO): unmute() & start sending audio chunks
User->>TranscriptService (Socket.IO): Speaks (audio stream)
TranscriptService (Socket.IO)->>Backend: Streams audio chunks
Backend-->>TranscriptService (Socket.IO): Sends back text transcript
TranscriptService (Socket.IO)->>AgentController: onTranscript(text) callback
AgentController->>DidApi: sendMessage(text)
DidApi->>D-ID: POST /.../message with text
D-ID-->>AgentController: Streams video/audio via WebRTC
AgentController->>AgentPage (UI): Renders video stream in RTCVideoView
User->>AgentPage (UI): Sees and hears agent respondLast updated