@@ -19,7 +19,13 @@ final class HomeViewController: BaseViewController {
19
19
private var mateGoalStep : Int = 0
20
20
private var guideURL = String ( )
21
21
/// 나중에 인증 완료 API 들어오면 바인딩
22
- private var isMissionCompleted : Bool = true
22
+ private var isMissionCompleted : Bool = false {
23
+ didSet {
24
+ if isMissionCompleted {
25
+ homeView. configureCheckButtonStyle ( state: . checkCompleted)
26
+ }
27
+ }
28
+ }
23
29
private var isStepCountCompleted : Bool = false {
24
30
didSet {
25
31
if isStepCountCompleted && isMateStepCountCompleted {
@@ -69,10 +75,14 @@ final class HomeViewController: BaseViewController {
69
75
if mateGoalStep > 0 && mateGoalStep <= tempMateStep {
70
76
self . isMateStepCountCompleted = true
71
77
}
78
+
72
79
DispatchQueue . main. async {
73
- self . homeView. homeCircularProgressView. setParentProgress ( currentStep: self . tempMateStep, finalStep: self . mateGoalStep , withAnimation: true )
80
+ self . homeView. homeCircularProgressView. setParentProgress ( currentStep: self . tempMateStep,
81
+ finalStep: self . mateGoalStep,
82
+ withAnimation: true )
74
83
self . homeView. homeStepCountView. parentWalkCountLabel. text = " \( self . tempMateStep) "
75
84
}
85
+
76
86
}
77
87
}
78
88
}
@@ -91,7 +101,9 @@ final class HomeViewController: BaseViewController {
91
101
92
102
override func viewDidLoad( ) {
93
103
super. viewDidLoad ( )
94
- StepCountManager . shared. startCheckStepCount ( )
104
+ if !StepCountManager. shared. isStepCountStarted {
105
+ StepCountManager . shared. startCheckStepCount ( )
106
+ }
95
107
configureStepCount ( )
96
108
}
97
109
@@ -104,9 +116,7 @@ final class HomeViewController: BaseViewController {
104
116
requestPatchHome ( )
105
117
requestPostMission ( )
106
118
configureMissionTapGesture ( )
107
- if isMissionCompleted {
108
- homeView. configureCheckButtonStyle ( state: . checkCompleted)
109
- }
119
+
110
120
}
111
121
112
122
// MARK: - Override Functions
@@ -149,9 +159,10 @@ final class HomeViewController: BaseViewController {
149
159
@objc
150
160
private func firstMissionViewDidTapped( ) {
151
161
if !homeView. isMissionSelected {
152
- homeView. configureMissionSelectedView ( isSelected: !homeView. isMissionSelected)
153
162
requestPostMissionChoice ( param: HomeChoiceMissionRequest ( missionID: firstMissionData. missionID) )
163
+ homeView. configureMissionSelectedView ( isSelected: !homeView. isMissionSelected)
154
164
homeView. pickMissionLabel. text = firstMissionData. missionContent
165
+ homeView. dateLabel. text = " 오늘의 운동 "
155
166
}
156
167
}
157
168
@@ -161,8 +172,7 @@ final class HomeViewController: BaseViewController {
161
172
homeView. configureMissionSelectedView ( isSelected: !homeView. isMissionSelected)
162
173
requestPostMissionChoice ( param: HomeChoiceMissionRequest ( missionID: secondMissionData. missionID) )
163
174
homeView. pickMissionLabel. text = secondMissionData. missionContent
164
-
165
-
175
+ homeView. dateLabel. text = " 오늘의 운동 "
166
176
}
167
177
}
168
178
@@ -234,7 +244,7 @@ final class HomeViewController: BaseViewController {
234
244
///비활성화 된 상태에서, 화면 밖으로 나가지 않고 즉시 걸음수 충족 및 인증 완료를 확인하기 위한 처리.
235
245
///화면으로부터 나간 후, 다시 들어왔을 때는 서버에서 isMissionCompleted 값을 준다.
236
246
private func judgeButtonStyle( goal goalStep: Int , now currentStep: Int ) {
237
- if goalStep >= 0 && goalStep >= currentStep {
247
+ if goalStep > 0 && goalStep >= currentStep {
238
248
homeView. configureCheckButtonStyle ( state: . unCompleted)
239
249
} else { /// 목표 걸음수를 채웠을 때의 두 가지 경우.
240
250
self . isStepCountCompleted = true
@@ -314,21 +324,19 @@ extension HomeViewController {
314
324
self . mateGoalStep = result. opponentUserGoalStepCount
315
325
self . isStepCountCompleted = result. isStepCountCompleted
316
326
self . isMissionCompleted = result. isMissionImgCompleted
317
-
327
+ if result. isMissionImgCompleted {
328
+ self . homeView. configureCheckButtonStyle ( state: . checkCompleted)
329
+ }
318
330
319
331
/// 목표 걸음 수 너무 높아서 따로 넣어서 사용 중
320
332
// self.goalStep = 700
321
333
// self.mateGoalStep = 1000
322
334
323
335
if result. userType == " 자녀 " {
324
336
self . homeView. homeStepCountView. parentWalkLabel. text = " 부모님 걸음 "
325
- self . homeView. homeCircularProgressView. myProgressLayer. strokeColor = UIColor . blue400. cgColor
326
- self . homeView. homeCircularProgressView. parentProgressLayer. strokeColor = UIColor . gray600. cgColor
327
337
328
338
} else if result. userType == " 부모 " {
329
339
self . homeView. homeStepCountView. parentWalkLabel. text = " 자녀 걸음 "
330
- self . homeView. homeCircularProgressView. myProgressLayer. strokeColor = UIColor . gray600. cgColor
331
- self . homeView. homeCircularProgressView. parentProgressLayer. strokeColor = UIColor . blue400. cgColor
332
340
}
333
341
}
334
342
}
@@ -349,6 +357,7 @@ extension HomeViewController {
349
357
missionContent: String ( ) ,
350
358
missionIconURL: String ( ) )
351
359
} else {
360
+ self . homeView. dateLabel. text = " 오늘의 운동 "
352
361
self . guideURL = result. todayMission? . missionDescription ?? " "
353
362
}
354
363
}
0 commit comments