Skip to content

Commit

Permalink
Merge pull request #360 from School-of-Company/359-add-not-applicable…
Browse files Browse the repository at this point in the history
…-lecture-semester

🔀 :: [#359] 강의 학기 변경사항 적용
  • Loading branch information
uuuunseo authored Jul 11, 2024
2 parents 0789003 + 2c5af25 commit b0b88a8
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"size" : "83.5x83.5"
},
{
"filename" : "비빅.png",
"filename" : "BitgouelIcon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class InputLectureViewModel: BaseViewModel {
endDate: Date(),
lectureDates: [],
lectureType: "상호학점인정교육과정",
credit: 1,
credit: 0,
maxRegisteredUser: 0
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ struct SemesterBottomSheet: View {
ScrollView {
LazyVStack {
ForEach(semesterList, id: \.self) { semester in
semesterListRow(
semester: semester.display(),
isSelected: Binding(
get: { semester.rawValue == selectedSemester.rawValue },
set: { _ in semesterDidSelect(semester) }
if semester == .notApplicable {
EmptyView()
} else {
semesterListRow(
semester: semester.display(),
isSelected: Binding(
get: { semester.rawValue == selectedSemester.rawValue },
set: { _ in semesterDidSelect(semester) }
)
)
)
.onTapGesture {
semesterDidSelect(semester)
.onTapGesture {
semesterDidSelect(semester)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import SwiftUI
struct PickerTextField: View {
var placeholder: String
var text: String
var backgroundColor: Color
var action: () -> Void

init(
_ placeholder: String,
text: String,
backgroundColor: Color = .clear,
action: @escaping () -> Void
) {
self.placeholder = placeholder
self.text = text
self.backgroundColor = backgroundColor
self.action = action
}

Expand Down Expand Up @@ -40,6 +43,7 @@ struct PickerTextField: View {
.padding(.vertical, 16)
}
}
.background(backgroundColor)
.buttonWrapper(action)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct TypeSelectedButton: View {
font: .text1
)
.foregroundColor(isSelected ? Color.bitgouel(.greyscale(.g10)) : Color.bitgouel(.greyscale(.g4)))
.padding(.horizontal, 16)
.padding(.horizontal, 24)
.padding(.vertical, 8)
.overlay {
RoundedRectangle(cornerRadius: 99)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import SwiftUI

struct CreditView: View {
let creditValue: [Int] = [1, 2]
@Binding var selectedCredit: Int
let onSelectedCrdit: (Int) -> Void

Expand All @@ -12,16 +11,16 @@ struct CreditView: View {
font: .text1
)

HStack(spacing: 16) {
ForEach(creditValue, id: \.self) { credit in
TypeSelectedButton(
text: "\(credit)",
isSelected: Binding(
get: { credit == selectedCredit },
set: { _ in onSelectedCrdit(credit) }
)
)
}
TextField(
"학점 입력",
value: $selectedCredit,
formatter: NumberFormatter()
)
.padding(.horizontal, 20)
.padding(.vertical, 16)
.overlay {
RoundedRectangle(cornerRadius: 8)
.strokeBorder(Color.bitgouel(.greyscale(.g7)))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ struct SemesterView: View {

PickerTextField(
"학기 선택",
text: selectedSemester.display()
) {
if isShowingSemesterBottomSheet {
onSelectSemester(false)
} else {
onSelectSemester(true)
text: selectedSemester.display(),
backgroundColor: selectedSemester == .notApplicable ? Color.bitgouel(.greyscale(.g8)) : .clear,
action: {
guard selectedSemester != .notApplicable else { return }

if isShowingSemesterBottomSheet {
onSelectSemester(false)
} else {
onSelectSemester(true)
}
}
}
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ struct LectureDetailSettingView: View {

ScrollView(showsIndicators: false) {
VStack(alignment: .leading, spacing: 28) {
SelectEssentialView(isEssential: $viewModel.isEssential) { isEssential in
viewModel.updateIsEssential(isEssential: isEssential)
}

SemesterView(
selectedSemester: viewModel.selectedSemester
) { isShowing in
viewModel.updateIsShowingSemesterBottomSheet(isShowing: isShowing)
}

LectureTypeView(
selectedLectureType: viewModel.selectedLectureType,
selectedLectureTypeString: viewModel.lectureTypeString
) { isShowing in
viewModel.updateIsShowingLectureTypeBottomSheet(isShowing: isShowing)
} onChangeSelectedLectureType: { lectureType in
viewModel.updateLectureTypeString(lectureType: lectureType)
viewModel.updateLectureType(lectureType: lectureType)
}

SemesterView(
selectedSemester: viewModel.selectedSemester
) { isShowing in
viewModel.updateIsShowingSemesterBottomSheet(isShowing: isShowing)
}

DivisionView(
Expand Down Expand Up @@ -109,13 +105,17 @@ struct LectureDetailSettingView: View {
viewModel.deleteLectureDate(at: index)
}

CreditView(selectedCredit: $viewModel.selectedCredit) { credit in
viewModel.updateCredit(credit: credit)
if viewModel.selectedLectureType == .mutualCreditRecognitionProgram {
creditView()
}

MaxRegisteredUserView(maxRegisteredUser: $viewModel.selectedMaxRegisteredUser) { maxRegisterUser in
viewModel.updateMaxRegisterUser(maxRegisterUser: maxRegisterUser)
}

SelectEssentialView(isEssential: $viewModel.isEssential) { isEssential in
viewModel.updateIsEssential(isEssential: isEssential)
}
}
.padding(.bottom, 24)
}
Expand Down Expand Up @@ -174,8 +174,7 @@ struct LectureDetailSettingView: View {
LectureTypeBottomSheet(
selectedLectureType: viewModel.selectedLectureType
) { lectureType in
viewModel.updateSelectedLectureType(lectureType: lectureType)
viewModel.updateLectureTypeString(lectureType: lectureType.rawValue)
viewModel.updateLectureType(lectureType: lectureType.rawValue)
}
}
.bitgouelBottomSheet(isShowing: $viewModel.isShowingDivisionBottomSheet) {
Expand Down Expand Up @@ -222,4 +221,11 @@ struct LectureDetailSettingView: View {
hideKeyboard()
}
}

@ViewBuilder
func creditView() -> some View {
CreditView(selectedCredit: $viewModel.selectedCredit) { credit in
viewModel.updateCredit(credit: credit)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class LectureDetailSettingViewModel: BaseViewModel {
@Published var selectedDivision: String = ""

// MARK: credit
@Published var selectedCredit: Int = 1
@Published var selectedCredit: Int = 0

// MARK: Line
@Published var isShowingLineBottomSheet: Bool = false
Expand Down Expand Up @@ -94,29 +94,29 @@ final class LectureDetailSettingViewModel: BaseViewModel {
selectedLectureType = lectureType
}

func updateLectureTypeString(lectureType: String) {
func updateLectureType(lectureType: String) {
lectureTypeString = lectureType
}

func updateLectureType(lectureType: String) {
switch lectureType {
case "상호학점인정교육과정":
if selectedSemester == .notApplicable { updateSemester(semester: .firstYearFallSemester) }
updateSelectedLectureType(lectureType: .mutualCreditRecognitionProgram)

case "대학탐방프로그램":
updateSelectedLectureType(lectureType: .universityExplorationProgram)
updateSemester(semester: .notApplicable)

case "유관기관프로그램":
if selectedSemester == .notApplicable { updateSemester(semester: .firstYearFallSemester) }
updateSelectedLectureType(lectureType: .governmentProgram)

case "기업산학연계직업체험프로그램":
if selectedSemester == .notApplicable { updateSemester(semester: .firstYearFallSemester) }
updateSelectedLectureType(lectureType: .companyIndustryLinkingJobExperienceProgram)

default:
updateSelectedLectureType(lectureType: .etc)
}

updateLectureTypeString(lectureType: lectureType)
}

func updateIsShowingLectureTypeBottomSheet(isShowing: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public extension ProjectDescription.Path {
static func relativeToXCConfig(type: ProjectDeployTarget, name: String) -> Self {
return .relativeToRoot("XCConfig/\(name)/\(type.rawValue).xcconfig")
}

static var shared: Self {
return .relativeToRoot("XCConfig/Shared.xcconfig")
}
Expand Down
22 changes: 11 additions & 11 deletions Service/Project.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import EnvironmentPlugin
import ProjectDescription
import ProjectDescriptionHelpers
import EnvironmentPlugin

let configurations: [Configuration] = generateEnvironment == .ci ?
[
.debug(name: .dev),
.debug(name: .stage),
.release(name: .prod)
] :
[
.debug(name: .dev, xcconfig: .relativeToXCConfig(type: .dev, name: "Service")),
.debug(name: .stage, xcconfig: .relativeToXCConfig(type: .stage, name: "Service")),
.release(name: .prod, xcconfig: .relativeToXCConfig(type: .prod, name: "Service"))
]
[
.debug(name: .dev),
.debug(name: .stage),
.release(name: .prod)
] :
[
.debug(name: .dev, xcconfig: .relativeToXCConfig(type: .dev, name: "Service")),
.debug(name: .stage, xcconfig: .relativeToXCConfig(type: .stage, name: "Service")),
.release(name: .prod, xcconfig: .relativeToXCConfig(type: .prod, name: "Service"))
]

let project = Project.dynamicFramwork(
name: "Service",
Expand Down
2 changes: 2 additions & 0 deletions Service/Sources/Base/Enum/SemesterType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public enum SemesterType: String, CaseIterable, Decodable, Encodable {
case secondYearSpringSemester = "SECOND_YEAR_SPRING_SEMESTER"
case secondYearFallSemester = "SECOND_YEAR_FALL_SEMESTER"
case thirdYearSpringSemester = "THIRD_YEAR_SPRING_SEMESTER"
case notApplicable = "NOT_APPLICABLE"
}

public extension SemesterType {
Expand All @@ -14,6 +15,7 @@ public extension SemesterType {
case .secondYearSpringSemester: return "2학년 1학기"
case .secondYearFallSemester: return "2학년 2학기"
case .thirdYearSpringSemester: return "3학년 1학기"
case .notApplicable: return "해당사항 없음"
}
}
}
4 changes: 2 additions & 2 deletions ThirdPartyLib/Project.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ProjectDescription
import ProjectDescriptionHelpers
import DependencyPlugin
import EnvironmentPlugin
import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.dynamicFramwork(
name: "ThirdPartyLib",
Expand Down
2 changes: 1 addition & 1 deletion Tuist/Dependencies.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ProjectDescription
import ConfigurationPlugin
import ProjectDescription

let dependencies = Dependencies(
carthage: nil,
Expand Down
2 changes: 1 addition & 1 deletion Tuist/ProjectDescriptionHelpers/DynamicFramwork.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import EnvironmentPlugin
import Foundation
import ProjectDescription
import EnvironmentPlugin

let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? true : false

Expand Down
5 changes: 2 additions & 3 deletions Tuist/ProjectDescriptionHelpers/Executable.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ProjectDescription
import EnvironmentPlugin
import ProjectDescription

public extension Project {
static func executable(
Expand All @@ -18,7 +18,7 @@ public extension Project {
if configurations.isEmpty {
configurations = .default
}

var settings: Settings = .settings(
base: env.baseSetting,
configurations: configurations,
Expand Down Expand Up @@ -55,7 +55,6 @@ public extension Project {
)
]


return Project(
name: name,
organizationName: env.organizationName,
Expand Down

0 comments on commit b0b88a8

Please sign in to comment.