diff --git a/SOPT-iOS/Projects/Core/Sources/Extension/UIKit+/UILabel+.swift b/SOPT-iOS/Projects/Core/Sources/Extension/UIKit+/UILabel+.swift index 7cd4e499..6f013940 100644 --- a/SOPT-iOS/Projects/Core/Sources/Extension/UIKit+/UILabel+.swift +++ b/SOPT-iOS/Projects/Core/Sources/Extension/UIKit+/UILabel+.swift @@ -8,10 +8,20 @@ import UIKit public extension UILabel { - + /// 행간 조정 메서드 func setLineSpacing(lineSpacing: CGFloat) { - // 기존에 attributedText가 존재할 경우, 덮어쓰지 않고 그대로 유지 + if let text = self.text { + let attributedStr = NSMutableAttributedString(string: text) + let style = NSMutableParagraphStyle() + style.lineSpacing = lineSpacing + attributedStr.addAttribute(NSAttributedString.Key.paragraphStyle, value: style, range: NSMakeRange(0, attributedStr.length)) + self.attributedText = attributedStr + } + } + + /// 행간 조정 메서드: 기존 attributedText에 속성 추가 + func modifyLineSpacing(lineSpacing: CGFloat) { if let attributedText = self.attributedText { let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText) @@ -24,12 +34,6 @@ public extension UILabel { } self.attributedText = mutableAttributedString - } else if let text = self.text { - let attributedStr = NSMutableAttributedString(string: text) - let style = NSMutableParagraphStyle() - style.lineSpacing = lineSpacing - attributedStr.addAttribute(NSAttributedString.Key.paragraphStyle, value: style, range: NSMakeRange(0, attributedStr.length)) - self.attributedText = attributedStr } } @@ -79,7 +83,7 @@ public extension UILabel { attributedString.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: fullText.count)) self.attributedText = attributedString } - + /// 라벨 일부 textColor 변경해주는 함수 /// - targetString에는 바꾸고자 하는 특정 문자열을 넣어주세요 /// - textColor에는 targetString에 적용하고자 하는 특정 UIColor에 넣어주세요 @@ -90,7 +94,7 @@ public extension UILabel { attributedString.addAttribute(.foregroundColor, value: textColor, range: range) self.attributedText = attributedString } - + /// 서버에서 받아온 string 값에서 html 태그를 적용해주는 함수 /// - targetString에는 특정 문자열을 넣어주세요 /// - defaultFont, defaultColor에는 기본 폰트와 컬러를 넣어주세요 diff --git a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift index 492c07ac..2b5db3e8 100644 --- a/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift +++ b/SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/Cells/DashBoard/DashBoardCardCVC.swift @@ -87,7 +87,6 @@ extension DashBoardCardCVC { func configureCell(userType: UserType, model: HomePresentationModel.DashBoard? = nil) { switch userType { case .visitor: - self.descriptionLabel.font = DSKitFontFamily.Suit.medium.font(size: 18) self.descriptionLabel.text = I18N.Home.DashBoard.UserHistory.encourage self.descriptionLabel.setLineSpacing(lineSpacing: 5) self.rightArrowWithCircleImageView.isHidden = true @@ -99,7 +98,7 @@ extension DashBoardCardCVC { defaultFont: DSKitFontFamily.Suit.medium.font(size: 18), boldFont: DSKitFontFamily.Suit.bold.font(size: 18), defaultColor: DSKitAsset.Colors.white100.color) - self.descriptionLabel.setLineSpacing(lineSpacing: 5) + self.descriptionLabel.modifyLineSpacing(lineSpacing: 5) self.rightArrowWithCircleImageView.isHidden = false guard let history = model.history else { return } userHistoryView.setData(userType: userType, recentHistory: history.first, allHistory: history) diff --git a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/VC/ListDetailVC.swift b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/VC/ListDetailVC.swift index 29467b78..0a83e1e3 100644 --- a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/VC/ListDetailVC.swift +++ b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/VC/ListDetailVC.swift @@ -185,6 +185,12 @@ extension ListDetailVC { let bottomButtonTapped = bottomButton .publisher(for: .touchUpInside) + .withUnretained(self) + .map { owner, _ in + if owner.sceneType == .none { + owner.showDimmerView() + } + } .mapVoid() .asDriver() @@ -259,6 +265,12 @@ extension ListDetailVC { .sink { owner, buttonEnabled in owner.bottomButton.setEnabled(buttonEnabled) }.store(in: cancelBag) + + output.isLoading + .withUnretained(self) + .sink { owner, isLoading in + isLoading ? owner.showLoading() : owner.stopLoading() + }.store(in: cancelBag) } private func setData(_ model: ListDetailModel) { @@ -554,7 +566,7 @@ extension ListDetailVC { self.textView.layer.cornerRadius = 12 self.textView.layer.borderColor = DSKitAsset.Colors.gray500.color.cgColor - self.textView.textContainerInset = UIEdgeInsets(top: 14, left: 14, bottom: 14, right: 14) + self.textView.textContainerInset = UIEdgeInsets(top: 14, left: 10, bottom: 14, right: 14) self.imagePlaceholderLabel.textColor = DSKitAsset.Colors.gray300.color self.imagePlaceholderLabel.setTypoStyle(.SoptampFont.subtitle2) @@ -617,7 +629,6 @@ extension ListDetailVC { missionView.snp.makeConstraints { make in make.leading.top.trailing.equalToSuperview() - make.height.equalTo(64) } missionImageView.snp.makeConstraints { make in diff --git a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionDateView.swift b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionDateView.swift index 241ca375..4eb6ffb5 100644 --- a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionDateView.swift +++ b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionDateView.swift @@ -14,12 +14,12 @@ import DSKit public final class MissionDateView: UIView { private enum Metric { - static let contentTop = 9.f - static let contentLeadingTrailing = 14.f - static let contentBottom = 10.f + static let contentTop = 9 + static let contentLeadingTrailing = 14 + static let contentBottom = 10 - static let toolBarHeight = 44.f - static let chevronLength = 20.f + static let toolBarHeight = 44 + static let chevronLength = 20 } private enum Constant { @@ -28,12 +28,12 @@ public final class MissionDateView: UIView { private lazy var contentStackView = UIStackView().then { $0.axis = .horizontal - $0.spacing = 0.f + $0.spacing = 0 } private lazy var textField = UITextField().then { $0.attributedPlaceholder = self.getAttributedString(I18N.ListDetail.missionDatePlaceHolder) - $0.textColor = DSKitAsset.Colors.gray50.color + $0.textColor = DSKitAsset.Colors.gray300.color $0.font = .SoptampFont.caption1 } private let rightChevron = UIImageView().then { @@ -121,7 +121,7 @@ extension MissionDateView { private extension MissionDateView { func getAttributedString(_ text: String) -> NSAttributedString { let attributes: [NSAttributedString.Key: Any] = [ - .foregroundColor: DSKitAsset.Colors.soptampGray600.color + .foregroundColor: DSKitAsset.Colors.gray300.color ] return NSAttributedString(string: text, attributes: attributes) @@ -170,7 +170,7 @@ extension MissionDateView { } private func getInitializedToolBar() -> UIToolbar { - let toolBar = UIToolbar(frame: CGRect(x: 0, y: 0, width: self.frame.width, height: Metric.toolBarHeight)) + let toolBar = UIToolbar(frame: CGRect(x: 0, y: 0, width: Int(self.frame.width), height: Metric.toolBarHeight)) let resetButton = UIBarButtonItem( title: I18N.ListDetail.datePickerCancelButtonTitle, style: .plain, diff --git a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionView.swift b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionView.swift index a9abda3b..bc82bc67 100644 --- a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionView.swift +++ b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/View/MissionView.swift @@ -14,11 +14,15 @@ import SnapKit import Core import DSKit -class MissionView: UIView { +final class MissionView: UIView { + // MARK: - UI Component private let starView = STStarView(starScale: 14, spacing: 10, level: .levelOne) - private let missionLabel = UILabel() + private let missionLabel = UILabel().then { + $0.textAlignment = .center + $0.numberOfLines = 2 + } // MARK: - Properties @@ -33,7 +37,7 @@ class MissionView: UIView { public convenience init(level: StarViewLevel, mission: String) { self.init() - self.missionLabel.text = mission + self.setMissionLabelText(mission) starView.changeStarLevel(level: level) } @@ -59,12 +63,22 @@ class MissionView: UIView { } missionLabel.snp.makeConstraints { make in - make.centerX.equalToSuperview() make.top.equalTo(starView.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview().inset(40) + } + + self.snp.makeConstraints { make in + make.bottom.equalTo(missionLabel.snp.bottom).offset(11) } } - - // MARK: - Custom Method - +} + +// MARK: - Methods + +extension MissionView { + private func setMissionLabelText(_ mission: String) { + self.missionLabel.text = (mission.count >= 24) ? mission.setLineBreakAtMiddle() : mission + self.missionLabel.modifyLineSpacing(lineSpacing: 2) + } } diff --git a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/ViewModel/ListDetailViewModel.swift b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/ViewModel/ListDetailViewModel.swift index 61d9789f..e107926f 100644 --- a/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/ViewModel/ListDetailViewModel.swift +++ b/SOPT-iOS/Projects/Features/StampFeature/Sources/ListDetailScene/ViewModel/ListDetailViewModel.swift @@ -50,6 +50,7 @@ public class ListDetailViewModel: ViewModelType { var showDeleteAlert = PassthroughSubject() var deleteSuccessed = PassthroughSubject() var bottomButtonEnabled = PassthroughSubject() + let isLoading = PassthroughSubject() } // MARK: - init @@ -91,7 +92,7 @@ extension ListDetailViewModel { input.imageSelected .flatMap { [weak self] imageData -> Driver<(Data, PresignedUrlModel)> in guard let self else { return .empty() } - + output.isLoading.send(true) self.useCase.getPresignedURL() self.currentImage.send(imageData) @@ -113,7 +114,7 @@ extension ListDetailViewModel { .asDriver() } .sink(receiveValue: { value in - + output.isLoading.send(false) }).store(in: self.cancelBag) @@ -142,7 +143,8 @@ extension ListDetailViewModel { } else { owner.useCase.putStamp(stampData: requestModel) } - }.store(in: self.cancelBag) + } + .store(in: self.cancelBag) input.rightButtonTapped .withUnretained(self) diff --git a/SOPT-iOS/Projects/Features/StampFeature/Sources/MissionListScene/Cells/MissionListCVC.swift b/SOPT-iOS/Projects/Features/StampFeature/Sources/MissionListScene/Cells/MissionListCVC.swift index 4da5bd82..0840f67a 100644 --- a/SOPT-iOS/Projects/Features/StampFeature/Sources/MissionListScene/Cells/MissionListCVC.swift +++ b/SOPT-iOS/Projects/Features/StampFeature/Sources/MissionListScene/Cells/MissionListCVC.swift @@ -271,7 +271,7 @@ extension MissionListCVC { let style = NSMutableParagraphStyle() style.lineHeightMultiple = 1.2 style.alignment = .center - style.lineBreakMode = .byWordWrapping + style.lineBreakMode = .byTruncatingTail style.lineBreakStrategy = .hangulWordPriority attributedStr.addAttribute(NSAttributedString.Key.kern, value: 0, range: NSMakeRange(0, attributedStr.length)) attributedStr.addAttribute(NSAttributedString.Key.paragraphStyle, value: style, range: NSMakeRange(0, attributedStr.length))