Skip to content

[Fix] #545 - 솝탬프 다크모드 대응 QA 반영 #546

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

Merged
merged 8 commits into from
Apr 10, 2025
24 changes: 14 additions & 10 deletions SOPT-iOS/Projects/Core/Sources/Extension/UIKit+/UILabel+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

비회원 뷰 원인이 이거 때문이었군요!!ㅎ.ㅎ

if let attributedText = self.attributedText {
let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText)

Expand All @@ -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
}
}

Expand Down Expand Up @@ -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에 넣어주세요
Expand All @@ -90,7 +94,7 @@ public extension UILabel {
attributedString.addAttribute(.foregroundColor, value: textColor, range: range)
self.attributedText = attributedString
}

/// 서버에서 받아온 string 값에서 html 태그를 적용해주는 함수
/// - targetString에는 특정 문자열을 넣어주세요
/// - defaultFont, defaultColor에는 기본 폰트와 컬러를 넣어주세요
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

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

Int로 타입 변경을 하신 이유가 궁금해요

let resetButton = UIBarButtonItem(
title: I18N.ListDetail.datePickerCancelButtonTitle,
style: .plain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}

Expand All @@ -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)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class ListDetailViewModel: ViewModelType {
var showDeleteAlert = PassthroughSubject<Bool, Never>()
var deleteSuccessed = PassthroughSubject<Bool, Never>()
var bottomButtonEnabled = PassthroughSubject<Bool, Never>()
let isLoading = PassthroughSubject<Bool, Never>()
}

// MARK: - init
Expand Down Expand Up @@ -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)

Expand All @@ -113,7 +114,7 @@ extension ListDetailViewModel {
.asDriver()
}
.sink(receiveValue: { value in

output.isLoading.send(false)
}).store(in: self.cancelBag)


Expand Down Expand Up @@ -142,7 +143,8 @@ extension ListDetailViewModel {
} else {
owner.useCase.putStamp(stampData: requestModel)
}
}.store(in: self.cancelBag)
}
.store(in: self.cancelBag)

input.rightButtonTapped
.withUnretained(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down