@@ -84,6 +84,10 @@ pub struct AppState {
8484 pub active_panel : Panel ,
8585 pub selected_android : usize ,
8686 pub selected_ios : usize ,
87+ pub mode : Mode ,
88+
89+ // API Level Management (New in v2.0)
90+ pub api_level_management : Option <ApiLevelManagementState >,
8791
8892 // Background operations
8993 pub is_loading : bool ,
@@ -96,6 +100,11 @@ pub struct AppState {
96100 // Logging and notifications
97101 pub device_logs : VecDeque <LogEntry >,
98102 pub notifications : VecDeque <Notification >,
103+
104+ // Dialogs
105+ pub create_device_form : CreateDeviceForm ,
106+ pub confirm_delete_dialog : Option <ConfirmDeleteDialog >,
107+ pub confirm_wipe_dialog : Option <ConfirmWipeDialog >,
99108}
100109```
101110
@@ -179,7 +188,27 @@ impl DeviceManager for IosManager {
179188- Easy testing with mock implementations
180189- Clear separation of platform-specific logic
181190
182- ### 2. Async State Management
191+ ### 2. API Level Management System (New)
192+
193+ ** Purpose** : Dynamic system image management for Android devices.
194+
195+ ``` rust
196+ pub struct ApiLevelManagementState {
197+ pub api_levels : Vec <ApiLevel >,
198+ pub selected_index : usize ,
199+ pub is_loading : bool ,
200+ pub install_progress : Option <InstallProgress >,
201+ pub scroll_offset : usize ,
202+ }
203+ ```
204+
205+ ** Features** :
206+ - Real-time installation progress tracking
207+ - Scrollable UI with keyboard navigation
208+ - Automatic cache invalidation on changes
209+ - Background installation with progress callbacks
210+
211+ ### 3. Async State Management
183212
184213** Purpose** : Provide thread-safe state access with non-blocking operations.
185214
@@ -312,7 +341,7 @@ App::new() → tokio::spawn() → list_devices() → state.devices = ... → ren
3123411 . ** Immediate UI Rendering** : Show interface within ~ 50ms
3133422 . ** Background Data Loading** : Load device lists asynchronously
3143433 . ** Progressive Enhancement** : Add features as data becomes available
315- 4 . ** Cache Utilization ** : Use cached data when available
344+ 4 . ** Cache Preloading ** : Preload device types and API levels at startup
3163455 . ** Target Performance** : Startup time < 150ms (typical: ~ 104ms)
317346
318347### Runtime Optimization
@@ -466,4 +495,44 @@ async fn test_startup_performance() {
466495- ** predicates** : Complex assertion conditions
467496- ** Custom Assertions** : Domain-specific test helpers
468497
498+ ## New Features in v2.0
499+
500+ ### API Level Management
501+ - ** Dynamic System Image Discovery** : Real-time detection of available system images
502+ - ** Installation Progress Tracking** : Live progress updates during installation
503+ - ** Smart Cache Invalidation** : Automatic cache refresh on system image changes
504+ - ** Architecture Detection** : Automatic selection of optimal architecture (x86_64/arm64)
505+
506+ ### Enhanced Caching System
507+ - ** Device Creation Cache** : Pre-loaded device types and API levels
508+ - ** Background Refresh** : Automatic cache updates without blocking UI
509+ - ** Context-Aware Invalidation** : Cache cleared on relevant operations
510+
511+ ### Improved User Experience
512+ - ** Scrollable Dialogs** : Better handling of long lists
513+ - ** Loading Indicators** : Clear feedback during async operations
514+ - ** Keyboard Navigation** : Circular navigation in device lists
515+ - ** Real-time Status Updates** : Live device status monitoring
516+
517+ ### iOS Simulator Integration
518+ - ** Automatic App Lifecycle** : Simulator.app opens automatically when starting devices
519+ - ** Smart Cleanup** : Simulator.app quits automatically when last device stops
520+ - ** Graceful Shutdown** : Uses AppleScript for clean app termination with fallback
521+ - ** Dock Management** : Prevents Simulator.app icon from lingering in Dock
522+
523+ ## Constants Architecture
524+
525+ The application uses a modular constants system (` constants/ ` ):
526+
527+ ```
528+ constants/
529+ ├── commands.rs # CLI tool names and arguments
530+ ├── defaults.rs # Default values and configurations
531+ ├── env_vars.rs # Environment variable names
532+ ├── files.rs # File paths and extensions
533+ ├── messages.rs # User-facing strings and messages
534+ ├── patterns.rs # Regular expressions for parsing
535+ └── performance.rs # Performance tuning parameters
536+ ```
537+
469538This architecture provides a solid foundation for building a responsive, maintainable, and cross-platform terminal application while ensuring reliability through comprehensive testing.
0 commit comments