Skip to content

Commit

Permalink
✨ :: [#914] 누락사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
KangTaeHoon committed Jul 30, 2024
1 parent 8836d84 commit 7b62fbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public final class HomeViewController: BaseViewController, ViewControllerFromSto
private var playlistDetailFactory: PlaylistDetailFactory!
private var newSongsComponent: NewSongsComponent!
private var musicDetailFactory: (any MusicDetailFactory)!
var recommendViewHeightConstraint: NSLayoutConstraint?
private var recommendViewHeightConstraint: NSLayoutConstraint?

var viewModel: HomeViewModel!
private var viewModel: HomeViewModel!
private lazy var input = HomeViewModel.Input()
private lazy var output = viewModel.transform(from: input)
var disposeBag = DisposeBag()
private let disposeBag = DisposeBag()

override public func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -123,12 +123,11 @@ extension HomeViewController {
.disposed(by: disposeBag)

latestSongsMoveButton.rx.tap
.withUnretained(self)
.subscribe(onNext: { owner, _ in
.bind(with: self) { owner, _ in
LogManager.analytics(HomeAnalyticsLog.clickRecentMusicsTitleButton)
let viewController = owner.newSongsComponent.makeView()
owner.navigationController?.pushViewController(viewController, animated: true)
})
}
.disposed(by: disposeBag)

latestSongsPlayButton.rx.tap
Expand Down Expand Up @@ -305,7 +304,7 @@ extension HomeViewController {
chartTitleLabel.attributedText = mainTitleLabelAttributedString

let mainTitleAllButtonAttributedString = NSMutableAttributedString(
string: "전체듣기",
string: "전체보기",
attributes: [
.font: DesignSystemFontFamily.Pretendard.medium.font(size: 14),
.foregroundColor: DesignSystemAsset.BlueGrayColor.gray25.color,
Expand All @@ -327,7 +326,7 @@ extension HomeViewController {
latestArrowImageView.image = DesignSystemAsset.Home.homeArrowRight.image

let latestSongPlayAttributedString = NSMutableAttributedString(
string: "전체듣기",
string: "전체보기",
attributes: [
.font: DesignSystemFontFamily.Pretendard.medium.font(size: 14),
.foregroundColor: DesignSystemAsset.BlueGrayColor.gray900.color.withAlphaComponent(0.6),
Expand Down Expand Up @@ -433,9 +432,8 @@ extension HomeViewController: HomeNewSongCellDelegate {
extension HomeViewController: RecommendPlayListViewDelegate {
public func itemSelected(model: RecommendPlaylistEntity) {
LogManager.analytics(CommonAnalyticsLog.clickPlaylistItem(location: .home))
#warning("변경된 플레이리슽 디테일 진입 방법으로 리팩")
// let playListDetailVc = playlistDetailFactory.makeView(id: model.key, isCustom: false)
// self.navigationController?.pushViewController(playListDetailVc, animated: true)
let viewController = playlistDetailFactory.makeView(key: model.key, kind: .wakmu)
self.navigationController?.pushViewController(viewController, animated: true)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public final class HomeViewModel: ViewModelType {

public struct Input {
let fetchHomeUseCase: PublishSubject<Void> = PublishSubject()
@available(*, deprecated, message: "스펙 변경에 따라 all listen 제거")
let chartAllListenTapped: PublishSubject<Void> = PublishSubject()
@available(*, deprecated, message: "스펙 변경에 따라 all listen 제거")
let newSongsAllListenTapped: PublishSubject<Void> = PublishSubject()
let refreshPulled: PublishSubject<Void> = PublishSubject()
}

Expand Down Expand Up @@ -81,39 +77,6 @@ public final class HomeViewModel: ViewModelType {
})
.disposed(by: disposeBag)

input.chartAllListenTapped
.withLatestFrom(output.chartDataSource)
.subscribe(onNext: { songs in
let songEntities: [SongEntity] = songs.map {
return SongEntity(
id: $0.id,
title: $0.title,
artist: $0.artist,
views: $0.views,
date: $0.date
)
}
LogManager.analytics(HomeAnalyticsLog.clickAllChartTop100MusicsButton)
PlayState.shared.loadAndAppendSongsToPlaylist(songEntities)
})
.disposed(by: disposeBag)

input.newSongsAllListenTapped
.withLatestFrom(output.newSongDataSource)
.subscribe(onNext: { newSongs in
let songEntities: [SongEntity] = newSongs.map {
return SongEntity(
id: $0.id,
title: $0.title,
artist: $0.artist,
views: $0.views,
date: "\($0.date)"
)
}
PlayState.shared.loadAndAppendSongsToPlaylist(songEntities)
})
.disposed(by: disposeBag)

input.refreshPulled
.flatMap { _ -> HomeUseCase in
return homeSceneUseCase
Expand Down

0 comments on commit 7b62fbe

Please sign in to comment.