-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmotionRegisterCompletionViewController.swift
More file actions
160 lines (138 loc) · 6.66 KB
/
EmotionRegisterCompletionViewController.swift
File metadata and controls
160 lines (138 loc) · 6.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//
// EmotionRegisterCompletionViewController.swift
// Presentation
//
// Created by 이동현 on 8/23/25.
//
import Shared
import SnapKit
import UIKit
final class EmotionRegisterCompletionViewController: UIViewController {
private enum Layout {
static let speechImageHorizontalSpacing: CGFloat = 54
static let speechImageHeight: CGFloat = 102
static let speechImageBottomSpacing: CGFloat = 24
static let speechLabelHorizontalSpacing: CGFloat = 20
static let speechLabelTopSpacing: CGFloat = 22
static let speechLabelBottomSpacing: CGFloat = 32
static let groundImageHeight: CGFloat = 171
static let pomoImageWidth: CGFloat = 200
static let pomoImageHeight: CGFloat = 282
static let pomoBottomSpacing: CGFloat = 10
static let pomoLeftHandImageHeight: CGFloat = 52.98
static let pomoLeftHandImageWidth: CGFloat = 48.51
static let pomoLeftHandLeadingSpacing: CGFloat = 17.71
static let pomoRightHandImageHeight: CGFloat = 52.89
static let pomoRightHandImageWidth: CGFloat = 48.91
static let pomoRightHandTrailingSpacing: CGFloat = 16.65
static let pomoHandImageTopSpacing: CGFloat = 116.77
static let marbleImageSize: CGFloat = 120
static let marbleImageTopSpacing: CGFloat = 96.92
}
private let emotion: Emotion
private let backgroundImageView = UIImageView()
private let groundImageView = UIImageView()
private let speechImageView = UIImageView()
private let speechLabel = UILabel()
private let pomoImageView = UIImageView()
private let marbleImageView = UIImageView()
private let pomoLeftHandImageView = UIImageView()
private let pomoRightHandImageView = UIImageView()
init(emotion: Emotion) {
self.emotion = emotion
super.init(nibName: nil, bundle: nil)
marbleImageView.image = emotion.image
speechLabel.text = """
\(emotion.titleDescription ?? "") 하루에 맞춰
루틴을 추천해드릴게요!
"""
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
configureAttribute()
configureLayout()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
self?.goToRecommendedRoutineView()
}
}
func configureAttribute() {
backgroundImageView.image = BitnagilGraphic.emotionCompletionBackgroundGraphic
groundImageView.image = BitnagilGraphic.emotionCompletionGroundGraphic
pomoImageView.image = BitnagilGraphic.marblePomoGraphic
pomoLeftHandImageView.image = BitnagilGraphic.pomoLeftHandGraphic
pomoRightHandImageView.image = BitnagilGraphic.pomoRightHandGraphic
speechImageView.image = BitnagilGraphic.marbleSpeechGraphic?.withRenderingMode(.alwaysTemplate)
speechImageView.tintColor = BitnagilColor.gray10
speechLabel.font = BitnagilFont.init(
family: .cafe24Ssurround,
style: .cafe24Title2,
weight: .light).font
speechLabel.numberOfLines = 2
speechLabel.textColor = .white
speechLabel.textAlignment = .center
}
func configureLayout() {
view.addSubview(backgroundImageView)
view.addSubview(groundImageView)
view.addSubview(pomoImageView)
view.addSubview(marbleImageView)
view.addSubview(pomoLeftHandImageView)
view.addSubview(pomoRightHandImageView)
view.addSubview(speechImageView)
view.addSubview(speechLabel)
backgroundImageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
groundImageView.snp.makeConstraints { make in
make.horizontalEdges.bottom.equalToSuperview()
make.height.equalTo(Layout.groundImageHeight)
}
pomoImageView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.bottom.equalTo(groundImageView.snp.top).offset(Layout.pomoBottomSpacing)
make.width.equalTo(Layout.pomoImageWidth)
make.height.equalTo(Layout.pomoImageHeight)
}
marbleImageView.snp.makeConstraints { make in
make.top.equalTo(pomoImageView.snp.top).offset(Layout.marbleImageTopSpacing)
make.centerX.equalTo(pomoImageView)
make.size.equalTo(Layout.marbleImageSize)
}
pomoLeftHandImageView.snp.makeConstraints { make in
make.top.equalTo(pomoImageView.snp.top).offset(Layout.pomoHandImageTopSpacing)
make.leading.equalTo(pomoImageView).offset(Layout.pomoLeftHandLeadingSpacing)
make.height.equalTo(Layout.pomoLeftHandImageHeight)
make.width.equalTo(Layout.pomoLeftHandImageWidth)
}
pomoRightHandImageView.snp.makeConstraints { make in
make.top.equalTo(pomoImageView.snp.top).offset(Layout.pomoHandImageTopSpacing)
make.trailing.equalTo(pomoImageView).offset(-Layout.pomoRightHandTrailingSpacing)
make.width.equalTo(Layout.pomoRightHandImageWidth)
make.height.equalTo(Layout.pomoRightHandImageHeight)
}
speechImageView.snp.makeConstraints { make in
make.horizontalEdges.equalToSuperview().inset(Layout.speechImageHorizontalSpacing)
make.height.equalTo(Layout.speechImageHeight)
make.bottom.equalTo(pomoImageView.snp.top).offset(-Layout.speechImageBottomSpacing)
}
speechLabel.snp.makeConstraints { make in
make.top.equalTo(speechImageView.snp.top).offset(Layout.speechLabelTopSpacing)
make.bottom.equalTo(speechImageView.snp.bottom).offset(-Layout.speechLabelBottomSpacing)
make.horizontalEdges.equalTo(speechImageView).inset(Layout.speechImageHorizontalSpacing)
}
}
private func goToRecommendedRoutineView() {
guard let resultRecommendedRoutineViewModel = DIContainer.shared.resolve(type: ResultRecommendedRoutineViewModel.self)
else{ fatalError("resultRecommendedRoutineViewModel 의존성이 등록되지 않았습니다.") }
resultRecommendedRoutineViewModel.configure(viewModelType: .emotion(emotion: emotion))
let resultRecommendedRoutineView = ResultRecommendedRoutineViewController(entryPoint: .emotion, viewModel: resultRecommendedRoutineViewModel)
resultRecommendedRoutineView.hidesBottomBarWhenPushed = true
self.navigationController?.pushViewController(resultRecommendedRoutineView, animated: true)
}
}