refactor: eliminate code duplication in cursor operations and cleanup

- Extract cursor application logic into apply_cursor_by_index() helper
- Extract cleanup logic into perform_app_cleanup() helper
- Update select_cursor(), next_cursor(), and system tray handlers to use helpers
- Reduce ~55 lines of duplicated code while maintaining functionality
- Mark step 1 of code cleanup TODO as completed
This commit is contained in:
2025-05-30 22:24:33 -05:00
parent 16fc8949b3
commit c1b8160f4a
2 changed files with 106 additions and 69 deletions
+38
View File
@@ -0,0 +1,38 @@
# Code Cleanup TODO
## 🔥 Critical Issues
### 1. Code Duplication
- [x] Extract cursor application logic from `select_cursor()` and `next_cursor()`
- [x] Extract cleanup logic from `quit_app()` and system tray quit handler
### 2. Steam Integration
- [ ] Replace `unwrap()` with proper error handling in `Steam::new()`- Leave this on the backburner for now
- [ ] App should work fine even if Steam is offline (Steam remembers inventory, we pull from Steam even in offline mode) - Leave this on the backburner for now
### 3. Unsafe Thread-Safety
- [ ] Document or fix `SyncHCURSOR` unsafe impls in `types.rs`
## 🚨 High Priority
### 4. Debug Logging Spam
- [ ] Remove 73 debug print statements from production code
- [ ] Add proper logging framework
### 5. Mutex Unwraps
- [ ] Replace 9 `lock().unwrap()` calls with proper error handling
### 6. Large Functions
- [ ] Break down `load_cursor_files()` (90+ lines)
- [ ] Break down `create_cursor_from_image()` (170+ lines)
## 📋 Medium Priority
### 7. Mock Data Fallbacks
- [ ] Remove hardcoded fallback cursors pointing to non-existent files
### 8. Inline Event Handlers
- [ ] Extract system tray/window event handlers from Tauri builder
### 9. Error Handling
- [ ] Standardize error types and handling patterns