Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] MyPageView 수정사항 반영 #162

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
21 changes: 21 additions & 0 deletions Common/Resources/Asset.xcassets/LedyEmpty.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LedyEmpty.svg",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
14 changes: 14 additions & 0 deletions Common/Resources/Asset.xcassets/LedyEmpty.imageset/LedyEmpty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Common/Sources/Components/ViskitYellowButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// ViskitYellowButton.swift
// Common
//
// Created by 송여경 on 10/19/24.
// Copyright © 2024 com.recordy. All rights reserved.
//

import UIKit

public class ViskitYellowButton: UIButton {

public override init(frame: CGRect) {
super.init(frame: frame)
setUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setUI() {
backgroundColor = CommonAsset.viskitYellow400.color
layer.cornerRadius = 40
titleLabel?.font = ViskitFont.body2Bold.font
setTitleColor(.black, for: .normal)
clipsToBounds = true
}

public override func layoutSubviews() {
super.layoutSubviews()
layer.cornerRadius = bounds.height / 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2
height 쓰는 부분에 .adaptiveHeight 필요할 것 같습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 다른 height 부분에도 수정 필요해요

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public class ProfileViewController: UIViewController {
}

segmentControlView.snp.makeConstraints {
$0.top.equalTo(profileInfoView.snp.bottom).offset(35.adaptiveHeight)
$0.horizontalEdges.equalToSuperview()
$0.height.equalTo(40.adaptiveHeight)
$0.top.equalTo(profileInfoView.snp.bottom).offset(32)
$0.horizontalEdges.equalToSuperview().inset(20)
$0.height.equalTo(34)
}

myRecordView.snp.makeConstraints {
Expand All @@ -122,10 +122,10 @@ public class ProfileViewController: UIViewController {

private func setUserProfile() {
guard let user = user else { return }
let followerAttributedText = NSMutableAttributedString(string: "\(user.follower.count)", attributes: [.font: RecordyFont.body2.font])
let followerAttributedText = NSMutableAttributedString(string: "\(user.followerCount)", attributes: [.font: RecordyFont.body2.font])
followerAttributedText.append(NSAttributedString(string: " 명의 팔로워", attributes: [.font: RecordyFont.body2.font, .foregroundColor: CommonAsset.recordyGrey03.color]))
self.profileInfoView.followerButton.setAttributedTitle(followerAttributedText, for: .normal)
let followingAttributedText = NSMutableAttributedString(string: "\(user.following?.count ?? 0)", attributes: [.font: RecordyFont.body2.font])
let followingAttributedText = NSMutableAttributedString(string: "\(user.followingCount)", attributes: [.font: RecordyFont.body2.font])
followingAttributedText.append(NSAttributedString(string: " 명의 팔로잉", attributes: [.font: RecordyFont.body2.font, .foregroundColor: CommonAsset.recordyGrey03.color]))
self.profileInfoView.followingButton.setAttributedTitle(followingAttributedText, for: .normal)
self.profileInfoView.userName.text = user.nickname
Expand Down Expand Up @@ -192,10 +192,9 @@ public class ProfileViewController: UIViewController {
thumbnailLink: content.recordInfo.fileUrl.thumbnailUrl,
isMine: content.recordInfo.isMine)
}
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
self.myRecordView.getMyRecordList(feeds: feeds)
DispatchQueue.main.async {
self.user?.feeds = feeds
self.myRecordView.getMyRecordList(feeds: feeds)
self.setUserProfile()
}
case .failure(let failure):
Expand All @@ -207,16 +206,6 @@ public class ProfileViewController: UIViewController {
}
}

private func getPlaceFeature(from location: String) -> PlaceFeature {
if location.lowercased().contains("free") {
return .free
} else if location.lowercased().contains("closing soon") {
return .closingSoon
} else {
return .all
}
}

func getBookmarkedRecordList() {
let apiProvider = APIProvider<APITarget.Records>()
let request = DTO.GetBookmarkedListRequest(cursorId: 0, size: 100)
Expand All @@ -242,15 +231,25 @@ public class ProfileViewController: UIViewController {
isMine: false)
}
DispatchQueue.main.async {
self.bookmarkView.getBookmarkList(feeds: feeds)
self.user?.bookmarkedFeeds = feeds
self.bookmarkView.getBookmarkList(feeds: feeds)
}
case .failure(let failure):
print(failure)
}
}
}

private func getPlaceFeature(from location: String) -> PlaceFeature {
if location.lowercased().contains("free") {
return .free
} else if location.lowercased().contains("closing soon") {
return .closingSoon
} else {
return .all
}
}

@objc private func showFollowers() {
let followerViewController = FollowViewController(followType: .follower)
self.navigationController?.pushViewController(followerViewController, animated: true)
Expand Down
105 changes: 105 additions & 0 deletions Presentation/Sources/MyProfile/View/BookMarkEmptyView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//
// BookMarkEmptyView.swift
// Presentation
//
// Created by 송여경 on 10/19/24.
// Copyright © 2024 com.recordy. All rights reserved.
//
import UIKit
import SnapKit
import Then

import Common

class BookMarkEmptyView: UIView {
private let imageView = UIImageView()
private let titleLabel = UILabel()
private let goAroundButton = ViskitYellowButton()

private var actionButtonHandler: (() -> Void)?

override init(frame: CGRect) {
super.init(frame: frame)
setStyle()
setUI()
setAutoLayout()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setStyle() {
backgroundColor = .black

imageView.do {
$0.image = CommonAsset.ledyEmpty.image
$0.contentMode = .scaleAspectFit
}

titleLabel.do {
let text = "북마크한 영상이 없어요.\n영상을 둘러보고 저장해 보세요!"
$0.numberOfLines = 0
$0.textColor = CommonAsset.viskitGray02.color
$0.font = ViskitFont.title2.font

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 30 - $0.font.lineHeight
paragraphStyle.alignment = .center
Comment on lines +46 to +48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
UILabel+에 선언돼있는 lineSpacing 설정 함수를 사용하지 않은 이유가 있나요 ??


let attributedString = NSAttributedString(
string: text,
attributes: [
.paragraphStyle: paragraphStyle,
.font: ViskitFont.title2.font,
.foregroundColor: CommonAsset.viskitGray02.color
]
)
$0.attributedText = attributedString
$0.textAlignment = .center
}

goAroundButton.do {
$0.setTitle("영상 둘러보기", for: .normal)
}
}

private func setUI() {
[
imageView,
titleLabel,
goAroundButton
].forEach { addSubview($0) }
Comment on lines +68 to +72
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
addSubviews 써도 좋을 것 같아요!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 View / VIewController에도 수정 필요해요

}

private func setAutoLayout() {
imageView.snp.makeConstraints {
$0.top.equalToSuperview().offset(111)
$0.centerX.equalToSuperview()
$0.width.equalTo(110.adaptiveWidth)
$0.height.equalTo(97.adaptiveHeight)
}

titleLabel.snp.makeConstraints {
$0.top.equalTo(imageView.snp.bottom).offset(14)
$0.centerX.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(65)
}

goAroundButton.snp.makeConstraints {
$0.top.equalTo(titleLabel.snp.bottom).offset(24)
$0.centerX.equalToSuperview()
$0.width.equalTo(113.adaptiveWidth)
$0.height.equalTo(44.adaptiveHeight)
}
}

func setActionButtonHandler(_ handler: @escaping () -> Void) {
goAroundButton.addTarget(self, action: #selector(actionButtonTapped), for: .touchUpInside)
self.actionButtonHandler = handler
}

@objc private func actionButtonTapped() {
actionButtonHandler?()
}
Comment on lines +97 to +104
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
actionButtonTapped()애서 동작을 정의하지 않고, setActionButtonHandler()로 클로저를 통해 동작을 전달하는 이유가 있나요 ??

}
Loading