From f0ace5f34cd50326699ec4dad50fedc0d480343f Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Fri, 17 Mar 2023 17:25:10 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat=20::=20=EC=9E=90=EC=8A=B5=EC=8B=A4=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=20=EC=8B=9C=EA=B0=84=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?API=20=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 아직 서버 배포 안 돼서 401 뜨는데 주말 내로 dev 서버 배포 된답니다 --- .../StudyRooms/AppComponent+StudyRooms.swift | 6 ++ .../Sources/Application/NeedleGenerated.swift | 5 ++ .../StudyRoomListComponent.swift | 4 +- .../StudyRoomListView.swift | 9 +-- .../StudyRoomListViewModel.swift | 16 ++++- .../StudyroomTimeListCellView.swift | 49 +++++++++++++ .../StudyroomTimeListView.swift | 47 +++++++++++++ .../StudyroomTimeListView.swift | 69 ------------------- .../APIKit/Sources/StudyRoomsAPI.swift | 8 ++- .../FetchStudyRoomTimeListResponseDTO.swift | 13 ++++ .../Response/TimeSlotsResponseDTO.swift | 23 +++++++ .../Impl/StudyRoomsRepositoryImpl.swift | 4 ++ .../FetchStudyroomTimeListUseCaseImpl.swift | 16 +++++ .../Entities/StudyroomTimeListEntity.swift | 11 +++ .../Sources/Entities/TimeSlotsEntity.swift | 17 +++++ .../Repository/RemainsRepository.swift | 3 +- .../Repository/StudyRoomsRepository.swift | 1 + .../FetchStudyroomTimeListUseCase.swift | 7 ++ .../FetchStudyroomTimeListDataTransfer.swift | 20 ++++++ .../Impl/RemoteStudyRoomsDataSourceImpl.swift | 6 ++ .../Remote/RemoteStudyRoomsDataSource.swift | 1 + 21 files changed, 252 insertions(+), 83 deletions(-) create mode 100644 Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift create mode 100644 Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift delete mode 100644 Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeListView.swift create mode 100644 Projects/Services/DataMappingModule/Sources/StudyRooms/Response/FetchStudyRoomTimeListResponseDTO.swift create mode 100644 Projects/Services/DataMappingModule/Sources/StudyRooms/Response/TimeSlotsResponseDTO.swift create mode 100644 Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchStudyroomTimeListUseCaseImpl.swift create mode 100644 Projects/Services/DomainModule/Sources/Entities/StudyroomTimeListEntity.swift create mode 100644 Projects/Services/DomainModule/Sources/Entities/TimeSlotsEntity.swift create mode 100644 Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchStudyroomTimeListUseCase.swift create mode 100644 Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/DataTransfer/FetchStudyroomTimeListDataTransfer.swift diff --git a/Projects/App/Sources/Application/DI/StudyRooms/AppComponent+StudyRooms.swift b/Projects/App/Sources/Application/DI/StudyRooms/AppComponent+StudyRooms.swift index 9b81d419..f4b51844 100644 --- a/Projects/App/Sources/Application/DI/StudyRooms/AppComponent+StudyRooms.swift +++ b/Projects/App/Sources/Application/DI/StudyRooms/AppComponent+StudyRooms.swift @@ -39,4 +39,10 @@ public extension AppComponent { var fetchMyStudyRoomAppItemsUseCase: any FetchMyStudyRoomAppItemsUseCase { FetchMyStudyRoomAppItemsUseCaseImpl(studyRoomsRepository: studyRoomsRepository) } + + var fetchStudyroomTimeListUseCase: any FetchStudyroomTimeListUseCase { + shared { + FetchStudyroomTimeListUseCaseImpl(studyRoomsRepository: studyRoomsRepository) + } + } } diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index 4e5d6695..b92fc23b 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -320,6 +320,9 @@ private class StudyRoomListDependencyef56e26c25d5de596604Provider: StudyRoomList var fetchStudyAvailableTimeUseCase: any FetchStudyAvailableTimeUseCase { return appComponent.fetchStudyAvailableTimeUseCase } + var fetchStudyroomTimeListUseCase: any FetchStudyroomTimeListUseCase { + return appComponent.fetchStudyroomTimeListUseCase + } var studyRoomDetailComponent: StudyRoomDetailComponent { return appComponent.studyRoomDetailComponent } @@ -541,6 +544,7 @@ extension AppComponent: Registration { localTable["applyStudyRoomSeatUseCase-any ApplyStudyRoomSeatUseCase"] = { [unowned self] in self.applyStudyRoomSeatUseCase as Any } localTable["cancelStudyRoomSeatUseCase-any CancelStudyRoomSeatUseCase"] = { [unowned self] in self.cancelStudyRoomSeatUseCase as Any } localTable["fetchMyStudyRoomAppItemsUseCase-any FetchMyStudyRoomAppItemsUseCase"] = { [unowned self] in self.fetchMyStudyRoomAppItemsUseCase as Any } + localTable["fetchStudyroomTimeListUseCase-any FetchStudyroomTimeListUseCase"] = { [unowned self] in self.fetchStudyroomTimeListUseCase as Any } localTable["localAuthDataSource-any LocalAuthDataSource"] = { [unowned self] in self.localAuthDataSource as Any } localTable["remoteAuthDataSource-any RemoteAuthDataSource"] = { [unowned self] in self.remoteAuthDataSource as Any } localTable["authRepository-any AuthRepository"] = { [unowned self] in self.authRepository as Any } @@ -728,6 +732,7 @@ extension StudyRoomListComponent: Registration { public func registerItems() { keyPathToName[\StudyRoomListDependency.fetchStudyRoomListUseCase] = "fetchStudyRoomListUseCase-any FetchStudyRoomListUseCase" keyPathToName[\StudyRoomListDependency.fetchStudyAvailableTimeUseCase] = "fetchStudyAvailableTimeUseCase-any FetchStudyAvailableTimeUseCase" + keyPathToName[\StudyRoomListDependency.fetchStudyroomTimeListUseCase] = "fetchStudyroomTimeListUseCase-any FetchStudyroomTimeListUseCase" keyPathToName[\StudyRoomListDependency.studyRoomDetailComponent] = "studyRoomDetailComponent-StudyRoomDetailComponent" } } diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListComponent.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListComponent.swift index a180eda6..24431020 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListComponent.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListComponent.swift @@ -6,6 +6,7 @@ import NeedleFoundation public protocol StudyRoomListDependency: Dependency { var fetchStudyRoomListUseCase: any FetchStudyRoomListUseCase { get } var fetchStudyAvailableTimeUseCase: any FetchStudyAvailableTimeUseCase { get } + var fetchStudyroomTimeListUseCase: any FetchStudyroomTimeListUseCase { get } var studyRoomDetailComponent: StudyRoomDetailComponent { get } } @@ -14,7 +15,8 @@ public final class StudyRoomListComponent: Component { StudyRoomListView( viewModel: .init( fetchStudyRoomListUseCase: dependency.fetchStudyRoomListUseCase, - fetchStudyAvailableTimeUseCase: dependency.fetchStudyAvailableTimeUseCase + fetchStudyAvailableTimeUseCase: dependency.fetchStudyAvailableTimeUseCase, + fetchStudyroomTimeListUseCase: dependency.fetchStudyroomTimeListUseCase ), studyRoomDetailComponent: dependency.studyRoomDetailComponent ) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListView.swift index f20a64b1..16561103 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListView.swift @@ -77,14 +77,7 @@ struct StudyRoomListView: View { sheetCornerRadiusValue: 8 ) { DeferView { - StudyroomTimeListView( - isClicked: false, - okButtonAction: { - withAnimation { - viewModel.isStudyTimeBottomSheet = false - } - } - ) + StudyroomTimeListView(viewModel: viewModel) } } .dmsToast(isShowing: $viewModel.isErrorOcuured, message: viewModel.errorMessage, style: .error) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift index 87dbd2bd..f6bf49ab 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift @@ -10,9 +10,12 @@ final class StudyRoomListViewModel: BaseViewModel { @Published var isStudyRoomTime = true @Published var isShowingToast = false @Published var toastMessage = "" + @Published var studyAvailableTime: StudyAvailableTimeEntity? @Published var isNavigateDetail: Bool = false @Published var isStudyTimeBottomSheet: Bool = false + @Published var studyroomTimeList = StudyroomTimeListEntity(timeSlots: []) + @Published var selectedEntity: TimeSlotsEntity? @Published var studyRoomDetail: StudyRoomEntity = .init( id: "", floor: 0, @@ -36,13 +39,16 @@ final class StudyRoomListViewModel: BaseViewModel { private let fetchStudyRoomListUseCase: any FetchStudyRoomListUseCase private let fetchStudyAvailableTimeUseCase: any FetchStudyAvailableTimeUseCase + private let fetchStudyroomTimeListUseCase: any FetchStudyroomTimeListUseCase public init( fetchStudyRoomListUseCase: any FetchStudyRoomListUseCase, - fetchStudyAvailableTimeUseCase: any FetchStudyAvailableTimeUseCase + fetchStudyAvailableTimeUseCase: any FetchStudyAvailableTimeUseCase, + fetchStudyroomTimeListUseCase: any FetchStudyroomTimeListUseCase ) { self.fetchStudyRoomListUseCase = fetchStudyRoomListUseCase self.fetchStudyAvailableTimeUseCase = fetchStudyAvailableTimeUseCase + self.fetchStudyroomTimeListUseCase = fetchStudyroomTimeListUseCase super.init() } @@ -62,6 +68,14 @@ final class StudyRoomListViewModel: BaseViewModel { } } + func fetchStudyroomTimeList() { + addCancellable( + fetchStudyroomTimeListUseCase.execute() + ) { [weak self] studyroomTimeList in + self?.studyroomTimeList = studyroomTimeList + } + } + func onAppear() { fetchStudyRoomList() fetchStudyAvailableTime() diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift new file mode 100644 index 00000000..7fbbb6f9 --- /dev/null +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift @@ -0,0 +1,49 @@ +import DomainModule +import DesignSystem +import SwiftUI + +struct StudyroomTimeListCellView: View { + @State var isClicked: Bool = false + var list: TimeSlotsEntity + let buttonAction: () -> Void + public init( + isClicked: Bool, + list: TimeSlotsEntity, + buttonAction: @escaping () -> Void + ) { + self.isClicked = isClicked + self.list = list + self.buttonAction = buttonAction + } + + var body: some View { + HStack { + Button { + if !isClicked { + buttonAction() + } + } label: { + Text("\(list.startTime) ~ \(list.endTime)") + .padding(.horizontal, 16) + .padding(.vertical, 14) + .dmsFont( + .etc(.button), + color: isClicked ? .GrayScale.gray1 : .GrayScale.gray4 + ) + .background { + isClicked ? Color.PrimaryVariant.primary : Color.GrayScale.gray1 + } + } + .overlay( + RoundedRectangle(cornerRadius: 5) + .inset(by: 1) + .stroke( + isClicked ? Color.System.primary : Color.GrayScale.gray4, + lineWidth: 2 + ) + ) + .cornerRadius(5) + .padding(.horizontal, 5) + } + } +} diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift new file mode 100644 index 00000000..e781d27f --- /dev/null +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift @@ -0,0 +1,47 @@ +import DesignSystem +import DomainModule +import SwiftUI + +struct StudyroomTimeListView: View { + @StateObject var viewModel: StudyRoomListViewModel + + var body: some View { + VStack(alignment: .leading, spacing: 37) { + Text("시간") + .dmsFont(.title(.subTitle1), color: .GrayScale.gray10) + .frame(height: 28) + .padding(.top, 40) + .padding(.leading, 24) + + ScrollView(.horizontal, showsIndicators: false) { + LazyHStack { + ForEach(viewModel.studyroomTimeList.timeSlots, id: \.self) { timeSlots in + StudyroomTimeListCellView( + isClicked: timeSlots.id == viewModel.selectedEntity?.id, + list: timeSlots, + buttonAction: { + viewModel.selectedEntity = timeSlots + } + ) + } + } + .padding(.horizontal, 19) + .padding(.bottom, 10) + + DMSWideButton( + text: "확인", + style: .contained, + color: .PrimaryVariant.primary, + action: { + viewModel.isStudyTimeBottomSheet = false + } + ) + .padding(.horizontal, 24) + .padding(.bottom) + } + } + .onAppear { + viewModel.fetchStudyroomTimeList() + } + } +} diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeListView.swift deleted file mode 100644 index e85dcc99..00000000 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeListView.swift +++ /dev/null @@ -1,69 +0,0 @@ -import Foundation -import DesignSystem -import SwiftUI - -struct StudyroomTimeListView: View { - @State var isClicked: Bool = false - let okButtonAction: () -> Void - public init( - isClicked: Bool, - okButtonAction: @escaping () -> Void - ) { - self.isClicked = isClicked - self.okButtonAction = okButtonAction - } - - var body: some View { - VStack(alignment: .leading, spacing: 37) { - Text("시간") - .dmsFont(.title(.subTitle1), color: .GrayScale.gray10) - .frame(height: 28) - .padding(.top, 40) - .padding(.leading, 24) - - ScrollView(.horizontal, showsIndicators: false) { - LazyHStack { - ForEach(0..<5) { _ in - Button { - isClicked.toggle() - } label: { - Text("10시 ~ 11시") - .padding(.horizontal, 16) - .padding(.vertical, 14) - .dmsFont( - .etc(.button), - color: isClicked ? .GrayScale.gray1 : .GrayScale.gray4 - ) - .background { - isClicked ? Color.PrimaryVariant.primary : Color.GrayScale.gray1 - } - } - .overlay( - RoundedRectangle(cornerRadius: 5) - .inset(by: 1) - .stroke( - isClicked ? Color.System.primary : Color.GrayScale.gray4, - lineWidth: 2 - ) - ) - .cornerRadius(5) - .padding(.horizontal, 5) - } - } - } - .padding(.horizontal, 19) - .padding(.bottom, 10) - - DMSWideButton( - text: "확인", - style: .contained, - color: .PrimaryVariant.primary, - action: { - okButtonAction() - } - ) - .padding(.horizontal, 24) - .padding(.bottom) - } - } -} diff --git a/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift b/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift index 5ba53ad5..161fce00 100644 --- a/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift +++ b/Projects/Services/APIKit/Sources/StudyRoomsAPI.swift @@ -10,6 +10,7 @@ public enum StudyRoomsAPI { case fetchMyStudyRoomApplicationItems case applyStudyRoomSeat(seatID: String) case cancelStudyRoomSeat + case fetchStudyroomTimeList } extension StudyRoomsAPI: DmsAPI { @@ -39,13 +40,16 @@ extension StudyRoomsAPI: DmsAPI { case .fetchMyStudyRoomApplicationItems: return "/my" + case .fetchStudyroomTimeList: + return "/time-slots" } } public var method: Moya.Method { switch self { - case .fetchStudyAvailableTime, .fetchSeatTypes, - .fetchStudyRoomList, .fetchDetailStudyRoom, .fetchMyStudyRoomApplicationItems: + case .fetchStudyAvailableTime, .fetchSeatTypes, .fetchStudyRoomList, + .fetchDetailStudyRoom, .fetchMyStudyRoomApplicationItems, + .fetchStudyroomTimeList: return .get case .applyStudyRoomSeat: diff --git a/Projects/Services/DataMappingModule/Sources/StudyRooms/Response/FetchStudyRoomTimeListResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/StudyRooms/Response/FetchStudyRoomTimeListResponseDTO.swift new file mode 100644 index 00000000..91169b76 --- /dev/null +++ b/Projects/Services/DataMappingModule/Sources/StudyRooms/Response/FetchStudyRoomTimeListResponseDTO.swift @@ -0,0 +1,13 @@ +import Foundation + +public struct FetchStudyRoomTimeListResponseDTO: Decodable { + public init(timeSlots: [TimeSlotsResponseDTO]) { + self.timeSlots = timeSlots + } + + public let timeSlots: [TimeSlotsResponseDTO] + + enum CodingKeys: String, CodingKey { + case timeSlots = "time_slots" + } +} diff --git a/Projects/Services/DataMappingModule/Sources/StudyRooms/Response/TimeSlotsResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/StudyRooms/Response/TimeSlotsResponseDTO.swift new file mode 100644 index 00000000..7a3007cd --- /dev/null +++ b/Projects/Services/DataMappingModule/Sources/StudyRooms/Response/TimeSlotsResponseDTO.swift @@ -0,0 +1,23 @@ +import Foundation + +public struct TimeSlotsResponseDTO: Decodable { + public init( + id: String, + startTime: String, + endTime: String + ) { + self.id = id + self.startTime = startTime + self.endTime = endTime + } + + public let id: String + public let startTime: String + public let endTime: String + + enum CodingKeys: String, CodingKey { + case id + case startTime = "start_time" + case endTime = "end_time" + } +} diff --git a/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift b/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift index dd47702f..79ce59e7 100644 --- a/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift +++ b/Projects/Services/DataModule/Sources/StudyRooms/Repositories/Impl/StudyRoomsRepositoryImpl.swift @@ -38,4 +38,8 @@ public struct StudyRoomsRepositoryImpl: StudyRoomsRepository { public func fetchMyStudyRoomApplicationItems() -> AnyPublisher { remoteStudyRoomsDataSource.fetchMyRemainApplicationItems() } + + public func fetchStudyroomTimeList() -> AnyPublisher { + remoteStudyRoomsDataSource.fetchStudyroomTimeList() + } } diff --git a/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchStudyroomTimeListUseCaseImpl.swift b/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchStudyroomTimeListUseCaseImpl.swift new file mode 100644 index 00000000..0cbf4e59 --- /dev/null +++ b/Projects/Services/DataModule/Sources/StudyRooms/UseCases/Impl/FetchStudyroomTimeListUseCaseImpl.swift @@ -0,0 +1,16 @@ +import Combine +import DataMappingModule +import DomainModule +import ErrorModule + +public struct FetchStudyroomTimeListUseCaseImpl: FetchStudyroomTimeListUseCase { + private let studyRoomsRepository: any StudyRoomsRepository + + public init(studyRoomsRepository: any StudyRoomsRepository) { + self.studyRoomsRepository = studyRoomsRepository + } + + public func execute() -> AnyPublisher { + studyRoomsRepository.fetchStudyroomTimeList() + } +} diff --git a/Projects/Services/DomainModule/Sources/Entities/StudyroomTimeListEntity.swift b/Projects/Services/DomainModule/Sources/Entities/StudyroomTimeListEntity.swift new file mode 100644 index 00000000..453c9652 --- /dev/null +++ b/Projects/Services/DomainModule/Sources/Entities/StudyroomTimeListEntity.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct StudyroomTimeListEntity: Equatable, Hashable { + public init( + timeSlots: [TimeSlotsEntity] + ) { + self.timeSlots = timeSlots + } + + public let timeSlots: [TimeSlotsEntity] +} diff --git a/Projects/Services/DomainModule/Sources/Entities/TimeSlotsEntity.swift b/Projects/Services/DomainModule/Sources/Entities/TimeSlotsEntity.swift new file mode 100644 index 00000000..305c3341 --- /dev/null +++ b/Projects/Services/DomainModule/Sources/Entities/TimeSlotsEntity.swift @@ -0,0 +1,17 @@ +import Foundation + +public struct TimeSlotsEntity: Equatable, Hashable { + public init( + id: String, + startTime: String, + endTime: String + ) { + self.id = id + self.startTime = startTime + self.endTime = endTime + } + + public let id: String + public let startTime: String + public let endTime: String +} diff --git a/Projects/Services/DomainModule/Sources/Remains/Repository/RemainsRepository.swift b/Projects/Services/DomainModule/Sources/Remains/Repository/RemainsRepository.swift index 6a376a9c..8a3e49c7 100644 --- a/Projects/Services/DomainModule/Sources/Remains/Repository/RemainsRepository.swift +++ b/Projects/Services/DomainModule/Sources/Remains/Repository/RemainsRepository.swift @@ -6,6 +6,5 @@ public protocol RemainsRepository { func remainingApplicationsChanges(id: String) -> AnyPublisher func fetchMyRemainApplicationItems() -> AnyPublisher func fetchRemainsAvailableTime() -> AnyPublisher - func fetchRemainApplicationList() -> AnyPublisher + func fetchRemainApplicationList() -> AnyPublisher } diff --git a/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift b/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift index 5cd6d676..c8fdff67 100644 --- a/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift +++ b/Projects/Services/DomainModule/Sources/StudyRooms/Repository/StudyRoomsRepository.swift @@ -10,4 +10,5 @@ public protocol StudyRoomsRepository { func applyStudyRoomSeat(seatID: String) -> AnyPublisher func cancelStudyRoomSeat() -> AnyPublisher func fetchMyStudyRoomApplicationItems() -> AnyPublisher + func fetchStudyroomTimeList() -> AnyPublisher } diff --git a/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchStudyroomTimeListUseCase.swift b/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchStudyroomTimeListUseCase.swift new file mode 100644 index 00000000..f312808e --- /dev/null +++ b/Projects/Services/DomainModule/Sources/StudyRooms/UseCases/FetchStudyroomTimeListUseCase.swift @@ -0,0 +1,7 @@ +import Combine +import DataMappingModule +import ErrorModule + +public protocol FetchStudyroomTimeListUseCase { + func execute() -> AnyPublisher +} diff --git a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/DataTransfer/FetchStudyroomTimeListDataTransfer.swift b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/DataTransfer/FetchStudyroomTimeListDataTransfer.swift new file mode 100644 index 00000000..9d2b805e --- /dev/null +++ b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/DataTransfer/FetchStudyroomTimeListDataTransfer.swift @@ -0,0 +1,20 @@ +import DataMappingModule +import DomainModule + +public extension FetchStudyRoomTimeListResponseDTO { + func toDomain() -> StudyroomTimeListEntity { + StudyroomTimeListEntity( + timeSlots: timeSlots.map { $0.toDomain() } + ) + } +} + +public extension TimeSlotsResponseDTO { + func toDomain() -> TimeSlotsEntity { + TimeSlotsEntity( + id: id, + startTime: startTime, + endTime: endTime + ) + } +} diff --git a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift index 9aca39af..903e2b2f 100644 --- a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift +++ b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/Impl/RemoteStudyRoomsDataSourceImpl.swift @@ -5,6 +5,12 @@ import DomainModule import ErrorModule public final class RemoteStudyRoomsDataSourceImpl: BaseRemoteDataSource, RemoteStudyRoomsDataSource { + public func fetchStudyroomTimeList() -> AnyPublisher { + request(.fetchStudyroomTimeList, dto: FetchStudyRoomTimeListResponseDTO.self) + .map { $0.toDomain() } + .eraseToAnyPublisher() + } + public func fetchMyRemainApplicationItems() -> AnyPublisher { request(.fetchMyStudyRoomApplicationItems, dto: FetchMyStudyRoomApplicationItemsDTO.self) .map { $0.toDomain() } diff --git a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift index 464986e9..0447e361 100644 --- a/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift +++ b/Projects/Services/NetworkModule/Sources/StudyRooms/Remote/RemoteStudyRoomsDataSource.swift @@ -13,4 +13,5 @@ public protocol RemoteStudyRoomsDataSource { func applyStudyRoomSeat(seatID: String) -> AnyPublisher func cancelStudyRoomSeat() -> AnyPublisher func fetchMyRemainApplicationItems() -> AnyPublisher + func fetchStudyroomTimeList() -> AnyPublisher } From 1d203c81d1c773874fafa9518bc923b42179e79d Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Fri, 17 Mar 2023 17:27:29 +0900 Subject: [PATCH 2/8] =?UTF-8?q?refactor=20::=20UI=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudyroomTimeListView.swift | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift index e781d27f..2b8c7679 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift @@ -23,22 +23,23 @@ struct StudyroomTimeListView: View { viewModel.selectedEntity = timeSlots } ) + .background( Color.red ) } } .padding(.horizontal, 19) .padding(.bottom, 10) - - DMSWideButton( - text: "확인", - style: .contained, - color: .PrimaryVariant.primary, - action: { - viewModel.isStudyTimeBottomSheet = false - } - ) - .padding(.horizontal, 24) - .padding(.bottom) } + + DMSWideButton( + text: "확인", + style: .contained, + color: .PrimaryVariant.primary, + action: { + viewModel.isStudyTimeBottomSheet = false + } + ) + .padding(.horizontal, 24) + .padding(.bottom) } .onAppear { viewModel.fetchStudyroomTimeList() From 5c582998cc5188e853599e3e70966806f5f77976 Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Fri, 17 Mar 2023 19:26:39 +0900 Subject: [PATCH 3/8] =?UTF-8?q?refactor=20::=20ci=20=EB=90=98=EB=8A=94?= =?UTF-8?q?=EC=A7=80=20=EB=B3=B4=EB=A0=A4=EA=B3=A0=20=EC=BB=A4=EB=B0=8B?= =?UTF-8?q?=ED=95=98=EB=8A=94=20UI=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudyroomApplication/StudyRoomListViewModel.swift | 3 ++- .../StudyroomTimeList/StudyroomTimeListCellView.swift | 5 +++-- .../StudyroomTimeList/StudyroomTimeListView.swift | 11 +++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift index f6bf49ab..735165b7 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift @@ -11,11 +11,12 @@ final class StudyRoomListViewModel: BaseViewModel { @Published var isShowingToast = false @Published var toastMessage = "" - @Published var studyAvailableTime: StudyAvailableTimeEntity? @Published var isNavigateDetail: Bool = false @Published var isStudyTimeBottomSheet: Bool = false + @Published var studyroomTimeList = StudyroomTimeListEntity(timeSlots: []) @Published var selectedEntity: TimeSlotsEntity? + @Published var studyAvailableTime: StudyAvailableTimeEntity? @Published var studyRoomDetail: StudyRoomEntity = .init( id: "", floor: 0, diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift index 7fbbb6f9..7377f018 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift @@ -6,6 +6,7 @@ struct StudyroomTimeListCellView: View { @State var isClicked: Bool = false var list: TimeSlotsEntity let buttonAction: () -> Void + public init( isClicked: Bool, list: TimeSlotsEntity, @@ -30,9 +31,9 @@ struct StudyroomTimeListCellView: View { .etc(.button), color: isClicked ? .GrayScale.gray1 : .GrayScale.gray4 ) - .background { + .background( isClicked ? Color.PrimaryVariant.primary : Color.GrayScale.gray1 - } + ) } .overlay( RoundedRectangle(cornerRadius: 5) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift index 2b8c7679..23fd335d 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift @@ -30,14 +30,9 @@ struct StudyroomTimeListView: View { .padding(.bottom, 10) } - DMSWideButton( - text: "확인", - style: .contained, - color: .PrimaryVariant.primary, - action: { - viewModel.isStudyTimeBottomSheet = false - } - ) + DMSWideButton(text: "확인", style: .contained, color: .PrimaryVariant.primary) { + viewModel.isStudyTimeBottomSheet = false + } .padding(.horizontal, 24) .padding(.bottom) } From 9e7944437c1b57c032889bd2b9f200504a95e88f Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Fri, 17 Mar 2023 19:26:39 +0900 Subject: [PATCH 4/8] =?UTF-8?q?refactor=20::=20ci=20=EB=90=98=EB=8A=94?= =?UTF-8?q?=EC=A7=80=20=EB=B3=B4=EB=A0=A4=EA=B3=A0=20=EC=BB=A4=EB=B0=8B?= =?UTF-8?q?=ED=95=98=EB=8A=94=20UI=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 생각해보니까 pr을 안 올리면 볼 수가 없네.... --- .../StudyroomApplication/StudyRoomListViewModel.swift | 3 ++- .../StudyroomTimeList/StudyroomTimeListCellView.swift | 5 +++-- .../StudyroomTimeList/StudyroomTimeListView.swift | 11 +++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift index f6bf49ab..735165b7 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift @@ -11,11 +11,12 @@ final class StudyRoomListViewModel: BaseViewModel { @Published var isShowingToast = false @Published var toastMessage = "" - @Published var studyAvailableTime: StudyAvailableTimeEntity? @Published var isNavigateDetail: Bool = false @Published var isStudyTimeBottomSheet: Bool = false + @Published var studyroomTimeList = StudyroomTimeListEntity(timeSlots: []) @Published var selectedEntity: TimeSlotsEntity? + @Published var studyAvailableTime: StudyAvailableTimeEntity? @Published var studyRoomDetail: StudyRoomEntity = .init( id: "", floor: 0, diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift index 7fbbb6f9..7377f018 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift @@ -6,6 +6,7 @@ struct StudyroomTimeListCellView: View { @State var isClicked: Bool = false var list: TimeSlotsEntity let buttonAction: () -> Void + public init( isClicked: Bool, list: TimeSlotsEntity, @@ -30,9 +31,9 @@ struct StudyroomTimeListCellView: View { .etc(.button), color: isClicked ? .GrayScale.gray1 : .GrayScale.gray4 ) - .background { + .background( isClicked ? Color.PrimaryVariant.primary : Color.GrayScale.gray1 - } + ) } .overlay( RoundedRectangle(cornerRadius: 5) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift index 2b8c7679..23fd335d 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift @@ -30,14 +30,9 @@ struct StudyroomTimeListView: View { .padding(.bottom, 10) } - DMSWideButton( - text: "확인", - style: .contained, - color: .PrimaryVariant.primary, - action: { - viewModel.isStudyTimeBottomSheet = false - } - ) + DMSWideButton(text: "확인", style: .contained, color: .PrimaryVariant.primary) { + viewModel.isStudyTimeBottomSheet = false + } .padding(.horizontal, 24) .padding(.bottom) } From 852b3c8c69f1d3b1fae4a3f806f9a21fe5a532a3 Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Sat, 18 Mar 2023 18:44:11 +0900 Subject: [PATCH 5/8] =?UTF-8?q?chore=20::=20info.plist=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=97=85=EB=8E=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/WatchApp/Support/Info.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/App/WatchApp/Support/Info.plist b/Projects/App/WatchApp/Support/Info.plist index cdc256ae..a7149351 100644 --- a/Projects/App/WatchApp/Support/Info.plist +++ b/Projects/App/WatchApp/Support/Info.plist @@ -18,8 +18,6 @@ $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString $(BUNDLE_VERSION_STRING) - WKWatchKitApp - CFBundleVersion $(BUNDLE_VERSION) UISupportedInterfaceOrientations @@ -29,5 +27,7 @@ WKCompanionAppBundleIdentifier com.team.aliens.DMS-Aliens + WKWatchKitApp + From 56aa33e3adfe0e56620d47c99a05e09b5a13e31f Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Sat, 18 Mar 2023 23:00:53 +0900 Subject: [PATCH 6/8] =?UTF-8?q?fix=20::=20Info.plist=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=8B=9C=EB=AE=AC=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=8B=A4=ED=96=89=20=EB=B6=88=EA=B0=80=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/AppExtension/Support/Widget-Info.plist | 4 ++-- Projects/App/Support/Info.plist | 4 ++-- Projects/App/WatchApp/Support/Extension-Info.plist | 4 ++-- Projects/App/WatchApp/Support/Info.plist | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Projects/App/AppExtension/Support/Widget-Info.plist b/Projects/App/AppExtension/Support/Widget-Info.plist index 33a7afed..2261c07c 100644 --- a/Projects/App/AppExtension/Support/Widget-Info.plist +++ b/Projects/App/AppExtension/Support/Widget-Info.plist @@ -21,9 +21,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - $(BUNDLE_VERSION_STRING) + 1 CFBundleVersion - $(BUNDLE_VERSION) + 1 NSExtension NSExtensionPointIdentifier diff --git a/Projects/App/Support/Info.plist b/Projects/App/Support/Info.plist index 31d7b881..37228512 100644 --- a/Projects/App/Support/Info.plist +++ b/Projects/App/Support/Info.plist @@ -21,9 +21,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - $(BUNDLE_VERSION_STRING) + 1 CFBundleVersion - $(BUNDLE_VERSION) + 1 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Projects/App/WatchApp/Support/Extension-Info.plist b/Projects/App/WatchApp/Support/Extension-Info.plist index e161d6a5..0320742d 100644 --- a/Projects/App/WatchApp/Support/Extension-Info.plist +++ b/Projects/App/WatchApp/Support/Extension-Info.plist @@ -19,9 +19,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - $(BUNDLE_VERSION_STRING) + 1 CFBundleVersion - $(BUNDLE_VERSION) + 1 NSExtension NSExtensionAttributes diff --git a/Projects/App/WatchApp/Support/Info.plist b/Projects/App/WatchApp/Support/Info.plist index a2ec0bb0..c26d71b4 100644 --- a/Projects/App/WatchApp/Support/Info.plist +++ b/Projects/App/WatchApp/Support/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - $(BUNDLE_VERSION_STRING) + 1 CFBundleVersion 1 UISupportedInterfaceOrientations From 4bf8201a59e36ddca58a643cd8c7ba8015a6312a Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Sat, 18 Mar 2023 23:20:53 +0900 Subject: [PATCH 7/8] =?UTF-8?q?refactor=20::=20entity=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/StudyroomApplication/StudyRoomListViewModel.swift | 2 +- .../StudyroomTimeList/StudyroomTimeListView.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift index 735165b7..06a84efc 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyRoomListViewModel.swift @@ -15,7 +15,7 @@ final class StudyRoomListViewModel: BaseViewModel { @Published var isStudyTimeBottomSheet: Bool = false @Published var studyroomTimeList = StudyroomTimeListEntity(timeSlots: []) - @Published var selectedEntity: TimeSlotsEntity? + @Published var selectedTimeEntity: TimeSlotsEntity? @Published var studyAvailableTime: StudyAvailableTimeEntity? @Published var studyRoomDetail: StudyRoomEntity = .init( id: "", diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift index 9469c471..37148a3b 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift @@ -17,10 +17,10 @@ struct StudyroomTimeListView: View { LazyHStack { ForEach(viewModel.studyroomTimeList.timeSlots, id: \.self) { timeSlots in StudyroomTimeListCellView( - isClicked: timeSlots.id == viewModel.selectedEntity?.id, + isClicked: timeSlots.id == viewModel.selectedTimeEntity?.id, timeSlots: timeSlots, buttonAction: { - viewModel.selectedEntity = timeSlots + viewModel.selectedTimeEntity = timeSlots } ) } From 79f1ce5c01e587de20245975b0e142e5a6636e3c Mon Sep 17 00:00:00 2001 From: InhyeKang Date: Sun, 19 Mar 2023 00:26:04 +0900 Subject: [PATCH 8/8] =?UTF-8?q?refactor=20::=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudyroomTimeListCellView.swift | 14 +++++++------- .../StudyroomTimeList/StudyroomTimeListView.swift | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift index d540c540..5b939be1 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListCellView.swift @@ -3,16 +3,16 @@ import DesignSystem import SwiftUI struct StudyroomTimeListCellView: View { - @State var isClicked: Bool = false + var isSelected: Bool = false var timeSlots: TimeSlotsEntity let buttonAction: () -> Void public init( - isClicked: Bool, + isSelected: Bool, timeSlots: TimeSlotsEntity, buttonAction: @escaping () -> Void ) { - self.isClicked = isClicked + self.isSelected = isSelected self.timeSlots = timeSlots self.buttonAction = buttonAction } @@ -20,7 +20,7 @@ struct StudyroomTimeListCellView: View { var body: some View { HStack { Button { - if !isClicked { + if !isSelected { buttonAction() } } label: { @@ -29,17 +29,17 @@ struct StudyroomTimeListCellView: View { .padding(.vertical, 14) .dmsFont( .etc(.button), - color: isClicked ? .GrayScale.gray1 : .GrayScale.gray4 + color: isSelected ? .GrayScale.gray1 : .GrayScale.gray4 ) .background( - isClicked ? Color.PrimaryVariant.primary : Color.GrayScale.gray1 + isSelected ? Color.PrimaryVariant.primary : Color.GrayScale.gray1 ) } .overlay( RoundedRectangle(cornerRadius: 5) .inset(by: 1) .stroke( - isClicked ? Color.System.primary : Color.GrayScale.gray4, + isSelected ? Color.System.primary : Color.GrayScale.gray4, lineWidth: 2 ) ) diff --git a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift index 37148a3b..be0e1992 100644 --- a/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift +++ b/Projects/Features/StudyRoomFeature/Sources/StudyroomApplication/StudyroomTimeList/StudyroomTimeListView.swift @@ -17,7 +17,7 @@ struct StudyroomTimeListView: View { LazyHStack { ForEach(viewModel.studyroomTimeList.timeSlots, id: \.self) { timeSlots in StudyroomTimeListCellView( - isClicked: timeSlots.id == viewModel.selectedTimeEntity?.id, + isSelected: timeSlots.id == viewModel.selectedTimeEntity?.id, timeSlots: timeSlots, buttonAction: { viewModel.selectedTimeEntity = timeSlots