Skip to content

Commit

Permalink
Merge pull request #11 from alhafram/master
Browse files Browse the repository at this point in the history
Fix cell selected bug
  • Loading branch information
akarataev committed Nov 10, 2018
2 parents 1a05178 + 9a2cb94 commit 8866631
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Gleam/Modules/ClinicList/Presenter/ClinicListPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ class ClinicListPresenter {
extension ClinicListPresenter: LocationManagerDelegate {

func locationManagerDidChangeRequestStatus(_ locationManager: LocationManager, enable: Bool) {
if !enable {
interactor.loadClinics()
}
interactor.loadClinics()
}

func locationManagerDidChangeCoordinates(_ locationManager: LocationManager) {
Expand Down
13 changes: 12 additions & 1 deletion Gleam/Modules/ClinicList/View/ClinicTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ class ClinicTableViewCell: UITableViewCell, CollectionSetupable {
private lazy var stackView = createStackView()
private lazy var separatorView = createSeparatorView()

private var model: ClinicModel!

private var viewModel: ClinicViewModel {
return ClinicViewModel(model: model)
}

func setup(with model: ClinicModel) {
let viewModel = ClinicViewModel(model: model)
self.model = model
_ = separatorView
clinicTitleLabel.text = viewModel.title
clinicTypeLabel.text = viewModel.type
Expand All @@ -32,6 +38,11 @@ class ClinicTableViewCell: UITableViewCell, CollectionSetupable {
clinicOpenStatusView.backgroundColor = viewModel.statusColor
clinicRateView.value = viewModel.rating
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
clinicOpenStatusView.backgroundColor = viewModel.statusColor
}
}

private extension ClinicTableViewCell {
Expand Down

0 comments on commit 8866631

Please sign in to comment.