Skip to content

Commit

Permalink
[:art: style] 메인화면 토글 이벤트 수정 (#116)
Browse files Browse the repository at this point in the history
feat: #114
  • Loading branch information
Juhyeoklee authored Sep 27, 2022
1 parent dd7e691 commit e2caaa5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Code-Zero/Global/View/ChallengeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ class ChallengeView: UIView {
internal var challengeOffset: Int!
internal var challengeState: ChallengeState = .willChallenge
internal var isMine: Bool!

internal var isEnable: Bool = true {
didSet {
dropWaterImageView.isUserInteractionEnabled = isEnable
}
}
// MARK: Event Property
internal weak var delegate: ChallengeViewDelegate?
private var cachedChallengeText: String?
Expand All @@ -204,6 +208,7 @@ class ChallengeView: UIView {
}

@objc private func didToggleChallengeStateTap() {
print(#function)
toggleChallengeStateHandler?()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ extension ChallengeVC: ChallengeViewDelegate {
// 챌린지 완료 상태 toggle 이벤트 delegate
func didToggleChallengeStateAction(challengeOffset: Int, currentState: ChallengeState) {
let inconvenience = inconveniences[challengeOffset]
let challengeView = challengeViewList[challengeOffset]
challengeView?.isEnable = false
toggleInconvenienceComplete(inconvenience: inconvenience) { [weak self] (isSuccess, inconvenience) in
if isSuccess, let inconvenience = inconvenience {
self?.inconveniences[challengeOffset] = inconvenience
} else {
self?.setChallengeViewChangingState(offset: challengeOffset)
}
challengeView?.isEnable = true
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions Code-Zero/Screen/Challenge/VC/ChallengeVC+Network.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ extension ChallengeVC {
completion: @escaping (Bool, Convenience?) -> Void
) {
guard let token = accessToken else { return }
Indicator.shared.show()
MainChallengeService
.shared
.requestCompleteMyInconvenience(token: token, inconvenience: inconvenience) { result in
Expand All @@ -116,12 +115,12 @@ extension ChallengeVC {
}
case .requestErr(let message):
print(message)
completion(false, nil)
case .serverErr:
break
completion(false, nil)
case .networkFail:
break
completion(false, nil)
}
Indicator.shared.dismiss()
}
}

Expand Down

0 comments on commit e2caaa5

Please sign in to comment.