Skip to content

Refactor app architecture for MVVM and state management#49

Draft
scorp867 wants to merge 2 commits into
masterfrom
cursor/refactor-app-architecture-for-mvvm-and-state-management-ccb2
Draft

Refactor app architecture for MVVM and state management#49
scorp867 wants to merge 2 commits into
masterfrom
cursor/refactor-app-architecture-for-mvvm-and-state-management-ccb2

Conversation

@scorp867

@scorp867 scorp867 commented Sep 6, 2025

Copy link
Copy Markdown
Owner

Refactor the app to implement proper MVVM, Hilt-based dependency injection, and centralized state management for improved maintainability and user experience.

This PR addresses several architectural issues, including direct repository access in UI, scattered business logic, and manual singleton patterns, which led to duplicate code, difficult testing, and inconsistent state handling. The changes centralize these concerns, making the app more robust and easier to extend.


Open in Cursor Open in Web

This commit introduces a comprehensive refactoring of the Musify app to adopt the MVVM architecture. Key changes include:

- **ViewModel Creation**: Dedicated ViewModels are now in place for various app sections, separating UI logic from data handling.
- **Dependency Injection**: Singleton patterns are removed from `SpotifyStyleDataManager` and `LibraryRepository`, with dependencies now managed by Hilt.
- **State Management**: Centralized state management for playback and scanning is implemented using new classes like `PlaybackStateManager` and `ScanningViewModel`.
- **State Persistence**: Playback and queue states are now automatically saved and restored, ensuring a seamless user experience across app sessions.
- **Code Duplication Elimination**: Redundant scanning and artwork extraction logic has been consolidated.
- **UI Updates**: `MainActivity2` and `HomeScreen2` are updated to leverage the new MVVM structure and state management.

These changes enhance code maintainability, testability, and overall application stability.

Co-authored-by: justinbieber821721 <justinbieber821721@gmail.com>
@cursor

cursor Bot commented Sep 6, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Co-authored-by: justinbieber821721 <justinbieber821721@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants