From 201e569ab21aa08e33d193c460a7866da169a7c3 Mon Sep 17 00:00:00 2001 From: baegteun Date: Mon, 22 May 2023 23:55:45 +0900 Subject: [PATCH 1/6] :heavy_plus_sign: :: StudentDomainInterface -> InputWorkInfoFeature --- Projects/Feature/InputWorkInfoFeature/Project.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Projects/Feature/InputWorkInfoFeature/Project.swift b/Projects/Feature/InputWorkInfoFeature/Project.swift index cb752c15..0521e2c9 100644 --- a/Projects/Feature/InputWorkInfoFeature/Project.swift +++ b/Projects/Feature/InputWorkInfoFeature/Project.swift @@ -7,6 +7,7 @@ let project = Project.makeModule( product: .staticLibrary, targets: [.interface, .unitTest], internalDependencies: [ - .Feature.BaseFeature + .Feature.BaseFeature, + .Domain.StudentDomainInterface ] ) From e4ba1603c422cc60562bc521586fc60c093a47af Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 23 May 2023 00:52:47 +0900 Subject: [PATCH 2/6] =?UTF-8?q?:goal=5Fnet:=20::=20=EA=B7=BC=EB=AC=B4=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=B2=98=EB=A6=AC=20=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interface/Enums/FormOfEmployment.swift | 13 +++- .../Interface/Enums/MilitaryService.swift | 2 +- .../Intent/InputSchoolLifeInfoIntent.swift | 11 ++-- .../Model/InputSchoolLifeInfoModel.swift | 4 +- .../InputSchoolLifeInfoModelProtocol.swift | 2 +- .../Scene/InputSchoolLifeInfoView.swift | 2 +- .../Sources/Intent/InputWorkInfoIntent.swift | 8 ++- .../Intent/InputWorkInfoIntentProtocol.swift | 4 +- .../Sources/Model/InputWorkInfoModel.swift | 6 ++ .../Model/InputWorkInfoModelProtocol.swift | 3 + .../Sources/Scene/InputWorkInfoView.swift | 60 ++++++++++++------- 11 files changed, 81 insertions(+), 34 deletions(-) diff --git a/Projects/Domain/StudentDomain/Interface/Enums/FormOfEmployment.swift b/Projects/Domain/StudentDomain/Interface/Enums/FormOfEmployment.swift index 618658e5..c204db93 100644 --- a/Projects/Domain/StudentDomain/Interface/Enums/FormOfEmployment.swift +++ b/Projects/Domain/StudentDomain/Interface/Enums/FormOfEmployment.swift @@ -1,6 +1,17 @@ -public enum FormOfEmployment: String, Encodable { +public enum FormOfEmployment: String, Codable, CaseIterable { case fullTime = "FULL_TIME" case temporary = "TEMPORARY" case constract = "CONSTRACT" case intern = "INTERN" } + +public extension FormOfEmployment { + func display() -> String { + switch self { + case .fullTime: return "정규직" + case .temporary: return "비정규직" + case .constract: return "계약직" + case .intern: return "인턴" + } + } +} diff --git a/Projects/Domain/StudentDomain/Interface/Enums/MilitaryService.swift b/Projects/Domain/StudentDomain/Interface/Enums/MilitaryService.swift index f22c43f0..40d16564 100644 --- a/Projects/Domain/StudentDomain/Interface/Enums/MilitaryService.swift +++ b/Projects/Domain/StudentDomain/Interface/Enums/MilitaryService.swift @@ -1,4 +1,4 @@ -public enum MilitaryService: String, Encodable { +public enum MilitaryService: String, Codable { case hope = "HOPE" case notHope = "NOT_HOPE" case noMatter = "NO_MATTER" diff --git a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Intent/InputSchoolLifeInfoIntent.swift b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Intent/InputSchoolLifeInfoIntent.swift index 6b8fe4ff..e752633e 100644 --- a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Intent/InputSchoolLifeInfoIntent.swift +++ b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Intent/InputSchoolLifeInfoIntent.swift @@ -41,20 +41,21 @@ final class InputSchoolLifeInfoIntent: InputSchoolLifeInfoIntentProtocol { func nextButtonDidTap(state: any InputSchoolLifeInfoStateProtocol) { var errorSet = Set() - if Int(state.authenticationScroe) != nil { + if Int(state.authenticationScore) == nil || state.authenticationScore.isEmpty { errorSet.insert(.gsmAuthentication) } - if state.hwpFileURL != nil { + if state.hwpFileURL == nil { errorSet.insert(.hwp) } + model?.updateErrorField(field: errorSet) guard - let gsmScore = Int(state.authenticationScroe), + let gsmScore = Int(state.authenticationScore), let hwpURL = state.hwpFileURL, - let hwpData = try? Data(contentsOf: hwpURL) + let hwpData = try? Data(contentsOf: hwpURL), + errorSet.isEmpty else { - model?.updateErrorField(field: errorSet) return } diff --git a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModel.swift b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModel.swift index 9e62e162..7cae57c5 100644 --- a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModel.swift +++ b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModel.swift @@ -6,7 +6,7 @@ enum InputSchoolLifeErrorField: Hashable { } final class InputSchoolLifeInfoModel: ObservableObject, InputSchoolLifeInfoStateProtocol { - @Published var authenticationScroe: String = "" + @Published var authenticationScore: String = "" @Published var isPresentedHWPFileImporter: Bool = false @Published var hwpFileURL: URL? var hwpFilename: String { @@ -20,7 +20,7 @@ final class InputSchoolLifeInfoModel: ObservableObject, InputSchoolLifeInfoState extension InputSchoolLifeInfoModel: InputSchoolLifeInfoActionProtocol { func updateAuthenticationScore(score: String) { - self.authenticationScroe = score + self.authenticationScore = score } func updateIsPresentedHWPFileImporter(isPresented: Bool) { diff --git a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModelProtocol.swift b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModelProtocol.swift index fb01a941..2b226aef 100644 --- a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModelProtocol.swift +++ b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Model/InputSchoolLifeInfoModelProtocol.swift @@ -1,7 +1,7 @@ import Foundation protocol InputSchoolLifeInfoStateProtocol { - var authenticationScroe: String { get } + var authenticationScore: String { get } var isPresentedHWPFileImporter: Bool { get } var hwpFileURL: URL? { get } var hwpFilename: String { get } diff --git a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Scene/InputSchoolLifeInfoView.swift b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Scene/InputSchoolLifeInfoView.swift index 86ef36e4..b42c2eca 100644 --- a/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Scene/InputSchoolLifeInfoView.swift +++ b/Projects/Feature/InputSchoolLifeInfoFeature/Sources/Scene/InputSchoolLifeInfoView.swift @@ -23,7 +23,7 @@ struct InputSchoolLifeInfoView: View { SMSTextField( "인증제 점수 입력", text: Binding( - get: { state.authenticationScroe }, + get: { state.authenticationScore }, set: intent.updateAuthenticationScore(score:) ), errorText: "인증제 점수를 입력해주세요", diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift index 88db2b70..58c7e271 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift @@ -1,5 +1,6 @@ import Foundation import InputWorkInfoFeatureInterface +import StudentDomainInterface final class InputWorkInfoIntent: InputWorkInfoIntentProtocol { private weak var model: (any InputWorkInfoActionProtocol)? @@ -29,6 +30,10 @@ final class InputWorkInfoIntent: InputWorkInfoIntentProtocol { model?.updateSalary(salary: salary) } + func updateFormOfEmployment(form: FormOfEmployment) { + model?.updateFormOfEmployment(form: form) + } + func formOfEmployeementSheetIsRequired() { model?.updateIsPresentedFormOfEmployeementSheet(isPresented: true) } @@ -41,7 +46,8 @@ final class InputWorkInfoIntent: InputWorkInfoIntentProtocol { inputWorkDelegate?.workPrevButtonDidTap() } - func nextButtonDidTap() { + func nextButtonDidTap(state: any InputWorkInfoStateProtocol) { + inputWorkDelegate?.completeToInputWork() } } diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntentProtocol.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntentProtocol.swift index 23f17bb7..4022d12c 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntentProtocol.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntentProtocol.swift @@ -1,12 +1,14 @@ import Foundation +import StudentDomainInterface protocol InputWorkInfoIntentProtocol { func appendWorkRegion() func updateWorkRegion(region: String, at index: Int) func deleteWorkRegion(at index: Int) func updateSalary(salary: String) + func updateFormOfEmployment(form: FormOfEmployment) func formOfEmployeementSheetIsRequired() func formOfEmployeementSheetDismissed() func prevButtonDidTap() - func nextButtonDidTap() + func nextButtonDidTap(state: any InputWorkInfoStateProtocol) } diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift index 2d917151..5706c0c0 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift @@ -1,9 +1,11 @@ import Foundation import FoundationUtil +import StudentDomainInterface final class InputWorkInfoModel: ObservableObject, InputWorkInfoStateProtocol { @Published var workRegionList: [String] = [""] @Published var salary: String = "" + @Published var formOfEmployment: FormOfEmployment = .fullTime @Published var isPresentedFormOfEmployeementSheet: Bool = false } @@ -25,6 +27,10 @@ extension InputWorkInfoModel: InputWorkInfoActionProtocol { self.salary = salary } + func updateFormOfEmployment(form: FormOfEmployment) { + self.formOfEmployment = form + } + func updateIsPresentedFormOfEmployeementSheet(isPresented: Bool) { self.isPresentedFormOfEmployeementSheet = isPresented } diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift index b122b457..3a23760d 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift @@ -1,8 +1,10 @@ import Foundation +import StudentDomainInterface protocol InputWorkInfoStateProtocol { var workRegionList: [String] { get } var salary: String { get } + var formOfEmployment: FormOfEmployment { get } var isPresentedFormOfEmployeementSheet: Bool { get } } @@ -11,5 +13,6 @@ protocol InputWorkInfoActionProtocol: AnyObject { func updateWorkRegion(region: String, at index: Int) func deleteWorkRegion(at index: Int) func updateSalary(salary: String) + func updateFormOfEmployment(form: FormOfEmployment) func updateIsPresentedFormOfEmployeementSheet(isPresented: Bool) } diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift index 4056d3dc..3d233cad 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift @@ -2,6 +2,7 @@ import BaseFeature import DesignSystem import FoundationUtil import SwiftUI +import StudentDomainInterface import ViewUtil struct InputWorkInfoView: View { @@ -22,24 +23,36 @@ struct InputWorkInfoView: View { pageTitleView() VStack(spacing: 24) { - SMSTextField("정규직", text: .constant("")) - .disabled(true) - .overlay(alignment: .trailing) { - SMSIcon(.downChevron) - .padding(.trailing, 12) - } - .titleWrapper("희망 고용 형태") - .onTapGesture { - intent.formOfEmployeementSheetIsRequired() - } - SMSTextField( - "희망 연봉 (10,000원 단위)", + "정규직", text: Binding( - get: { state.salary }, - set: intent.updateSalary(salary:) - ) + get: { state.formOfEmployment.display() }, + set: { _ in } + ), + isOnClear: false ) + .disabled(true) + .overlay(alignment: .trailing) { + SMSIcon(.downChevron) + .padding(.trailing, 12) + } + .titleWrapper("희망 고용 형태") + .onTapGesture { + intent.formOfEmployeementSheetIsRequired() + } + + VStack(alignment: .leading, spacing: 8) { + SMSTextField( + "희망 연봉 (10,000원 단위)", + text: Binding( + get: { state.salary }, + set: intent.updateSalary(salary:) + ) + ) + + SMSText("\(state.salary)만원", font: .caption1) + .foregroundColor(.sms(.neutral(.n30))) + } .titleWrapper("희망 연봉") workRegionList() @@ -56,7 +69,7 @@ struct InputWorkInfoView: View { .frame(maxWidth: proxy.size.width / 3) CTAButton(text: "다음") { - intent.nextButtonDidTap() + intent.nextButtonDidTap(state: state) } .frame(maxWidth: .infinity) } @@ -127,17 +140,22 @@ struct InputWorkInfoView: View { @ViewBuilder func formOfEmployeementList() -> some View { VStack(spacing: 16) { - ForEach(0..<4, id: \.self) { index in + ForEach(FormOfEmployment.allCases, id: \.self) { formOfEmployment in HStack { - Text("\(index)") + Text(formOfEmployment.display()) .smsFont(.body1, color: .neutral(.n50)) Spacer() - Circle() - .fill(Color.sms(.primary(.p2))) - .frame(width: 24, height: 24) + SMSSelectionControls( + isSeleted: Binding( + get: { state.formOfEmployment == formOfEmployment }, + set: { $0 ? intent.updateFormOfEmployment(form: formOfEmployment) : () } + ) + ) + .buttonWrapper {} } + .animation(.default, value: state.formOfEmployment) .padding(.horizontal, 20) } } From 3e691370a3d16d9dd3bdb112e585ad439cc68ba2 Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 23 May 2023 09:26:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?:sparkles:=20::=20=EC=97=B0=EB=B4=89=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Model/InputWorkInfoModel.swift | 11 ++++++++++- .../Sources/Model/InputWorkInfoModelProtocol.swift | 1 + .../Sources/Scene/InputWorkInfoView.swift | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift index 5706c0c0..fb88bacf 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModel.swift @@ -3,10 +3,19 @@ import FoundationUtil import StudentDomainInterface final class InputWorkInfoModel: ObservableObject, InputWorkInfoStateProtocol { + private let numberFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + return formatter + }() @Published var workRegionList: [String] = [""] @Published var salary: String = "" @Published var formOfEmployment: FormOfEmployment = .fullTime @Published var isPresentedFormOfEmployeementSheet: Bool = false + var salaryDisplay: String { + guard !salary.isEmpty else { return "상관없음" } + return "\(numberFormatter.string(for: Int(salary)) ?? "0") 만원" + } } extension InputWorkInfoModel: InputWorkInfoActionProtocol { @@ -24,7 +33,7 @@ extension InputWorkInfoModel: InputWorkInfoActionProtocol { } func updateSalary(salary: String) { - self.salary = salary + self.salary = Int(salary).map { String(min($0, 9999)) } ?? salary } func updateFormOfEmployment(form: FormOfEmployment) { diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift index 3a23760d..8d6fbbd7 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Model/InputWorkInfoModelProtocol.swift @@ -4,6 +4,7 @@ import StudentDomainInterface protocol InputWorkInfoStateProtocol { var workRegionList: [String] { get } var salary: String { get } + var salaryDisplay: String { get } var formOfEmployment: FormOfEmployment { get } var isPresentedFormOfEmployeementSheet: Bool { get } } diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift index 3d233cad..1ab8b025 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Scene/InputWorkInfoView.swift @@ -41,7 +41,7 @@ struct InputWorkInfoView: View { intent.formOfEmployeementSheetIsRequired() } - VStack(alignment: .leading, spacing: 8) { + VStack(alignment: .leading, spacing: 4) { SMSTextField( "희망 연봉 (10,000원 단위)", text: Binding( @@ -50,8 +50,8 @@ struct InputWorkInfoView: View { ) ) - SMSText("\(state.salary)만원", font: .caption1) - .foregroundColor(.sms(.neutral(.n30))) + Text(state.salaryDisplay) + .smsFont(.caption1, color: .neutral(.n30)) } .titleWrapper("희망 연봉") From af0f7f508b3abaaaf285688f6e668583a356df57 Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 23 May 2023 09:33:07 +0900 Subject: [PATCH 4/6] =?UTF-8?q?:sparkles:=20::=20=EA=B7=BC=EB=AC=B4=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=A0=95=EB=B3=B4=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=ED=9B=84=20InputInformation=EC=97=90=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Intent/InputInformationIntent.swift | 3 ++- .../Sources/Model/InputInformationModel.swift | 10 ++++++++-- .../Model/InputInformationModelProtocol.swift | 3 +++ .../Interface/InputWorkDelegate.swift | 14 +++++++++++++- .../Sources/Intent/InputWorkInfoIntent.swift | 9 +++++++-- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift index c1ba9810..eb0d06fb 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift @@ -36,7 +36,8 @@ extension InputInformationIntent: InputWorkDelegate { model?.prevButtonDidTap() } - func completeToInputWork() { + func completeToInputWork(input: InputWorkInformationObject) { + model?.updateInputWorkInformationObject(object: input) model?.nextButtonDidTap() } } diff --git a/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModel.swift b/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModel.swift index b5ee30e0..3a5d0098 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModel.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModel.swift @@ -1,11 +1,13 @@ import Foundation import InputProfileInfoFeatureInterface import InputSchoolLifeInfoFeatureInterface +import InputWorkInfoFeatureInterface final class InputInformationModel: ObservableObject, InputInformationStateProtocol { @Published var phase: InformationPhase = .profile - @Published var inputProfileInformationObject: InputProfileInformationObject? - @Published var inputSchoolLifeInformationObject: InputSchoolLifeInformationObject? + var inputProfileInformationObject: InputProfileInformationObject? + var inputSchoolLifeInformationObject: InputSchoolLifeInformationObject? + var inputWorkInfomationObject: InputWorkInformationObject? } extension InputInformationModel: InputInformationActionProtocol { @@ -30,4 +32,8 @@ extension InputInformationModel: InputInformationActionProtocol { func updateInputSchoolLifeInformationObject(object: InputSchoolLifeInformationObject) { self.inputSchoolLifeInformationObject = object } + + func updateInputWorkInformationObject(object: InputWorkInformationObject) { + self.inputWorkInfomationObject = object + } } diff --git a/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModelProtocol.swift b/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModelProtocol.swift index c7db89a3..22a23897 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModelProtocol.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Model/InputInformationModelProtocol.swift @@ -1,6 +1,7 @@ import Foundation import InputProfileInfoFeatureInterface import InputSchoolLifeInfoFeatureInterface +import InputWorkInfoFeatureInterface enum InformationPhase: CaseIterable { case profile @@ -15,6 +16,7 @@ protocol InputInformationStateProtocol { var phase: InformationPhase { get } var inputProfileInformationObject: InputProfileInformationObject? { get } var inputSchoolLifeInformationObject: InputSchoolLifeInformationObject? { get } + var inputWorkInfomationObject: InputWorkInformationObject? { get } } protocol InputInformationActionProtocol: AnyObject { @@ -22,4 +24,5 @@ protocol InputInformationActionProtocol: AnyObject { func nextButtonDidTap() func updateInputProfileInformationObject(object: InputProfileInformationObject) func updateInputSchoolLifeInformationObject(object: InputSchoolLifeInformationObject) + func updateInputWorkInformationObject(object: InputWorkInformationObject) } diff --git a/Projects/Feature/InputWorkInfoFeature/Interface/InputWorkDelegate.swift b/Projects/Feature/InputWorkInfoFeature/Interface/InputWorkDelegate.swift index b095fe96..c249abf3 100644 --- a/Projects/Feature/InputWorkInfoFeature/Interface/InputWorkDelegate.swift +++ b/Projects/Feature/InputWorkInfoFeature/Interface/InputWorkDelegate.swift @@ -1,4 +1,16 @@ public protocol InputWorkDelegate: AnyObject { func workPrevButtonDidTap() - func completeToInputWork() + func completeToInputWork(input: InputWorkInformationObject) +} + +public struct InputWorkInformationObject { + public let formOfEmployment: String + public let salary: Int + public let workRegion: [String] + + public init(formOfEmployment: String, salary: Int, workRegion: [String]) { + self.formOfEmployment = formOfEmployment + self.salary = salary + self.workRegion = workRegion + } } diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift index 58c7e271..0962b9c5 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift @@ -47,7 +47,12 @@ final class InputWorkInfoIntent: InputWorkInfoIntentProtocol { } func nextButtonDidTap(state: any InputWorkInfoStateProtocol) { - - inputWorkDelegate?.completeToInputWork() + let input = InputWorkInfoObject( + formOfEmployment: state.formOfEmployment.rawValue, + salary: Int(state.salary) ?? 0, + workRegion: state.workRegionList + .filter { !$0.isEmpty } + ) + inputWorkDelegate?.completeToInputWork(input: input) } } From 2a5ead95334b510dd12b51e399f3aadaf55ecf64 Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 23 May 2023 09:49:01 +0900 Subject: [PATCH 5/6] :pencil2: :: InputWorkInfoObject -> InputWorkInformationObject --- .../Sources/Intent/InputWorkInfoIntent.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift index 0962b9c5..81c9df7e 100644 --- a/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift +++ b/Projects/Feature/InputWorkInfoFeature/Sources/Intent/InputWorkInfoIntent.swift @@ -47,7 +47,7 @@ final class InputWorkInfoIntent: InputWorkInfoIntentProtocol { } func nextButtonDidTap(state: any InputWorkInfoStateProtocol) { - let input = InputWorkInfoObject( + let input = InputWorkInformationObject( formOfEmployment: state.formOfEmployment.rawValue, salary: Int(state.salary) ?? 0, workRegion: state.workRegionList From 58fa5a86bdaad479fe2a4effc075057d07ac2410 Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 23 May 2023 10:28:26 +0900 Subject: [PATCH 6/6] :pencil2: :: Scroe -> Score --- .../Tests/InputSchoolLifeInfoFeatureTest.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Projects/Feature/InputSchoolLifeInfoFeature/Tests/InputSchoolLifeInfoFeatureTest.swift b/Projects/Feature/InputSchoolLifeInfoFeature/Tests/InputSchoolLifeInfoFeatureTest.swift index 173bb517..f54d4333 100644 --- a/Projects/Feature/InputSchoolLifeInfoFeature/Tests/InputSchoolLifeInfoFeatureTest.swift +++ b/Projects/Feature/InputSchoolLifeInfoFeature/Tests/InputSchoolLifeInfoFeatureTest.swift @@ -26,20 +26,20 @@ final class InputSchoolLifeInfoFeatureTests: XCTestCase { func test_update_authentication_score() { sut.intent.updateAuthenticationScore(score: "2") - XCTAssertEqual(sut.model.authenticationScroe, "2") + XCTAssertEqual(sut.model.authenticationScore, "2") sut.intent.updateAuthenticationScore(score: "123") - XCTAssertEqual(sut.model.authenticationScroe, "123") + XCTAssertEqual(sut.model.authenticationScore, "123") sut.intent.updateAuthenticationScore(score: "ASDF") - XCTAssertNotEqual(sut.model.authenticationScroe, "ASDF") + XCTAssertNotEqual(sut.model.authenticationScore, "ASDF") sut.intent.updateAuthenticationScore(score: "CXZ") - XCTAssertNotEqual(sut.model.authenticationScroe, "CXZ") + XCTAssertNotEqual(sut.model.authenticationScore, "CXZ") let randomScore = Int.random(in: 0...100) sut.intent.updateAuthenticationScore(score: "\(randomScore)") - XCTAssertEqual(sut.model.authenticationScroe, "\(randomScore)") + XCTAssertEqual(sut.model.authenticationScore, "\(randomScore)") } func test_file_importer_sheet() {