fix(android): detekt's file-name, function-count and line-length findings on the DRY batch
release / web (push) Successful in 1m41s
release / go (push) Successful in 2m2s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m22s
release / android (push) Failing after 3m45s
release / Build signed APK (push) Successful in 5m2s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m41s
release / go (push) Successful in 2m2s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m22s
release / android (push) Failing after 3m45s
release / Build signed APK (push) Successful in 5m2s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
SendOrQueue.kt is named for its one class, WriteOutcome.kt. toggleTrackLike becomes an extension on LikesRepository, keeping the class under the function cap. A long test line is split. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import com.fabledsword.minstrel.connectivity.NetworkStatusController
|
|||||||
import com.fabledsword.minstrel.connectivity.recoveries
|
import com.fabledsword.minstrel.connectivity.recoveries
|
||||||
import com.fabledsword.minstrel.library.data.LibraryRepository
|
import com.fabledsword.minstrel.library.data.LibraryRepository
|
||||||
import com.fabledsword.minstrel.likes.data.LikesRepository
|
import com.fabledsword.minstrel.likes.data.LikesRepository
|
||||||
|
import com.fabledsword.minstrel.likes.data.toggleTrackLike
|
||||||
import com.fabledsword.minstrel.models.AlbumDetailRef
|
import com.fabledsword.minstrel.models.AlbumDetailRef
|
||||||
import com.fabledsword.minstrel.models.AlbumRef
|
import com.fabledsword.minstrel.models.AlbumRef
|
||||||
import com.fabledsword.minstrel.nav.AlbumDetail
|
import com.fabledsword.minstrel.nav.AlbumDetail
|
||||||
|
|||||||
@@ -151,14 +151,6 @@ class LikesRepository @Inject constructor(
|
|||||||
|
|
||||||
// ── Writes (optimistic local → best-effort REST → enqueue on fail) ──
|
// ── Writes (optimistic local → best-effort REST → enqueue on fail) ──
|
||||||
|
|
||||||
/**
|
|
||||||
* Flips a track's like, reading whether it is liked now from [likedIds],
|
|
||||||
* the set the screen is already showing. The heart buttons on track lists
|
|
||||||
* (an album, a playlist, the player) call this.
|
|
||||||
*/
|
|
||||||
suspend fun toggleTrackLike(trackId: String, likedIds: Set<String>): Boolean =
|
|
||||||
toggleLike(ENTITY_TRACK, trackId, desiredState = trackId !in likedIds)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle like state for [entityType]/[entityId]. UI doesn't need to
|
* Toggle like state for [entityType]/[entityId]. UI doesn't need to
|
||||||
* await this; the Flow re-emits immediately from the optimistic
|
* await this; the Flow re-emits immediately from the optimistic
|
||||||
@@ -254,3 +246,11 @@ class LikesRepository @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flips a track's like, reading whether it is liked now from [likedIds], the
|
||||||
|
* set the screen is already showing. The heart buttons on track lists (an
|
||||||
|
* album, a playlist, the player) call this.
|
||||||
|
*/
|
||||||
|
suspend fun LikesRepository.toggleTrackLike(trackId: String, likedIds: Set<String>): Boolean =
|
||||||
|
toggleLike(LikesRepository.ENTITY_TRACK, trackId, desiredState = trackId !in likedIds)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.fabledsword.minstrel.player.ui
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.fabledsword.minstrel.likes.data.LikesRepository
|
import com.fabledsword.minstrel.likes.data.LikesRepository
|
||||||
|
import com.fabledsword.minstrel.likes.data.toggleTrackLike
|
||||||
import com.fabledsword.minstrel.player.PlayerController
|
import com.fabledsword.minstrel.player.PlayerController
|
||||||
import com.fabledsword.minstrel.player.PlayerUiState
|
import com.fabledsword.minstrel.player.PlayerUiState
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
|||||||
+1
@@ -66,6 +66,7 @@ import com.fabledsword.minstrel.connectivity.NetworkStatusController
|
|||||||
import com.fabledsword.minstrel.connectivity.recoveries
|
import com.fabledsword.minstrel.connectivity.recoveries
|
||||||
import com.fabledsword.minstrel.events.EventsStream
|
import com.fabledsword.minstrel.events.EventsStream
|
||||||
import com.fabledsword.minstrel.events.LiveEvent
|
import com.fabledsword.minstrel.events.LiveEvent
|
||||||
|
import com.fabledsword.minstrel.likes.data.toggleTrackLike
|
||||||
import com.fabledsword.minstrel.models.PlaylistRef
|
import com.fabledsword.minstrel.models.PlaylistRef
|
||||||
import com.fabledsword.minstrel.models.PlaylistTrackRef
|
import com.fabledsword.minstrel.models.PlaylistTrackRef
|
||||||
import com.fabledsword.minstrel.models.TrackRef
|
import com.fabledsword.minstrel.models.TrackRef
|
||||||
|
|||||||
+2
-1
@@ -49,6 +49,7 @@ class SendOrQueueTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `the replayer and the live write agree on what is worth retrying`() {
|
fun `the replayer and the live write agree on what is worth retrying`() {
|
||||||
assertEquals(listOf(408, 429, 500, 503), listOf(400, 403, 404, 408, 409, 429, 500, 503).filter(::isRetryableStatus))
|
val statuses = listOf(400, 403, 404, 408, 409, 429, 500, 503)
|
||||||
|
assertEquals(listOf(408, 429, 500, 503), statuses.filter(::isRetryableStatus))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user