Skip to content
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

task 12008+09+10: Search Movie Screen: Create UI + Handle Event + Fetch API #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vanpd-0859
Copy link

Issue Link 🔗

https://edu-redmine.sun-asterisk.vn/issues/12007

Goals ⚽

----Create UI:
https://marvelapp.com/be90ba4/screen/56474035

  • Search bar
  • Genre list collection view: genre button
  • Movie list tableview: date, title, banner, rating, etc..
    ----Handle Event:
  • Type movie name on search bar and enter to search movie by name
  • Select genre button to filter movie by genre
  • Select a movie on Movie list to go to Movie Detail Screen
  • Scroll down to bottom to load more
    Fetch data and display to UI:
  • Get movie list by keyword and filter by genre

Implementation Details 🚧

https://gfycat.com/FeistySadCrocodile

@vanpd-0859
Copy link
Author

ready

@@ -121,6 +121,12 @@ final class MovieDetailViewController: UIViewController, AlertViewController, Bi
output.error
.drive(errorBinding)
.disposed(by: disposeBag)
Observable.of(output.titleMovie.mapToVoid().asObservable(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xử lý trong viewmodel

let movieRepository: MovieRepository
let genreRepository: GenreReponsitory

func searchMovie(query: String, page: Int) -> Observable<([Movie], Int)> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Khai báo class với generic và page chứ k truyền tuple thế này

Copy link
Author

@vanpd-0859 vanpd-0859 May 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Khai báo class với generic và page chứ k truyền tuple thế này

Em chưa hiểu lắm, anh có thể lấy ví dụ được không?

})
let selectMovie = input.movieSelectTrigger
.withLatestFrom(movies.asDriver()) { indexPath, movies in
return (movies[indexPath.row], indexPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (movies[indexPath.row], indexPath)
return ($1[$0.row], $0)

return self.selectedGenres
.asDriver()
.map { genres in
return genres.filter { $0.selected }.map { $0.id }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return genres.filter { $0.selected }.map { $0.id }
return genres.filter { $0.selected }
.map { $0.id }

.mapToVoid()
let paging = input.pageTrigger
.withLatestFrom(isSearching.asDriver(onErrorJustReturn: false)) { page, isSearching in
return (page, isSearching)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (page, isSearching)
return ($0, $1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants