diff --git a/TnT/Projects/Presentation/Sources/AddDietRecord/TraineeAddDietRecordFeature.swift b/TnT/Projects/Presentation/Sources/AddDietRecord/TraineeAddDietRecordFeature.swift index 91e80b45..6da5147f 100644 --- a/TnT/Projects/Presentation/Sources/AddDietRecord/TraineeAddDietRecordFeature.swift +++ b/TnT/Projects/Presentation/Sources/AddDietRecord/TraineeAddDietRecordFeature.swift @@ -93,6 +93,8 @@ public struct TraineeAddDietRecordFeature { case api(APIAction) /// 선택된 이미지 데이터 저장 case imagePicked(Data?) + /// 팝업 상태 설정 + case setPopUp(PopUp?) /// 네비게이션 여부 설정 case setNavigating @@ -239,13 +241,16 @@ public struct TraineeAddDietRecordFeature { ), imgData: state.dietImageData ) - await send(.setNavigating) + await send(.setPopUp(.dietAdded)) } } case .imagePicked(let imgData): state.dietImageData = imgData return self.validateAllFields(&state) + + case .setPopUp(let popUp): + return setPopUpStatus(&state, status: popUp) case .setNavigating: return .none diff --git a/TnT/Projects/Presentation/Sources/AddPTSession/TrainerAddPTSessionFeature.swift b/TnT/Projects/Presentation/Sources/AddPTSession/TrainerAddPTSessionFeature.swift index 78bd5866..9c25568f 100644 --- a/TnT/Projects/Presentation/Sources/AddPTSession/TrainerAddPTSessionFeature.swift +++ b/TnT/Projects/Presentation/Sources/AddPTSession/TrainerAddPTSessionFeature.swift @@ -104,6 +104,8 @@ public struct TrainerAddPTSessionFeature { case api(APIAction) /// 현재 관리 회원 목록 설정 case setTraineeList([TraineeListItemEntity]) + /// 팝업 상태 설정 + case setPopUp(PopUp?) /// 네비게이션 여부 설정 case setNavigating @@ -273,7 +275,7 @@ public struct TrainerAddPTSessionFeature { traineeId: traineeId ) ) - await send(.setNavigating) + await send(.setPopUp(.sessionAdded)) } catch { NotificationCenter.default.post(toast: .init(presentType: .text("⚠"), message: "이미 예약된 시간대입니다")) } @@ -284,6 +286,9 @@ public struct TrainerAddPTSessionFeature { state.traineeList = trainees return .none + case .setPopUp(let popUp): + return setPopUpStatus(&state, status: popUp) + case .setNavigating: return .none } diff --git a/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeFeature.swift b/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeFeature.swift index 887c2ac6..489dd757 100644 --- a/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeFeature.swift +++ b/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeFeature.swift @@ -20,6 +20,8 @@ public struct TrainerHomeFeature { // MARK: Data related state /// 3일 동안 보지 않기 시작 날짜 @Shared(.appStorage(AppStorage.hideHomePopupUntil)) var hidePopupUntil: Date? + /// 트레이너 연결 여부 + @Shared(.appStorage(AppStorage.isConnected)) var isConnected: Bool = false /// 선택된 날짜 var selectedDate: Date /// 캘린더 이벤트 @@ -34,8 +36,6 @@ public struct TrainerHomeFeature { var tappedsessionInfo: GetDateSessionListEntity? /// 3일 동안 보지 않기 선택되었는지 여부 var isHideUntilSelected: Bool - /// 트레이니 연결 여부 - var isConnected: Bool /// 팝업 관련 Flag var popUpFlag: Bool @@ -56,7 +56,6 @@ public struct TrainerHomeFeature { sessionInfo: WorkoutListItemEntity? = nil, records: [RecordListItemEntity] = [], isHideUntilSelected: Bool = false, - isConnected: Bool = false, view_currentPage: Date = .now, tappedsessionInfo: GetDateSessionListEntity? = nil, view_isPopUpPresented: Bool = false, @@ -68,7 +67,6 @@ public struct TrainerHomeFeature { self.sessionInfo = sessionInfo self.records = records self.isHideUntilSelected = isHideUntilSelected - self.isConnected = isConnected self.view_currentPage = view_currentPage self.tappedsessionInfo = tappedsessionInfo self.view_isPopUpPresented = view_isPopUpPresented @@ -193,12 +191,17 @@ public struct TrainerHomeFeature { let year: Int = Calendar.current.component(.year, from: state.selectedDate) let month: Int = Calendar.current.component(.month, from: state.selectedDate) - if let hideUntil = state.hidePopupUntil, hideUntil > Date() { - state.view_isPopUpPresented = false - } else { - state.popUpFlag = true - state.view_isPopUpPresented = true - } + let hideUntil = state.hidePopupUntil ?? Date() + let hidePopUp = state.isConnected || hideUntil > Date() + state.view_isPopUpPresented = !hidePopUp + state.popUpFlag = !hidePopUp + +// if let hideUntil = state.hidePopupUntil, hideUntil > Date() { +// state.view_isPopUpPresented = false +// } else { +// state.popUpFlag = true +// state.view_isPopUpPresented = true +// } return .concatenate( .send(.view(.fetchMonthlyLessons(year: month == 1 ? year-1 : year, month: month == 1 ? 12 : month-1))), diff --git a/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeView.swift b/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeView.swift index ea32db4c..331effd5 100644 --- a/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeView.swift +++ b/TnT/Projects/Presentation/Sources/Home/Trainer/TrainerHomeView.swift @@ -238,6 +238,7 @@ extension TrainerHomeView { /// 수업 완료 버튼 탭 onTapComplete() } + .disabled(session.isCompleted) VStack(spacing: 12) { HStack(spacing: 4) { @@ -256,7 +257,8 @@ extension TrainerHomeView { .frame(maxWidth: .infinity, alignment: .leading) } - if session.isCompleted { + if false { +// if session.isCompleted { Button { onTap?() } label: {