Skip to content

Commit

Permalink
Merge pull request #656 from wakmusic/655-feature-artist-empty-data
Browse files Browse the repository at this point in the history
๐Ÿ”€ :: (#655) ์•„ํ‹ฐ์ŠคํŠธ ์ƒ์„ธ ๋นˆ ๋ฐ์ดํ„ฐ UI ์ฒ˜๋ฆฌ
  • Loading branch information
KangTaeHoon authored Jun 23, 2024
2 parents a7cbd98 + f4f54f0 commit 2774a01
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ArtistDomainInterface
import BaseFeature
import BaseFeatureInterface
import DesignSystem
import LogManager
import NVActivityIndicatorView
import RxCocoa
import RxSwift
Expand Down Expand Up @@ -50,8 +51,8 @@ public class ArtistMusicContentViewController: BaseViewController, ViewControlle
}
}

extension ArtistMusicContentViewController {
private func inputBind() {
private extension ArtistMusicContentViewController {
func inputBind() {
tableView.rx
.setDelegate(self)
.disposed(by: disposeBag)
Expand Down Expand Up @@ -79,27 +80,34 @@ extension ArtistMusicContentViewController {
.disposed(by: disposeBag)
}

private func outputBind() {
func outputBind() {
output.dataSource
.skip(1)
.withLatestFrom(output.indexOfSelectedSongs) { ($0, $1) }
.do(onNext: { [weak self] dataSource, songs in
guard let `self` = self else { return }
guard let self = self else { return }
let height = self.tableView.frame.height / 3 * 2
let warningView = WarningView(frame: CGRect(x: 0, y: 0, width: APP_WIDTH(), height: height))
warningView.text = "์•„ํ‹ฐ์ŠคํŠธ ๊ณก์ด ์—†์Šต๋‹ˆ๋‹ค."
self.tableView.tableFooterView = dataSource.isEmpty ?
warningView : UIView(frame: CGRect(x: 0, y: 0, width: APP_WIDTH(), height: PLAYER_HEIGHT()))
self.activityIndidator.stopAnimating()

guard let songCart = self.songCartView else { return }
songCart.updateAllSelect(isAll: songs.count == dataSource.count)
})
.map { $0.0 }
.bind(to: tableView.rx.items) { tableView, index, model -> UITableViewCell in
let indexPath: IndexPath = IndexPath(row: index, section: 0)
guard let cell = tableView
.dequeueReusableCell(withIdentifier: "ArtistMusicCell", for: indexPath) as? ArtistMusicCell else {
guard let cell = tableView.dequeueReusableCell(
withIdentifier: "ArtistMusicCell",
for: indexPath
) as? ArtistMusicCell else {
return UITableViewCell()
}
cell.update(model: model)
return cell
}.disposed(by: disposeBag)
}
.disposed(by: disposeBag)

output.indexOfSelectedSongs
.skip(1)
Expand All @@ -122,13 +130,11 @@ extension ArtistMusicContentViewController {
}).disposed(by: disposeBag)
}

private func configureUI() {
self.activityIndidator.color = DesignSystemAsset.PrimaryColor.point.color
self.activityIndidator.type = .circleStrokeSpin
self.activityIndidator.startAnimating()
self.tableView.backgroundColor = .clear
self.tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: APP_WIDTH(), height: PLAYER_HEIGHT()))
self.tableView.verticalScrollIndicatorInsets = UIEdgeInsets(top: 0, left: 0, bottom: PLAYER_HEIGHT(), right: 0)
func configureUI() {
activityIndidator.color = DesignSystemAsset.PrimaryColor.point.color
activityIndidator.type = .circleStrokeSpin
activityIndidator.startAnimating()
tableView.backgroundColor = .clear
}
}

Expand Down Expand Up @@ -166,13 +172,13 @@ extension ArtistMusicContentViewController: UITableViewDelegate {
}

public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 80
return output.dataSource.value.isEmpty ? 0 : 80
}

public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = ArtistPlayButtonGroupView(frame: CGRect(x: 0, y: 0, width: APP_WIDTH(), height: 80))
view.delegate = self
return view
return output.dataSource.value.isEmpty ? nil : view
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public final class ArtistViewController:

extension ArtistViewController {
private func configureUI() {
self.view.backgroundColor = DesignSystemAsset.GrayColor.gray100.color
view.backgroundColor = DesignSystemAsset.BlueGrayColor.gray100.color
activityIndicator.color = DesignSystemAsset.PrimaryColor.point.color
activityIndicator.type = .circleStrokeSpin
activityIndicator.startAnimating()
Expand All @@ -108,8 +108,8 @@ extension ArtistViewController {
layout.headerHeight = 0
layout.footerHeight = 56.0

self.collectionView.setCollectionViewLayout(layout, animated: false)
self.collectionView.showsVerticalScrollIndicator = false
collectionView.setCollectionViewLayout(layout, animated: false)
collectionView.showsVerticalScrollIndicator = false
}
}

Expand Down

0 comments on commit 2774a01

Please sign in to comment.