Skip to content

Commit

Permalink
chore: #146 중복 로직 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
juri123123 committed Jan 24, 2025
1 parent 6abb526 commit 29f5753
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
6 changes: 2 additions & 4 deletions Spoony-iOS/Spoony-iOS/Source/Feature/Report/Report.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ struct Report: View {
size: .xlarge,
title: "신고하기",
disabled: Binding(get: {
store.state.isDisabled
}, set: { newValue in
store.dispatch(.isDisabledChanged(newValue))
store.state.isError
}, set: { _ in
})
) {
store.dispatch(.reportPostButtonTapped(1))
Expand Down Expand Up @@ -111,7 +110,6 @@ extension Report {
)
.onTapGesture {
store.dispatch(.reportReasonButtonTapped(report))
// 이것도 intent로 바꿀 방법 생각해보기
hideKeyboard()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ enum ReportIntent {

case descriptionChanged(String)
case isErrorChanged(Bool)
case isDisabledChanged(Bool)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ import Foundation
struct ReportState {
var selectedReport: ReportType = .advertisement
var description: String = ""

var isError: Bool = true
var isDisabled: Bool = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,11 @@ final class ReportStore: ObservableObject {
sendReport(postId: postId, description: state.description)
case .descriptionChanged(let newValue):
state.description = newValue
// 여기서 hideKeyboard() 로직이 들어가야하는데 view의 extension이라 어떻게해야할지...
case .backgroundTapped: break
case .isErrorChanged(let newValue):
state.isError = newValue
state.isDisabled = state.isError
case .isDisabledChanged(let newValue):
state.isDisabled = newValue
state.isError = newValue
}
}


}

extension ReportStore {
Expand Down

0 comments on commit 29f5753

Please sign in to comment.