mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-17 11:12:33 +02:00
fix now playing swipe softlock
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ class CatalogMigrationTest {
|
||||
).use { cursor ->
|
||||
assertTrue(cursor.moveToFirst())
|
||||
assertEquals("jellyfin:2", cursor.getString(0))
|
||||
assertEquals(CURRENT_ARTIST_CREDIT_VERSION, cursor.getInt(1))
|
||||
assertEquals(INITIAL_MULTI_ARTIST_CREDIT_VERSION, cursor.getInt(1))
|
||||
assertTrue(cursor.moveToNext())
|
||||
assertEquals("local:1", cursor.getString(0))
|
||||
assertEquals(LEGACY_ARTIST_CREDIT_VERSION, cursor.getInt(1))
|
||||
|
||||
+6
-8
@@ -10,8 +10,12 @@ import com.google.android.exoplayer2.metadata.id3.TextInformationFrame
|
||||
import java.util.concurrent.TimeUnit
|
||||
import org.json.JSONArray
|
||||
|
||||
internal const val CURRENT_ARTIST_CREDIT_VERSION = 2
|
||||
internal const val LEGACY_ARTIST_CREDIT_VERSION = 1
|
||||
internal const val INITIAL_MULTI_ARTIST_CREDIT_VERSION = 2
|
||||
// Version 3 removes synthesized ampersands from stored display strings.
|
||||
// Keeping this independent of the Room schema version lets existing local
|
||||
// version-2 catalogs use the normal stale-source full-reindex path.
|
||||
internal const val CURRENT_ARTIST_CREDIT_VERSION = 3
|
||||
|
||||
internal data class ArtistCreditNames(
|
||||
val artists: List<String> = emptyList(),
|
||||
@@ -33,13 +37,7 @@ internal fun normalizeArtistNames(values: Iterable<String?>): List<String> {
|
||||
}
|
||||
|
||||
internal fun formatArtistNames(values: Iterable<String?>): String {
|
||||
val names = normalizeArtistNames(values)
|
||||
return when (names.size) {
|
||||
0 -> ""
|
||||
1 -> names[0]
|
||||
2 -> "${names[0]} & ${names[1]}"
|
||||
else -> "${names.dropLast(1).joinToString(", ")} & ${names.last()}"
|
||||
}
|
||||
return normalizeArtistNames(values).joinToString(", ")
|
||||
}
|
||||
|
||||
internal fun serializeArtistNames(values: Iterable<String?>): String? {
|
||||
|
||||
+3
-2
@@ -16,8 +16,9 @@ class ArtistCreditsTest {
|
||||
|
||||
assertEquals(listOf("Earth, Wind & Fire", "The Emotions"), credits.artists)
|
||||
assertEquals(listOf("Curator One", "Curator Two"), credits.albumArtists)
|
||||
assertEquals("Earth, Wind & Fire & The Emotions", formatArtistNames(credits.artists))
|
||||
assertEquals("Curator One & Curator Two", formatArtistNames(credits.albumArtists))
|
||||
assertEquals("Earth, Wind & Fire, The Emotions", formatArtistNames(credits.artists))
|
||||
assertEquals("Curator One, Curator Two", formatArtistNames(credits.albumArtists))
|
||||
assertEquals("1, 2, 3", formatArtistNames(listOf("1", "2", "3")))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user