mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
address review: cancellation-safe star, one star handler, focus logic tested
- setStar no longer treats cancellation as a rejection: rethrow CancellationException instead of toasting/rolling back, and roll back under NonCancellable on a real failure - serialise setStar so overlapping toggles cannot clobber each other's rollback - the menu star item reverts its label when the request fails (setStar now returns the result), so the open menu cannot drift from the row - ContextMenuHost.dismiss clears the actions so a popped screen's ViewModel is released - one shared setStar from the app shell instead of five per-ViewModel copies - extract the nav-focus decision into focusPops and unit-test it
This commit is contained in:
@@ -8,7 +8,6 @@ import com.subtracks.data.model.Disc
|
||||
import com.subtracks.data.model.Song
|
||||
import com.subtracks.data.repo.LibraryRepository
|
||||
import com.subtracks.data.repo.SourceRepository
|
||||
import com.subtracks.data.source.StarType
|
||||
import com.subtracks.playback.PlaybackController
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@@ -54,12 +53,4 @@ class AlbumDetailViewModel(
|
||||
playbackController.shuffleAlbum(sourceId.first(), albumId)
|
||||
}
|
||||
}
|
||||
|
||||
fun setStar(
|
||||
type: StarType,
|
||||
id: String,
|
||||
starred: Boolean,
|
||||
) {
|
||||
viewModelScope.launch { libraryRepository.setStar(type, id, starred) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user