Skip to content

Commit

Permalink
Merge pull request #108 from vighnesh153/samples-update
Browse files Browse the repository at this point in the history
refactor: combine multiple sources of same content into single file
  • Loading branch information
pflammertsma committed May 12, 2023
2 parents 96a7da4 + 74aa262 commit 59b146e
Show file tree
Hide file tree
Showing 9 changed files with 512 additions and 2,720 deletions.
691 changes: 0 additions & 691 deletions JetStreamCompose/jetstream/src/main/assets/mostPopularMovies.json

This file was deleted.

691 changes: 0 additions & 691 deletions JetStreamCompose/jetstream/src/main/assets/mostPopularTVShows.json

This file was deleted.

Large diffs are not rendered by default.

638 changes: 0 additions & 638 deletions JetStreamCompose/jetstream/src/main/assets/top250movies.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,45 @@ package com.google.jetstream.data.models

import com.google.gson.annotations.SerializedName

class InTheatersResponse : ArrayList<InTheatersResponse.InTheatersResponseItem>() {
data class InTheatersResponseItem(
@SerializedName("contentRating")
val contentRating: String,
@SerializedName("directors")
val directors: String,
@SerializedName("fullTitle")
val fullTitle: String,
@SerializedName("genres")
val genres: String,
class MoviesResponse : ArrayList<MoviesResponse.MoviesResponseItem>() {
data class MoviesResponseItem(
@SerializedName("id")
val id: String,
@SerializedName("rating")
val rating: String,
@SerializedName("ratingCount")
val ratingCount: String,
@SerializedName("rank")
val rank: String,
@SerializedName("rankUpDown")
val rankUpDown: String,
@SerializedName("title")
val title: String,
@SerializedName("fullTitle")
val fullTitle: String,
@SerializedName("year")
val year: String,
@SerializedName("releaseDate")
val releaseDate: String,
@SerializedName("image_16_9")
val image_16_9: String,
@SerializedName("image_2_3")
val image_2_3: String,
@SerializedName("metacriticRating")
val metacriticRating: String,
@SerializedName("plot")
val plot: String,
@SerializedName("releaseState")
val releaseState: String,
@SerializedName("runtimeMins")
val runtimeMins: String,
@SerializedName("runtimeStr")
val runtimeStr: String,
@SerializedName("plot")
val plot: String,
@SerializedName("contentRating")
val contentRating: String,
@SerializedName("rating")
val rating: String,
@SerializedName("ratingCount")
val ratingCount: String,
@SerializedName("metaCriticRating")
val metaCriticRating: String,
@SerializedName("genres")
val genres: String,
@SerializedName("directors")
val directors: String,
@SerializedName("stars")
val stars: String,
@SerializedName("title")
val title: String,
@SerializedName("year")
val year: String
) {
data class Director(
@SerializedName("id")
val id: String,
@SerializedName("name")
val name: String
)

data class Genre(
@SerializedName("key")
val key: String,
@SerializedName("value")
val value: String
)

data class Star(
@SerializedName("id")
val id: String,
@SerializedName("name")
val name: String
)
}
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import com.google.jetstream.data.entities.MovieCategory
import com.google.jetstream.data.entities.MovieCategoryDetails
import com.google.jetstream.data.entities.MovieDetails
import com.google.jetstream.data.entities.MovieReviewsAndRatings
import com.google.jetstream.data.models.InTheatersResponse
import com.google.jetstream.data.models.MovieCastResponse
import com.google.jetstream.data.models.MovieCategoriesResponse
import com.google.jetstream.data.models.Top250MoviesResponse
import com.google.jetstream.data.models.MoviesResponse
import com.google.jetstream.data.util.AssetsReader
import com.google.jetstream.data.util.StringConstants
import com.google.jetstream.data.util.StringConstants.Movie.Reviewer.DefaultCount
Expand All @@ -35,19 +34,19 @@ import com.google.jetstream.data.util.StringConstants.Movie.Reviewer.ReviewerNam

class MovieRepositoryImpl(val assetsReader: AssetsReader) : MovieRepository {
private val _top250Movies = assetsReader
.readJsonFile<Top250MoviesResponse>(fileName = StringConstants.Assets.Top250Movies)
.readJsonFile<MoviesResponse>(fileName = StringConstants.Assets.Top250Movies)
?: emptyList()

private val _mostPopularMovies = assetsReader
.readJsonFile<Top250MoviesResponse>(fileName = StringConstants.Assets.MostPopularMovies)
.readJsonFile<MoviesResponse>(fileName = StringConstants.Assets.MostPopularMovies)
?: emptyList()

private val _inTheatersMovies = assetsReader
.readJsonFile<InTheatersResponse>(fileName = StringConstants.Assets.InTheaters)
.readJsonFile<MoviesResponse>(fileName = StringConstants.Assets.InTheaters)
?: emptyList()

private val _mostPopularTVShows = assetsReader
.readJsonFile<Top250MoviesResponse>(fileName = StringConstants.Assets.MostPopularTVShows)
.readJsonFile<MoviesResponse>(fileName = StringConstants.Assets.MostPopularTVShows)
?: emptyList()

private val _movieCategories = assetsReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ object StringConstants {
}

object Assets {
const val Top250Movies = "top250movies.json"
const val MostPopularMovies = "mostPopularMovies.json"
const val InTheaters = "inTheaters.json"
const val MostPopularTVShows = "mostPopularTVShows.json"
const val Top250Movies = "movies.json"
const val MostPopularMovies = "movies.json"
const val InTheaters = "movies.json"
const val MostPopularTVShows = "movies.json"
const val MovieCategories = "movieCategories.json"
const val MovieCast = "movieCast.json"
}
Expand Down

0 comments on commit 59b146e

Please sign in to comment.