Skip to content

Commit

Permalink
Merge pull request #767 from wakmusic/765-fix-playlist-detail-layout-…
Browse files Browse the repository at this point in the history
…mistake

🔀 :: (#765) 플레이리스트 디테일 디자인 검수
  • Loading branch information
yongbeomkwak authored Jul 12, 2024
2 parents 910e275 + efef4cf commit bd353fa
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import LogManager

enum PlaylistAnalyticsLog: AnalyticsLogType {
case viewPage(pageName: String)
case clickLockButton(id: String)
case clickPlaylistEditButton
case clickPlaylistShareButton
case clickPlaylistCameraButton
case clickPlaylistDefaultImageButton
case clickPlaylistCustomImageButton
case clickPlaylistImageButton(type: String)
case clickPlaylistPlayButton(type: String, key: String)
case clickPlaylistSubscriptionButton(key: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,22 @@ private extension MyPlaylistDetailReactor {
return $0.updateIsSelected(isSelected: false)
}

return .concat([
.just(.updateEditingState(false)),
.just(.updatePlaylist(updatingPlaylistItemModels)),
.just(.updateBackUpPlaylist(updatingPlaylistItemModels)),
.just(.updateSelectedCount(0)),
updatePlaylistUseCase.execute(key: key, songs: currentPlaylists.map { $0.id })
.andThen(.empty())
])
return updatePlaylistUseCase.execute(key: key, songs: currentPlaylists.map { $0.id })
.andThen(
.concat([
.just(.updateEditingState(false)),
.just(.updatePlaylist(updatingPlaylistItemModels)),
.just(.updateBackUpPlaylist(updatingPlaylistItemModels)),
.just(.updateSelectedCount(0)),

])
)
.catch { error in
let wmErorr = error.asWMError
return Observable.just(
Mutation.showToast(wmErorr.errorDescription ?? "알 수 없는 오류가 발생하였습니다.")
)
}
}

func endEditing() -> Observable<Mutation> {
Expand All @@ -250,12 +258,17 @@ private extension MyPlaylistDetailReactor {

let message: String = prev.private ? "리스트를 비공개 처리했습니다." : "리스트를 공개 처리했습니다."

return .concat([
.just(.updateHeader(prev)),
.just(.showToast(message)),
updateTitleAndPrivateUseCase.execute(key: key, title: nil, isPrivate: prev.private)
.andThen(.empty())
])
return updateTitleAndPrivateUseCase.execute(key: key, title: nil, isPrivate: prev.private)
.andThen(.concat([
.just(.updateHeader(prev)),
.just(.showToast(message)),
]))
.catch { error in
let wmErorr = error.asWMError
return Observable.just(
Mutation.showToast(wmErorr.errorDescription ?? "알 수 없는 오류가 발생하였습니다.")
)
}
}

func updateTitle(text: String) -> Observable<Mutation> {
Expand Down Expand Up @@ -365,17 +378,21 @@ private extension MyPlaylistDetailReactor {
var prevHeader = currentState.header
prevHeader.updateSongCount(remainSongs.count)

return .concat([
.just(.updatePlaylist(remainSongs)),
.just(.updateBackUpPlaylist(remainSongs)),
.just(.updateEditingState(false)),
.just(.updateSelectedCount(0)),
.just(.updateHeader(prevHeader)),
.just(.showToast("\(remainSongs.count)개의 곡을 삭제했습니다.")),
removeSongsUseCase.execute(key: key, songs: removeSongs)
.andThen(.never())

])
return removeSongsUseCase.execute(key: key, songs: removeSongs)
.andThen(.concat([
.just(.updatePlaylist(remainSongs)),
.just(.updateBackUpPlaylist(remainSongs)),
.just(.updateEditingState(false)),
.just(.updateSelectedCount(0)),
.just(.updateHeader(prevHeader)),
.just(.showToast("\(remainSongs.count)개의 곡을 삭제했습니다.")),
]))
.catch { error in
let wmErorr = error.asWMError
return Observable.just(
Mutation.showToast(wmErorr.errorDescription ?? "알 수 없는 오류가 발생하였습니다.")
)
}
}

func updateThumbnail(_ data: Data?) -> Observable<Mutation> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ final class MyPlaylistDetailViewController: BaseReactorViewController<MyPlaylist
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.interactivePopGestureRecognizer?.delegate = nil
LogManager.analytics(PlaylistAnalyticsLog.viewPage(pageName: "my_playlist_detail"))
LogManager.analytics(CommonAnalyticsLog.viewPage(pageName: .myPlaylistDetail))
}

override func viewDidDisappear(_ animated: Bool) {
Expand Down Expand Up @@ -501,17 +501,15 @@ extension MyPlaylistDetailViewController: SongCartViewDelegate {
text: "\(currentState.selectedCount)곡을 삭제하시겠습니까?",
cancelButtonIsHidden: false, confirmButtonText: "확인",
cancelButtonText: "취소",
completion: { [weak self] in

guard let self else { return }

self.reactor?.action.onNext(.removeSongs)
}, cancelCompletion: nil
completion: {
reactor.action.onNext(.removeSongs)
reactor.action.onNext(.forceEndEditing)
}, cancelCompletion: {
reactor.action.onNext(.forceEndEditing)
}
)

self.showBottomSheet(content: vc)

reactor.action.onNext(.forceEndEditing)
}
}
}
Expand Down Expand Up @@ -587,15 +585,15 @@ extension MyPlaylistDetailViewController: PHPickerViewControllerDelegate {
extension MyPlaylistDetailViewController: ThumbnailPopupDelegate {
func didTap(_ index: Int, _ cost: Int) {
if index == 0 {
LogManager.analytics(PlaylistAnalyticsLog.clickPlaylistDefaultImageButton)
LogManager.analytics(PlaylistAnalyticsLog.clickPlaylistImageButton(type: "default"))
let vc = defaultPlaylistImageFactory.makeView(self)
vc.modalPresentationStyle = .overFullScreen

self.present(vc, animated: true)

} else {
LogManager.analytics(
PlaylistAnalyticsLog.clickPlaylistCustomImageButton
PlaylistAnalyticsLog.clickPlaylistImageButton(type: "custom")
)
requestPhotoLibraryPermission()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class UnknownPlaylistDetailViewController: BaseReactorViewController<Unkno
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.interactivePopGestureRecognizer?.delegate = nil
LogManager.analytics(PlaylistAnalyticsLog.viewPage(pageName: "unkwown_playlist_detail"))
LogManager.analytics(CommonAnalyticsLog.viewPage(pageName: .unknownPlaylistDetail))
}

override func viewDidDisappear(_ animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class WakmusicPlaylistDetailViewController: BaseReactorViewController<Wakm
super.viewDidAppear(animated)
navigationController?.interactivePopGestureRecognizer?.delegate = nil
LogManager
.analytics(PlaylistAnalyticsLog.viewPage(pageName: "wakmusic_playlist_detail"))
.analytics(CommonAnalyticsLog.viewPage(pageName: .wakmusicPlaylistDetail))
}

override func viewDidDisappear(_ animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,20 @@ final class MyPlaylistHeaderView: UIView {
$0.clipsToBounds = true
}

private var titleLabel: WMLabel = WMLabel(
private let titleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color,
font: .t3(weight: .bold)
font: .t3(weight: .bold),
lineHeight: UIFont.WMFontSystem.t3(weight: .bold).lineHeight
).then {
$0.numberOfLines = 0
}

let countLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color.withAlphaComponent(0.6),
font: .t6_1(weight: .light)
font: .t6_1(weight: .light),
lineHeight: UIFont.WMFontSystem.t6_1(weight: .light).lineHeight
)

let editNickNameButton: UIButton = UIButton().then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class PlaylistDateTableViewCell: UITableViewCell {
text: "날짜",
textColor: DesignSystemAsset.BlueGrayColor.gray900.color,
font: .t7(weight: .score3Light),
alignment: .left,
alignment: .right,
lineHeight: UIFont.WMFontSystem.t7().lineHeight,
kernValue: -0.5
).then {
Expand Down Expand Up @@ -88,7 +88,7 @@ final class PlaylistDateTableViewCell: UITableViewCell {
}

dateLabel.snp.makeConstraints {
$0.width.equalTo(70)
$0.width.lessThanOrEqualTo(66)
$0.centerY.equalToSuperview()
$0.trailing.equalToSuperview().inset(20)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ final class UnknownPlaylistHeaderView: UIView {
$0.clipsToBounds = true
}

private var titleLabel: WMLabel = WMLabel(
private let titleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color,
font: .t3(weight: .bold)
font: .t3(weight: .bold),
lineHeight: UIFont.WMFontSystem.t3(weight: .bold).lineHeight
).then {
$0.numberOfLines = 0
}

let subtitleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color.withAlphaComponent(0.6),
font: .t6_1(weight: .light)
font: .t6_1(weight: .light),
lineHeight: UIFont.WMFontSystem.t6_1(weight: .light).lineHeight
)

override init(frame: CGRect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ final class WakmusicPlaylistHeaderView: UIView {
$0.clipsToBounds = true
}

private var titleLabel: WMLabel = WMLabel(
private let titleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color,
font: .t3(weight: .bold)
font: .t3(weight: .bold),
lineHeight: UIFont.WMFontSystem.t3(weight: .bold).lineHeight
).then {
$0.numberOfLines = 0
}

let subtitleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color.withAlphaComponent(0.6),
font: .t6_1(weight: .light)
font: .t6_1(weight: .light),
lineHeight: UIFont.WMFontSystem.t6_1(weight: .light).lineHeight
)

override init(frame: CGRect) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import LogManager

enum SearchAnalyticsLog: AnalyticsLogType {
case viewPage(pageName: String)

case clickPlaylistItem(location: String)

/// 검색 전:
case clickRecommendPlaylistMore
case clickLatestWakmuYoutubeVideo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,24 @@ extension ListResultCell {

private func setLayout() {
thumbnailView.snp.makeConstraints {
$0.width.equalTo(40)
$0.height.equalTo(40)
$0.width.height.equalTo(40)
$0.top.bottom.equalToSuperview().inset(10)
$0.leading.equalToSuperview().inset(20)
}

titleLabel.snp.makeConstraints {
$0.height.equalTo(22)
$0.top.equalTo(thumbnailView.snp.top).offset(-1)
$0.leading.equalTo(thumbnailView.snp.trailing).offset(8)
}

creatorLabel.snp.makeConstraints {
$0.height.equalTo(18)
$0.top.equalTo(titleLabel.snp.bottom).offset(2)
$0.leading.equalTo(titleLabel.snp.leading)
$0.trailing.equalTo(titleLabel.snp.trailing)
$0.bottom.equalTo(thumbnailView.snp.bottom)
}

sharedCountLabel.snp.makeConstraints {
$0.height.equalTo(18)
$0.width.lessThanOrEqualTo(66)
$0.centerY.equalTo(thumbnailView.snp.centerY)
$0.trailing.equalToSuperview().inset(20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,18 @@ extension SongResultCell {
}

titleLabel.snp.makeConstraints {
$0.height.equalTo(22)
$0.top.equalTo(thumbnailView.snp.top)
$0.leading.equalTo(thumbnailView.snp.trailing).offset(8)
}

artistLabel.snp.makeConstraints {
$0.height.equalTo(18)
$0.top.equalTo(titleLabel.snp.bottom).offset(2)
$0.leading.equalTo(titleLabel.snp.leading)
$0.trailing.equalTo(titleLabel.snp.trailing)
$0.bottom.equalTo(thumbnailView.snp.bottom)
}

dateLabel.snp.makeConstraints {
$0.height.equalTo(18)
$0.width.lessThanOrEqualTo(66)
$0.centerY.equalTo(thumbnailView.snp.centerY)
$0.trailing.equalToSuperview().inset(20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class BeforeSearchContentViewController: BaseReactorViewController<BeforeS

override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
LogManager.analytics(SearchAnalyticsLog.viewPage(pageName: "search"))
LogManager.analytics(CommonAnalyticsLog.viewPage(pageName: .search))
}

override public func addView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ extension ListSearchResultViewController: UICollectionViewDelegate {
let id = PreferenceManager.userInfo?.decryptedID ?? ""
let isMine = model.ownerId == id

LogManager.analytics(SearchAnalyticsLog.clickPlaylistItem(location: "search"))
LogManager.analytics(CommonAnalyticsLog.clickPlaylistItem(location: .search))
navigatePlaylistDetail(key: model.key, kind: isMine ? .my : .unknown)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class WakmusicRecommendViewController: BaseReactorViewController<WakmusicR
self.view.backgroundColor = DesignSystemAsset.BlueGrayColor.gray100.color
reactor?.action.onNext(.viewDidLoad)

LogManager.analytics(SearchAnalyticsLog.viewPage(pageName: "wakmusic_recommend_playlist"))
LogManager.analytics(CommonAnalyticsLog.viewPage(pageName: .wakmusicRecommendPlaylist))
}

override public func viewDidAppear(_ animated: Bool) {
Expand Down
4 changes: 4 additions & 0 deletions Projects/Modules/LogManager/Sources/CommonAnalyticsLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public extension CommonAnalyticsLog {
case musicDetail = "music_detail"
case musicLyrics = "music_lyrics"
case recentMusic = "recent_music"
case wakmusicRecommendPlaylist = "wakmusic_recommend_playlist"
case wakmusicPlaylistDetail = "wakmusic_playlist_detail"
case unknownPlaylistDetail = "unknown_playlist_detail"
case myPlaylistDetail = "my_playlist_detail"
case chart
case artist
case storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public extension UILabel {
lineSpacing: CGFloat? = nil,
lineHeightMultiple: CGFloat? = nil,
alignment: NSTextAlignment = .left
) {
guard let labelText = self.text else { return }

) -> [NSAttributedString.Key: Any] {
let paragraphStyle = NSMutableParagraphStyle()

if let lineSpacing { paragraphStyle.lineSpacing = lineSpacing }
Expand All @@ -94,8 +92,6 @@ public extension UILabel {
.baselineOffset: baselineOffset
]

let attributedString = NSMutableAttributedString(string: labelText, attributes: attributes)

self.attributedText = attributedString
return attributes
}
}
Loading

0 comments on commit bd353fa

Please sign in to comment.