Skip to content

Commit

Permalink
Merge pull request #115 from imashnake0/empty-trailer
Browse files Browse the repository at this point in the history
Hide trailer when null
  • Loading branch information
imashnake0 authored Jan 3, 2024
2 parents acb5b88 + 27c9f65 commit be9d9c4
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data class Media(
/** @see MediaQuery.Media.characters */
val characters: List<Character>,
/** @see MediaQuery.Media.trailer */
val trailer: Trailer
val trailer: Trailer?
) {
data class Ranking(
/** @see MediaQuery.Ranking.rank */
Expand Down Expand Up @@ -96,12 +96,14 @@ data class Media(
)
}
},
trailer = Trailer(
url = if(query.trailer?.site == null || query.trailer.id == null) {
null
} else "${Trailer.Site.valueOf(query.trailer.site.uppercase()).baseUrl}${query.trailer.id}",
thumbnail = query.trailer?.thumbnail
)
trailer = if(query.trailer?.site == null || query.trailer.id == null) {
null
} else {
Trailer(
url = "${Trailer.Site.valueOf(query.trailer.site.uppercase()).baseUrl}${query.trailer.id}",
thumbnail = query.trailer.thumbnail
)
}
)

data class Medium(
Expand Down

0 comments on commit be9d9c4

Please sign in to comment.