Skip to content

Commit

Permalink
Merge pull request #966 from DeluxeAlonso/feature/code-cleanup
Browse files Browse the repository at this point in the history
Feature/code cleanup
  • Loading branch information
DeluxeAlonso committed Aug 31, 2024
2 parents 16808b5 + cdb4c2c commit 5aea544
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ enum LocalizedStrings: String, Localizable {

case emptyMovieResults
case emptyVideoResults
case emptyCreditReults
case emptyCreditResults
case emptyReviewResults

case movieDetailTitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ protocol MovieCreditsViewModelProtocol {
var didToggleSection: AnyPublishBindable<Int> { get }
var startLoading: AnyBehaviorBindable<Bool> { get }

var emptyCreditResultsTitle: String { get }

func numberOfSections() -> Int
func numberOfItems(for section: Int) -> Int

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class MovieCreditsViewController: UIViewController, Storyboarded, Placehol
case .populated, .initial:
hideDisplayedPlaceholderView()
case .empty:
presentEmptyView(with: LocalizedStrings.emptyCreditReults())
presentEmptyView(with: viewModel?.emptyCreditResultsTitle)
case .error(let error):
presentRetryView(with: error.localizedDescription,
retryHandler: { [weak self] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ final class MovieCreditsViewModel: MovieCreditsViewModelProtocol {
let startLoading = BehaviorBindable(false).eraseToAnyBindable()
let didToggleSection = PublishBindable<Int>().eraseToAnyBindable()

// MARK: - Computed properties

var emptyCreditResultsTitle: String {
LocalizedStrings.emptyCreditResults()
}

// MARK: - Initializers

init(movieId: Int, movieTitle: String,
Expand Down
2 changes: 1 addition & 1 deletion UpcomingMovies/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

"emptyMovieResults" = "There are no movies to show right now.";
"emptyVideoResults" = "There are no trailers to show right now.";
"emptyCreditReults" = "No credits to show.";
"emptyCreditResults" = "No credits to show.";
"emptyReviewResults" = "There are no reviews to show right now.";

"movieDetailTitle" = "Movie detail";
Expand Down
2 changes: 1 addition & 1 deletion UpcomingMovies/es-419.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

"emptyMovieResults" = "No hay películas que mostrar.";
"emptyVideoResults" = "No hay trailers que mostrar.";
"emptyCreditReults" = "No hay créditos que mostrar.";
"emptyCreditResults" = "No hay créditos que mostrar.";
"emptyReviewResults" = "No hay reviews que mostrar.";

"movieDetailTitle" = "Detalle";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,11 @@ final class MovieCreditsViewModelTests: XCTestCase {
wait(for: [expectation], timeout: 1.0)
}

func testEmptyCreditResultsTitle() {
// Act
let emptyCreditResultsTitle = viewModelToTest.emptyCreditResultsTitle
// Assert
XCTAssertEqual(emptyCreditResultsTitle, "No credits to show.")
}

}

0 comments on commit 5aea544

Please sign in to comment.