Skip to content

Commit

Permalink
✨ :: [#1101] 터치영역 확장
Browse files Browse the repository at this point in the history
  • Loading branch information
KangTaeHoon committed Aug 13, 2024
1 parent 8ea145e commit 98d4314
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ final class LikeStorageViewController: BaseReactorViewController<LikeStorageReac
}

private func setTableView() {
likeStorageView.tableView.delegate = self
likeStorageView.tableView.rx.setDelegate(self).disposed(by: disposeBag)
}

override func bindState(reactor: LikeStorageReactor) {
Expand Down Expand Up @@ -199,6 +199,14 @@ final class LikeStorageViewController: BaseReactorViewController<LikeStorageReac
.map { Reactor.Action.itemMoved($0) }
.bind(to: reactor.action)
.disposed(by: disposeBag)

likeStorageView.tableView.rx.itemSelected
.withLatestFrom(reactor.state.map(\.dataSource)) { ($0, $1) }
.map { $0.1[$0.0.section].items[$0.0.row].songID }
.bind(with: self, onNext: { owner, songID in
owner.songDetailPresenter.present(id: songID)
})
.disposed(by: disposeBag)
}
}

Expand Down Expand Up @@ -258,8 +266,6 @@ extension LikeStorageViewController: LikeStorageTableViewCellDelegate {
self.reactor?.action.onNext(.songDidTap(indexPath.row))
case let .playTapped(song):
self.reactor?.action.onNext(.playDidTap(song: song))
case let .thumbnailTapped(song):
songDetailPresenter.present(id: song.songID)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public protocol LikeStorageTableViewCellDelegate: AnyObject {
public enum LikeStorageTableViewCellDelegateConstant {
case cellTapped(indexPath: IndexPath)
case playTapped(song: FavoriteSongEntity)
case thumbnailTapped(song: FavoriteSongEntity)
}

class LikeStorageTableViewCell: UITableViewCell {
Expand Down Expand Up @@ -152,18 +151,10 @@ private extension LikeStorageTableViewCell {
func setAction() {
self.cellSelectButton.addTarget(self, action: #selector(cellSelectButtonAction), for: .touchUpInside)
self.playButton.addTarget(self, action: #selector(playButtonAction), for: .touchUpInside)

let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(albumImageDidTapAction))
self.albumImageView.addGestureRecognizer(tapGestureRecognizer)
}
}

private extension LikeStorageTableViewCell {
@objc func albumImageDidTapAction() {
guard let model else { return }
delegate?.buttonTapped(type: .thumbnailTapped(song: model))
}

@objc func playButtonAction() {
guard let model else { return }
delegate?.buttonTapped(type: .playTapped(song: model))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ final class LikeStorageView: UIView {
func configureUI() {
backgroundColor = DesignSystemAsset.BlueGrayColor.blueGray100.color
tableView.refreshControl = refreshControl
tableView.verticalScrollIndicatorInsets = UIEdgeInsets(top: 0, left: 0, bottom: 56, right: 0)
tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 56, right: 0)
loginWarningView.isHidden = true
activityIndicator.isHidden = true
activityIndicator.stopAnimating()
Expand Down

0 comments on commit 98d4314

Please sign in to comment.