Skip to content

Commit d5dfbcf

Browse files
committed
Fix some build warnings
1 parent 300d10c commit d5dfbcf

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

android/data/src/main/kotlin/com/simplecityapps/shuttle/model/Album.kt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.simplecityapps.shuttle.model
33
import android.os.Parcelable
44
import com.simplecityapps.shuttle.parcel.InstantParceler
55
import kotlinx.datetime.Instant
6+
import kotlinx.parcelize.IgnoredOnParcel
67
import kotlinx.parcelize.Parcelize
78
import kotlinx.parcelize.TypeParceler
89

@@ -19,19 +20,22 @@ data class Album(
1920
val lastSongPlayed: Instant?,
2021
val lastSongCompleted: Instant?,
2122
val groupKey: AlbumGroupKey?,
22-
val mediaProviders: List<MediaProviderType>
23+
val mediaProviders: List<MediaProviderType>,
2324
) : Parcelable {
24-
val friendlyArtistName: String? =
25-
if (artists.isNotEmpty()) {
26-
if (artists.size == 1) {
27-
artists.first()
28-
} else {
29-
artists.groupBy { it.lowercase().removeArticles() }
30-
.map { map -> map.value.maxByOrNull { it.length } }
31-
.joinToString(", ")
32-
.ifEmpty { null }
25+
@IgnoredOnParcel
26+
val friendlyArtistName: String?
27+
by lazy {
28+
if (artists.isNotEmpty()) {
29+
if (artists.size == 1) {
30+
artists.first()
31+
} else {
32+
artists.groupBy { it.lowercase().removeArticles() }
33+
.map { map -> map.value.maxByOrNull { it.length } }
34+
.joinToString(", ")
35+
.ifEmpty { null }
36+
}
37+
} else {
38+
null
39+
}
3340
}
34-
} else {
35-
null
36-
}
3741
}

android/data/src/main/kotlin/com/simplecityapps/shuttle/model/AlbumArtist.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.simplecityapps.shuttle.model
22

33
import android.os.Parcelable
4+
import kotlinx.parcelize.IgnoredOnParcel
45
import kotlinx.parcelize.Parcelize
56

67
@Parcelize
@@ -11,9 +12,10 @@ data class AlbumArtist(
1112
val songCount: Int,
1213
val playCount: Int,
1314
val groupKey: AlbumArtistGroupKey,
14-
val mediaProviders: List<MediaProviderType>
15+
val mediaProviders: List<MediaProviderType>,
1516
) : Parcelable {
16-
val friendlyArtistName: String? =
17+
@IgnoredOnParcel
18+
val friendlyArtistName: String? by lazy {
1719
if (artists.isNotEmpty()) {
1820
if (artists.size == 1) {
1921
artists.first()
@@ -26,4 +28,5 @@ data class AlbumArtist(
2628
} else {
2729
null
2830
}
31+
}
2932
}

android/data/src/main/kotlin/com/simplecityapps/shuttle/model/Song.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.simplecityapps.shuttle.parcel.InstantParceler
55
import com.simplecityapps.shuttle.parcel.LocalDateParceler
66
import kotlinx.datetime.Instant
77
import kotlinx.datetime.LocalDate
8+
import kotlinx.parcelize.IgnoredOnParcel
89
import kotlinx.parcelize.Parcelize
910
import kotlinx.parcelize.TypeParceler
1011

@@ -40,7 +41,7 @@ data class Song(
4041
val bitRate: Int?,
4142
val bitDepth: Int?,
4243
val sampleRate: Int?,
43-
val channelCount: Int?
44+
val channelCount: Int?,
4445
) : Parcelable {
4546
val type: Type
4647
get() {
@@ -51,21 +52,25 @@ data class Song(
5152
}
5253
}
5354

54-
val albumArtistGroupKey: AlbumArtistGroupKey =
55+
@IgnoredOnParcel
56+
val albumArtistGroupKey: AlbumArtistGroupKey by lazy {
5557
AlbumArtistGroupKey(
5658
albumArtist?.lowercase()?.removeArticles()
5759
?: artists.joinToString(", ") { it.lowercase().removeArticles() }.ifEmpty { null }
5860
)
61+
}
5962

60-
val albumGroupKey = AlbumGroupKey(album?.lowercase()?.removeArticles(), albumArtistGroupKey)
63+
@IgnoredOnParcel
64+
val albumGroupKey by lazy { AlbumGroupKey(album?.lowercase()?.removeArticles(), albumArtistGroupKey) }
6165

6266
enum class Type {
6367
Audio,
6468
Audiobook,
6569
Podcast
6670
}
6771

68-
val friendlyArtistName: String? =
72+
@IgnoredOnParcel
73+
val friendlyArtistName: String? by lazy {
6974
if (artists.isNotEmpty()) {
7075
if (artists.size == 1) {
7176
artists.first()
@@ -78,4 +83,5 @@ data class Song(
7883
} else {
7984
null
8085
}
86+
}
8187
}

android/mediaprovider/emby/src/main/java/com/simplecityapps/provider/emby/EmbyMediaProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.simplecityapps.provider.emby.http.playlists
1919
import com.simplecityapps.shuttle.model.MediaProviderType
2020
import com.simplecityapps.shuttle.model.Playlist
2121
import com.simplecityapps.shuttle.model.Song
22+
import kotlinx.coroutines.ExperimentalCoroutinesApi
2223
import kotlin.math.min
2324
import kotlinx.coroutines.flow.Flow
2425
import kotlinx.coroutines.flow.asFlow
@@ -172,6 +173,7 @@ class EmbyMediaProvider(
172173
}
173174
}
174175

176+
@OptIn(ExperimentalCoroutinesApi::class)
175177
private fun findSongsForPlaylists(
176178
address: String,
177179
credentials: AuthenticatedCredentials,

android/mediaprovider/jellyfin/src/main/java/com/simplecityapps/provider/jellyfin/JellyfinMediaProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.simplecityapps.provider.jellyfin.http.playlists
1919
import com.simplecityapps.shuttle.model.MediaProviderType
2020
import com.simplecityapps.shuttle.model.Playlist
2121
import com.simplecityapps.shuttle.model.Song
22+
import kotlinx.coroutines.ExperimentalCoroutinesApi
2223
import kotlin.math.min
2324
import kotlinx.coroutines.flow.Flow
2425
import kotlinx.coroutines.flow.asFlow
@@ -172,6 +173,7 @@ class JellyfinMediaProvider(
172173
}
173174
}
174175

176+
@OptIn(ExperimentalCoroutinesApi::class)
175177
private fun findSongsForPlaylists(
176178
address: String,
177179
credentials: AuthenticatedCredentials,

0 commit comments

Comments
 (0)