How biniter1/nt106_-_-n works
Project Type and Purpose
• This is a desktop chat application built with WPF (.NET) following the MVVM pattern.
• It provides real-time messaging, voice/video calls, file sharing, notifications, and AI-powered chat features.
• Under the hood it leverages Firebase (Firestore, Realtime Database, Storage), WebSocket signaling, WebRTC peer connections, and an AI service (Gemini).
Top-Level Structure
• WpfApp1.sln: Visual Studio solution.
• WpfApp1/: Main WPF project.
• Views/: XAML UI definitions.
• ViewModels/: Presentation logic.
• Models/: Domain entities and data-access helpers.
• Services/: Infrastructure clients (Firebase helpers, WebSocketService, WebRTCService, GeminiService, NotificationService, EventAggregator).
• Converters/: UI value converters.
Key Architectural Patterns
• MVVM: clear separation of View ↔ ViewModel ↔ Model.
• Event Aggregator: decouples cross-component events (StartChatEvent, NewMessageEventArgs).
• Service Layer: abstracts external dependencies (Firebase, WebSocket, WebRTC, AI).
a. Presentation Layer
• Views (XAML windows/user controls)
• Converters (value transformations)
b. Application Layer
• ViewModels: AIChatViewModel, ChatViewModel, CallViewModel, etc.
c. Domain Layer
• Models: Message, User, CallSignal, IceCandidateSignal, Group, FriendRequest, etc.
d. Infrastructure/Services
• Firebase Services: FirestoreHelper, RealtimeDatabaseHelper, FirebaseStorageHelper
• WebSocketService: signaling channel for chat and call negotiation
• WebRTCService: peer-to-peer audio/video
• GeminiService: AI chat backend
• NotificationService: UI notifications
• EventAggregator: in-process pub/sub
e. External Systems
• Google Firebase (Firestore, Realtime Database, Storage)
• WebSocket server (if custom)
• TURN/STUN servers for WebRTC
• AI endpoint (Gemini/OpenAI)
Relationships and Data Flows
• User interacts with View → bound properties/commands in ViewModel.
• ViewModel invokes Service API → external system (Firebase, WebSocket, AI).
• Service returns data/events → ViewModel (via callbacks or EventAggregator).
• ViewModel updates Model/ObservableCollection → View refreshes.
• For calls: WebSocketService exchanges SDP & ICE → WebRTCService negotiates peer connection → Media streams.
• For file uploads: ViewModel → FirebaseStorageHelper → Storage → returns URL back to ViewModel.