-
Notifications
You must be signed in to change notification settings - Fork 2
Added VideoClipEntity and TvShowEntity #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
episodeNumber = entity.episodeNumber, | ||
) | ||
is VideoClipEntity -> entity.name | ||
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the else
to is TvShowEntity
instead.
|
||
is VideoClipEntity -> null | ||
|
||
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the else
to is TvShowEntity
instead.
val genre: String, | ||
val seasonCount: Integer, | ||
val duration: Duration, | ||
var nextTvShowEntity: TvShowEntity?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this as a TvShowEntity
doesn't have a next show.
val platformSpecificUris: PlatformSpecificUris, | ||
val releaseYear: Int, | ||
val genre: String, | ||
val seasonCount: Integer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the season count for now. When we want to make use of seasons, we can create a new entity called TvSeasonEntity
and then add a new field to the TvShowEntity
called val seasons: List<TvSeasonEntity>
. Then, we can create a getter which returns the seasonCount
.
data class TvShowEntity(
...
) {
val seasonCount = seasons.size()
}
This way, we will avoid having fragmented state and it will help us prevent out-of-sync issues.
val duration: Duration | ||
val name: String | ||
val playbackUris: PlatformSpecificUris | ||
val images: List<Image> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can keep the images
field as well in the VideoEntity
interface as all video entities will have images.
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity") | ||
} | ||
val duration: Duration | ||
get() = when (entity) { | ||
is MovieEntity -> entity.duration | ||
is TvEpisodeEntity -> entity.duration | ||
is VideoClipEntity -> entity.duration | ||
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity") | ||
} | ||
|
||
val genre: String | ||
get() = when (entity) { | ||
is MovieEntity -> entity.genre | ||
is TvEpisodeEntity -> entity.genre | ||
is VideoClipEntity -> entity.genre | ||
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the else
to is TvShowEntity
instead.
The benefit is that when we add a new entity type in future, we will be warned by compiler that we need to update this place. If we use the generic else
, we might forget to update some place and the app will crash at runtime.
is MovieEntity -> entity.convertToEngageMovieEntity(this) | ||
is TvEpisodeEntity -> entity.convertToEngageTvEpisodeEntity(this) | ||
is VideoClipEntity -> entity.convertToEngageVideoClipEntity(this) | ||
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the else
to is TvShowEntity
instead.
Key Changes:
New Entity Types:
Continue Watching:
Engage SDK Integration
UI Updates: