Skip to content

Commit

Permalink
[Chore] 브랜치 최신화 (#26)
Browse files Browse the repository at this point in the history
Merge branch 'develop' into fix/#26
  • Loading branch information
yurim830 committed Feb 14, 2025
2 parents 5e8de21 + 20dd1b3 commit a290342
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 16 deletions.
2 changes: 2 additions & 0 deletions ACON-iOS/ACON-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ enum StringLiterals {

static let needLogin = "로그인이 필요해요"

static let doubleQuestionMarks = "??"

static let notVerified = "미인증"

static let acornPossession = "보유한 도토리 수"
Expand Down
72 changes: 56 additions & 16 deletions ACON-iOS/ACON-iOS/Presentation/Profile/View/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,17 @@ final class ProfileView: BaseView {
$0.spacing = boxStackSpacing
}

acornCountBox.setStyle(
title: StringLiterals.Profile.acornPossession,
icon: .icLocalAconG20
)
acornCountBox.do {
$0.setStyle(
title: StringLiterals.Profile.acornPossession,
icon: .icLocalAconG20
)

let notVerifiedLabel = makeCountLabels(
StringLiterals.Profile.doubleQuestionMarks,
String(totalAcornCount))
$0.setSecondaryContentView(to: notVerifiedLabel)
}

verifiedAreaBox.do {
$0.setStyle(
Expand Down Expand Up @@ -177,6 +184,42 @@ final class ProfileView: BaseView {
}


// MARK: - Helpers

private extension ProfileView {

func makeCountLabels(_ currentString: String, _ totalString: String) -> UIView {
let contentView = UIView()
let labelStack = UIStackView()
let currentLabel = UILabel()
let totalLabel = UILabel()

labelStack.do {
$0.axis = .horizontal
$0.alignment = .center
$0.spacing = 2
}
currentLabel.setLabel(text: currentString, style: .t2, color: .org1)
totalLabel.setLabel(text: "/" + String(totalString), style: .s2, color: .gray5)

contentView.addSubview(labelStack)
labelStack.addArrangedSubviews(currentLabel, totalLabel)

labelStack.snp.makeConstraints {
$0.center.equalToSuperview()
}

// TODO: contentView - Width and horizontal position are ambiguous
contentView.snp.makeConstraints {
$0.width.height.greaterThanOrEqualTo(labelStack)
}

return contentView
}

}


// MARK: - Internal Methods

extension ProfileView {
Expand All @@ -192,19 +235,16 @@ extension ProfileView {
nicknameLabel.setLabel(text: text, style: .h5)
}

func setAcornCountBox(_ possessingCount: Int) {
let acornCountabel = UILabel()
let possessingString = possessingCount == 0 ? "00" : String(possessingCount)
// TODO: partialText 가운데 정렬 되도록 수정 (바닥 정렬인 partialText도 있어서 메소드 하나 더 만들어야 할 듯)
acornCountabel.setPartialText(
fullText: "\(possessingString)/\(String(totalAcornCount))",
textStyles: [
(text: possessingString, style: .t2, color: .org1),
(text: "/\(String(totalAcornCount))", style: .s2, color: .gray5)
]
)
func setAcornCountBox(_ currentCount: Int) {
let currentString = currentCount == 0 ? "00" : String(currentCount)
let totalString = String(totalAcornCount)
let countLabelStack = makeCountLabels(currentString, totalString)

acornCountBox.setContentView(to: acornCountabel)
acornCountBox.setContentView(to: countLabelStack)
}

func setAcornCountBox(onLoginSuccess: Bool) {
acornCountBox.switchContentView(toSecondary: !onLoginSuccess)
}

func setVerifiedAreaBox(areaName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private extension ProfileViewController {

self.profileView.do {
$0.needLoginButton.isHidden = onLoginSuccess
$0.setAcornCountBox(onLoginSuccess: onLoginSuccess)
$0.setVerifiedAreaBox(onLoginSuccess: onLoginSuccess)
}
}
Expand Down

0 comments on commit a290342

Please sign in to comment.