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

πŸ”€ :: [#290] μ§œμž˜ν•œ 버그 μˆ˜μ • #295

Merged
merged 3 commits into from
Sep 5, 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
2 changes: 1 addition & 1 deletion Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi

#if !NEEDLE_DYNAMIC

@inline(never) private func register1() {
private func register1() {
registerProviderFactory("^->AppComponent->JwtStoreComponent", factoryb27d5aae1eb7e73575a6f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent", factoryEmptyDependencyProvider)
registerProviderFactory("^->AppComponent->KeychainComponent", factoryEmptyDependencyProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ extension InputWorkInfoModel: InputWorkInfoActionProtocol {
}

func updateSalary(salary: String) {
guard salary.isNotEmpty else {
self.salary = ""
return
}
guard let salaryInt = Int(salary).map({ String(min($0, 9999)) }) else { return }
self.salary = salaryInt
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ final class MyPageIntent: MyPageIntentProtocol {
model?.updateIsPresentedWithdrawalDialog(isPresented: false)
}

func modifyToInputAllInfo(state: any MyPageStateProtocol) {
func modifyToInputAllInfo(
state: any MyPageStateProtocol,
completion: @escaping () -> Void
) {
model?.updateIsLoading(isLoading: true)

guard self.validateProfile(
Expand Down Expand Up @@ -163,13 +166,13 @@ final class MyPageIntent: MyPageIntentProtocol {
techStacks: state.techStacks,
projects: state.projectList.map {
let startAtString = $0.startAt.toStringCustomFormat(format: "yyyy.MM")
let endAtString = $0.endAt?.toStringCustomFormat(format: "yyyy.MM") ?? "κ°œλ°œμ€‘"
let endAtString = $0.endAt?.toStringCustomFormat(format: "yyyy.MM")

return $0.toDTO(
iconURL: $0.iconImage,
previewImageURLS: $0.previewImages,
startAt: startAtString,
endAt: endAtString
endAt: $0.isInProgress ? nil : endAtString
)
},
prizes: state.prizeList.map { $0.toDTO() }
Expand All @@ -178,6 +181,7 @@ final class MyPageIntent: MyPageIntentProtocol {
try await modifyInformationUseCase.execute(req: modifyInformationRequest)
model?.updateIsLoading(isLoading: false)
model?.updateIsCompleteModify(isComplete: true)
completion()
myPageDelegate?.completeModify()
} catch {
model?.updateIsError(isError: true)
Expand Down Expand Up @@ -215,7 +219,7 @@ extension ProjectModel {
iconURL: String,
previewImageURLS: [String],
startAt: String,
endAt: String
endAt: String?
) -> ModifyStudentInformationRequestDTO.Project {
ModifyStudentInformationRequestDTO.Project(
name: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ protocol MyPageIntentProtocol:
func withdrawalDialogIsRequired()
func withdrawalDialogDismissed()
func withdrawalDialogIsComplete()
func modifyToInputAllInfo(state: MyPageStateProtocol)
func modifyToInputAllInfo(
state: MyPageStateProtocol,
completion: @escaping () -> Void
)
func modifyCompleteToastDismissed()
}
11 changes: 10 additions & 1 deletion Projects/Feature/MyPageFeature/Sources/Model/MyPageModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Foundation
import StudentDomainInterface
import FoundationUtil

final class MyPageModel: ObservableObject, MyPageStateProtocol {
// MARK: MyPage
Expand Down Expand Up @@ -30,11 +31,19 @@ final class MyPageModel: ObservableObject, MyPageStateProtocol {
@Published var gsmScore: String = ""

// MARK: WorkInfo
private let numberFormatter: NumberFormatter = {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
return formatter
}()
@Published var workRegionList: [String] = []
@Published var salary: String = ""
@Published var salaryDisplay: String = ""
@Published var formOfEmployment: FormOfEmployment = .fullTime
@Published var isPresentedFormOfEmployeementSheet: Bool = false
var salaryDisplay: String {
guard salary.isNotEmpty else { return "μƒκ΄€μ—†μŒ" }
return "\(numberFormatter.string(for: Int(salary)) ?? "0") λ§Œμ›"
}

// MARK: Military
@Published var selectedMilitaryServiceType: MilitaryServiceType = .hope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import StudentDomainInterface
protocol MyPageWorkInfoStateProtocol {
var workRegionList: [String] { get }
var salary: String { get }
var salaryDisplay: String { get }
var formOfEmployment: FormOfEmployment { get }
var isPresentedFormOfEmployeementSheet: Bool { get }
}
Expand Down Expand Up @@ -37,8 +38,12 @@ extension MyPageModel: MyPageWorkInfoActionProtocol {
}

func updateSalary(salary: String) {
guard salary.isNotEmpty else {
self.salary = ""
return
}
guard let salaryInt = Int(salary).map({ String(min($0, 9999)) }) else { return }
self.salary = salaryInt == "0" ? "μƒκ΄€μ—†μŒ" : "\(salaryInt)λ§Œμ›"
self.salary = salaryInt
}

func updateFormOfEmployment(form: FormOfEmployment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private extension MyPageProjectView {
if let image = image.image {
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 132, height: 132)
.cornerRadius(8)
.overlay(alignment: .topTrailing) {
Expand Down Expand Up @@ -285,7 +286,7 @@ private extension MyPageProjectView {

@ViewBuilder
func projectTechStack(geometry: GeometryProxy, index: Int) -> some View {
VStack(spacing: 8) {
VStack(alignment: .leading, spacing: 8) {
HStack(spacing: 8) {
SMSIcon(.magnifyingglass)

Expand Down Expand Up @@ -339,7 +340,7 @@ private extension MyPageProjectView {

@ViewBuilder
func projectDuration(index: Int) -> some View {
VStack(spacing: 8) {
VStack(alignment: .leading, spacing: 8) {
HStack(spacing: 8) {
let project = state.projectList[safe: index]
DatePickerField(dateText: project?.startAtString ?? "") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import DesignSystem
import SwiftUI
import BaseFeature

struct MyPageSchoolLifeView: View {
let intent: MyPageSchoolLifeIntentProtocol
let state: MyPageSchoolLifeStateProtocol
@StateObject var container: MVIContainer<MyPageSchoolLifeIntentProtocol, MyPageSchoolLifeStateProtocol>
var intent: MyPageSchoolLifeIntentProtocol { container.intent }
var state: MyPageSchoolLifeStateProtocol { container.model }

init(container: MVIContainer<MyPageSchoolLifeIntentProtocol, MyPageSchoolLifeStateProtocol>) {
self._container = StateObject(wrappedValue: container)
}

var body: some View {
Section {
Expand Down
15 changes: 12 additions & 3 deletions Projects/Feature/MyPageFeature/Sources/Scene/MyPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ struct MyPageView: View {
myPageView(geometry: geometry)

CTAButton(text: "μ €μž₯") {
intent.modifyToInputAllInfo(state: state)
dismiss()
intent.modifyToInputAllInfo(state: state) {
DispatchQueue.main.async {
dismiss()
}
}
}
.padding(.horizontal, 20)
.padding(.bottom, safeAreaInsets.bottom + 16)
Expand Down Expand Up @@ -317,7 +320,13 @@ struct MyPageView: View {
SMSSeparator()
.padding(.vertical, 16)

MyPageSchoolLifeView(intent: intent, state: state)
MyPageSchoolLifeView(
container: .init(
intent: intent,
model: state,
modelChangePublisher: container.objectWillChange
)
)

SMSSeparator()
.padding(.vertical, 16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,21 @@ struct MyPageWorkInfoView: View {
intent.formOfEmployeementSheetIsRequired()
}

SMSTextField(
"희망 연봉 (10,000원 λ‹¨μœ„)",
text: Binding(
get: { state.salary },
set: intent.updateSalary(salary:)
VStack(alignment: .leading, spacing: 4) {
SMSTextField(
"희망 연봉 (10,000원 λ‹¨μœ„)",
text: Binding(
get: {
state.salary
},
set: intent.updateSalary(salary:)
)
)
)
.keyboardType(.numberPad)
.keyboardType(.numberPad)

Text(state.salaryDisplay)
.smsFont(.caption1, color: .neutral(.n30))
}
.titleWrapper("희망 연봉")

workRegionList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct StudentDetailView: View {
LazyImage(url: URL(string: studentDetail.profileImageURL)) { state in
if let image = state.image {
image.resizable()
.aspectRatio(contentMode: .fill)
.aspectRatio(1, contentMode: .fit)
} else {
SMSIcon(.profile, width: nil, height: nil)
}
Expand Down Expand Up @@ -303,7 +303,7 @@ struct StudentDetailView: View {
Spacer()

SMSText(value, font: .body2)
.lineLimit(nil)
.lineLimit(1)
.foregroundColor(.sms(.neutral(.n40)))
.frame(maxWidth: .infinity, alignment: .leading)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct ProjectRowView: View {
if let image = phase.image {
image
.resizable()
.aspectRatio(1, contentMode: .fit)
.scaledToFit()
.cornerRadius(8)
} else {
Color.sms(.neutral(.n30))
Expand Down Expand Up @@ -136,6 +136,7 @@ struct ProjectRowView: View {

SMSText(link.url, font: .caption2)
.foregroundColor(.sms(.neutral(.n40)))
.lineLimit(1)
}

Spacer()
Expand Down
1 change: 0 additions & 1 deletion Projects/Shared/Validator/Sources/URLValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Foundation
public struct URLValidator: Validator {
private let regexValidator = RegexValidator(
pattern: "https?:\\/\\/.*"

)

public init() {}
Expand Down