moallemi / Film-Time

A Movie and TV shows tracking app illustrating Android development best practices with Jetpack Compose
MIT License
48 stars 10 forks source link

[FR]: Search movie by keyword #64

Open hadi-norouzi opened 1 month ago

hadi-norouzi commented 1 month ago

Is there an existing issue for this?

Related app

All - Android

Describe the problem

As a user, I want to have a search functionality in the movies section or somewhere in the app.

Describe the solution

No response

Additional context

No response

Code of Conduct

moallemi commented 1 month ago

I would suggest adding only one screen for search and display all search results in one place (for now: Movies and shows. Later we can display actors and episodes as well)

hadi-norouzi commented 1 month ago

I would suggest adding only one screen for search and display all search results in one place (for now: Movies and shows. Later we can display actors and episodes as well)

So do you think I should add a tab in home?

moallemi commented 1 month ago

Yes, That would be great. And what do you think of this sketch?

IMG_2414

hadi-norouzi commented 1 month ago

Yes, That would be great. And what do you think of this sketch?

IMG_2414

It is great. I will do it.

hadi-norouzi commented 1 month ago

Yes, That would be great. And what do you think of this sketch?

IMG_2414

Hi Mr. @moallemi. TMDB has three API for search, movie, tv shows and multi search. In multi search API it gives me dynamic list of movie or show or person (actor). what would you suggest to parse these dynamic data? it must be handled in API layer or datasource layer? It's better to have another response parser for it or just return Any type and handle this mapping inside datasource?

moallemi commented 1 month ago

Dear @hadi-norouzi,

I'd suggest adding a separate search everywhere:

  1. In :data:api:tmdb -> TmdbSearchService
  2. In :data:model, define new data type
    sealed class SearchResult {
    data class Video(val item videoThumbnail: VideoThumbnail)
    // later we can add other search result types
    // data class Actor(val item actor) 
    }
  3. Then new :data:tmdb-search module, in here we return list of a new model called so we need a new mapper to map the tmdb search result to our custom SearchResult data type then we will have:
    interface TmdbSearchRepository {
    fun searchStream(query: String): Flow<PagingData<SearchResult>>
    }
  4. Then new :domain:tmdb-search in domain and so on

Let me know if you have any questions.