Skip to content

SongUI model / UI layer refactoring#536

Open
ztx-lyghters wants to merge 4 commits into
icefields:version_1.01-89from
ztx-lyghters:feature/presentation_songui_refactoring
Open

SongUI model / UI layer refactoring#536
ztx-lyghters wants to merge 4 commits into
icefields:version_1.01-89from
ztx-lyghters:feature/presentation_songui_refactoring

Conversation

@ztx-lyghters

Copy link
Copy Markdown

Implements SongUI - a UI layer equivalent of the domain layer Song model.

Has one additional boolean field isDownloaded to check the state of song's offline availability, which being checked via the dedicated method isAvailableOffline().

Implements mapper methods to convert between Song and SongUI objects (and lists of objects) both ways.
toSongUI() mapper for a single Song takes a boolean as an argument to set the isDownloaded variable, while toSongUI() for List<Song> takes a callback function, where IsSongAvailableOfflineUseCase can be passed without introducing a dependency.

Makes SongWrapper redundant (completely removes it from the code) and decouples domain's Song model from UI components (outside of view models).

Some naming changes are planned to make the code more readable, plus needs testing, so this is a draft for now.

Refactoring of the presentation layer in terms of handling song objects.

Presentation layer now operates with SongUI model objects, made specifically for UI purposes. It's a full copy of the Song model from the domain layer, with an extra isDownloaded boolean field, indicating the state of song's offline availability.

This change makes SongWrapper object redundant and allows to decouple views from the domain layer version of Song model.
Mapped some stuff to SongUI
@ztx-lyghters ztx-lyghters changed the base branch from main to version_1.01-89 June 11, 2026 04:32
Change `toDomainSong()` naming into `toSong()`, to follow the name of the actual model they refer to.

I still think `toDomainSong()` creates less confusion in the code, by avoiding `song.toSong()` situations. Maybe worth finding a different solution to this, to make the code less ambiguous.

I've considered renaming the variable identifiers instead (from `song` to `songUi` and from `songs` to `songUiList` or 'songsUi'), but that's very messy and creates additional unnecessary visual clutter.

So for now I would prefer leaving it like this.
@ztx-lyghters ztx-lyghters marked this pull request as ready for review June 16, 2026 22:55
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.

1 participant