Skip to content

Commit

Permalink
feat/#185 레벨에 따른 라벨 및 이미지 분기처리
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaybei committed Jul 16, 2024
1 parent 33a1015 commit 5f5aaf8
Show file tree
Hide file tree
Showing 18 changed files with 129 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "level01.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "level02.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "level03.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "level04.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 14 additions & 22 deletions KkuMulKum/Source/Home/View/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,23 @@ final class HomeView: BaseView {

let kkumulLabel = UILabel()

let levelCharacterImage = UIImageView()

let levelLabel = UILabel()

let levelCaptionLabel = UILabel()

private let levelView = UIStackView(axis: .horizontal).then {
$0.backgroundColor = .white
$0.layer.cornerRadius = 12
$0.alignment = .fill
$0.distribution = .fill
}

let levelLabel = UILabel().then {
$0.setText("Lv.0 새끼 꾸물이", style: .caption01, color: .gray6)
$0.setHighlightText("Lv.0", style: .caption01, color: .maincolor)
}

private let levelCaptionView = UIImageView().then {
$0.image = .imgBoard
}

let levelCaptionLabel = UILabel().then {
$0.setText(
"아직 한번도 정시에 도착하지 못했어요!\n정시 도착으로 캐릭터를 성장시켜 보세요",
style: .label01,
color: .white
)
}

private let promiseView = UIView(backgroundColor: .gray0).then {
$0.roundCorners(
cornerRadius: 16,
Expand Down Expand Up @@ -116,6 +109,7 @@ final class HomeView: BaseView {
contentView.addSubviews(
logo,
kkumulLabel,
levelCharacterImage,
levelView,
levelCaptionView,
levelCaptionLabel,
Expand Down Expand Up @@ -161,6 +155,13 @@ final class HomeView: BaseView {
$0.top.equalToSuperview().offset(112)
}

levelCharacterImage.snp.makeConstraints {
$0.top.equalToSuperview().offset(106)
$0.trailing.equalToSuperview()
$0.width.equalTo(160)
$0.height.equalTo(198)
}

levelView.snp.makeConstraints {
$0.trailing.equalToSuperview().offset(-36)
$0.top.equalToSuperview().offset(350)
Expand Down Expand Up @@ -231,12 +232,3 @@ final class HomeView: BaseView {
}
}
}

//extension HomeView {
// func dataBind(_ data: LoginUserModel) {
// kkumulLabel.setText("\(data.name) 님,\n\(data.promiseCount)번의 약속에서\n\(data.tardyCount)번 꾸물거렸어요!", style: .title02, color: .white)
// kkumulLabel.setHighlightText("\(data.name) 님,", style: .title00, color: .white)
// kkumulLabel.setHighlightText("\(data.promiseCount)번", "\(data.tardyCount)번", style: .title00, color: .lightGreen)
// levelLabel.setText("Lv.\(data.level) \(viewModel.levelName)", style: .caption01, color: .gray6)
// }
//}
23 changes: 23 additions & 0 deletions KkuMulKum/Source/Home/ViewController/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ private extension HomeViewController {
viewModel.loginUser.bind { [weak self] _ in
DispatchQueue.main.async {
let data = self?.viewModel.loginUser.value

self?.rootView.kkumulLabel.setText(
"\(data?.name ?? "") 님,\n\(data?.promiseCount ?? 0)번의 약속에서\n\(data?.tardyCount ?? 0)번 꾸물거렸어요!",
style: .title02,
Expand All @@ -203,6 +204,28 @@ private extension HomeViewController {
style: .title00,
color: .lightGreen
)
self?.rootView.levelLabel.setText(
"Lv.\(data?.level ?? 0) \(self?.viewModel.levelName.value ?? "")",
style: .caption01,
color: .gray6
)
self?.rootView.levelLabel.setHighlightText(
"Lv.\(data?.level ?? 0)",
style: .caption01,
color: .maincolor
)
self?.rootView.levelCaptionLabel.setText(
self?.viewModel.levelCaption.value ?? "",
style: .label01,
color: .white
)
switch data?.level {
case 1: self?.rootView.levelCharacterImage.image = .imgLevel01
case 2: self?.rootView.levelCharacterImage.image = .imgLevel02
case 3: self?.rootView.levelCharacterImage.image = .imgLevel03
case 4: self?.rootView.levelCharacterImage.image = .imgLevel04
default: break
}
}
}
}
Expand Down

0 comments on commit 5f5aaf8

Please sign in to comment.