Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ :: 정보 μž…λ ₯ μ‹€νŒ¨ μ‹œ μœ μ €μ—κ²Œ μ—λŸ¬ λ©”μ‹œμ§€ 전달 #170

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension StudentDomainError: LocalizedError {
return "μ•Œ 수 μ—†λŠ” μ—λŸ¬κ°€ λ°œμƒν•˜μ˜€μŠ΅λ‹ˆλ‹€."

case .alreadyExistUser:
return "이미 μ‘΄μž¬ν•˜λŠ” μœ μ €μž…λ‹ˆλ‹€."
return "이미 μ •λ³΄μž…λ ₯을 μ™„λ£Œν•œ μœ μ €μž…λ‹ˆλ‹€."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ final class InputInformationIntent: InputInformationIntentProtocol {
try await inputInformationUseCase.execute(req: inputInformationRequest)
model?.updateIsLoading(isLoading: false)
} catch {
model?.updateErrorMessage(message: error.localizedDescription)
model?.updateIsLoading(isLoading: false)
}
}
}

func errorAlertDismissed() {
model?.updateIsError(isError: true)
}
}

extension InputInformationIntent: InputProfileDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ protocol InputInformationIntentProtocol:
InputCertificateDelegate,
InputLanguageDelegate {
func completeToInputAllInfo(state: any InputInformationStateProtocol)
func errorAlertDismissed()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import StudentDomainInterface
final class InputInformationModel: ObservableObject, InputInformationStateProtocol {
@Published var phase: InformationPhase = .profile
@Published var isLoading: Bool = false
@Published var isError: Bool = false
var errorMessage: String = "μ•Œ 수 μ—†λŠ” 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€."
var inputProfileInformationObject: InputProfileInformationObject?
var inputSchoolLifeInformationObject: InputSchoolLifeInformationObject?
var inputWorkInfomationObject: InputWorkInformationObject?
Expand Down Expand Up @@ -62,4 +64,12 @@ extension InputInformationModel: InputInformationActionProtocol {
func updateIsLoading(isLoading: Bool) {
self.isLoading = isLoading
}

func updateIsError(isError: Bool) {
self.isError = isError
}

func updateErrorMessage(message: String) {
self.errorMessage = message
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ enum InformationPhase: CaseIterable {
protocol InputInformationStateProtocol {
var phase: InformationPhase { get }
var isLoading: Bool { get }
var isError: Bool { get }
var errorMessage: String { get }
var inputProfileInformationObject: InputProfileInformationObject? { get }
var inputSchoolLifeInformationObject: InputSchoolLifeInformationObject? { get }
var inputWorkInfomationObject: InputWorkInformationObject? { get }
Expand All @@ -36,4 +38,6 @@ protocol InputInformationActionProtocol: AnyObject {
func updateLanguages(languages: [InputStudentInformationRequestDTO.LanguageCertificate])
func updateIsCompleteToInputAllInfo(isComplete: Bool)
func updateIsLoading(isLoading: Bool)
func updateIsError(isError: Bool)
func updateErrorMessage(message: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ struct InputInformationView: View {
.eraseToAnyView()
.tag(InformationPhase.language)
}
.smsAlert(
title: "μ •λ³΄μž…λ ₯ μ‹€νŒ¨",
description: state.errorMessage,
isShowing: Binding(
get: { state.isError },
set: { _ in intent.errorAlertDismissed() }
),
alertActions: [
.init(text: "확인") {
intent.errorAlertDismissed()
}
]
)
.animation(.default, value: state.phase)
.onChange(of: state.isCompleteToInputAllInfo) { newValue in
if newValue {
Expand Down