Skip to content

Commit

Permalink
🔥 :: [#317] InputAuthenticationFeature / collapsedAuthentication 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
shwaaaa committed Feb 25, 2024
1 parent 86bbc4f commit faba8f0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ import InputAuthenticationFeatureInterface
final class InputAuthenticationIntent: InputAuthenticationIntentProtocol {
private weak var model: (any InputAuthenticationActionProtocol)?
private weak var inputAuthenticationDelegate: (any InputAuthenticationDelegate)?

init(
model: any InputAuthenticationActionProtocol,
inputAuthenticationDelegate: any InputAuthenticationDelegate
) {
self.model = model
self.inputAuthenticationDelegate = inputAuthenticationDelegate
}

func updateAuthenticationTitle(index: Int, title: String) {
model?.updateAuthenticationTitle(index: index, title: title)
}

func updateAuthenticationContent(index: Int, content: String) {
model?.updateAuthenticationContent(index: index, content: content)
}

func completeButtonDidTap() {
inputAuthenticationDelegate?.completeToInputInputAuthentication()
}

func authenticationAppendButtonDidTap() {
model?.appendEmptyAuthentication()
}

func appendEmptyAuthentication() {
model?.appendEmptyAuthentication()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ final class InputAuthenticationModel: ObservableObject, InputAuthenticationState
@Published var authenticationTitle: String = ""
@Published var authenticationContent: String = ""
@Published var authenticationList: [AuthenticationInfo] = []
@Published var collapsedAuthentication: [Bool] = []
}

extension InputAuthenticationModel: InputAuthenticationActionProtocol {
Expand All @@ -14,14 +13,13 @@ extension InputAuthenticationModel: InputAuthenticationActionProtocol {
content: ""
)
self.authenticationList.append(newAuthentication)
self.collapsedAuthentication.append(false)
}

func updateAuthenticationTitle(index: Int, title: String) {
guard authenticationList[safe: index] != nil else { return }
self.authenticationList[index].title = title
}

func updateAuthenticationContent(index: Int, content: String) {
guard authenticationList[safe: index] != nil else { return }
self.authenticationList[index].content = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ protocol InputAuthenticationStateProtocol {
var authenticationTitle: String { get }
var authenticationContent: String { get }
var authenticationList: [AuthenticationInfo] { get }
var collapsedAuthentication: [Bool] { get }
}

protocol InputAuthenticationActionProtocol: AnyObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ struct InputAuthenticationView: View {
VStack(spacing: 0) {
ForEach(state.authenticationList.indices, id: \.self) { index in
SMSSeparator()

authenticationPageView(index: index)
}
.padding(.top, 16)

CTAButton(text: "저장")
.padding(.top, 16)
.padding(.horizontal, 20)
Expand All @@ -44,29 +44,28 @@ struct InputAuthenticationView: View {

@ViewBuilder
func authenticationPageView(index: Int) -> some View {
let collapsed = state.collapsedAuthentication[safe: index] ?? false
ConditionView(!collapsed) {
VStack(spacing: 0) {
HStack(spacing: 4) {
Text("인증제")
.foregroundColor(.sms(.system(.black)))

Text("*")
.foregroundColor(.sms(.sub(.s2)))

Spacer()
}
.smsFont(.title1)
.padding(.top, 16)

VStack(spacing: 24) {
HStack {
authenticationImage(index: index)

Spacer()
}

authenticationTitle(index: index)

authenticationContent(index: index)
}
}
Expand All @@ -85,7 +84,7 @@ private extension InputAuthenticationView {
}
.titleWrapper("사진")
}

@ViewBuilder
func authenticationTitle(index: Int) -> some View {
SMSTextField(
Expand All @@ -97,7 +96,7 @@ private extension InputAuthenticationView {
)
.titleWrapper("활동 제목")
}

@ViewBuilder
func authenticationContent(index: Int) -> some View {
SMSTextEditor(
Expand Down

0 comments on commit faba8f0

Please sign in to comment.