diff --git a/Poppool/Poppool.xcodeproj/project.pbxproj b/Poppool/Poppool.xcodeproj/project.pbxproj index 476e0146..ece70527 100644 --- a/Poppool/Poppool.xcodeproj/project.pbxproj +++ b/Poppool/Poppool.xcodeproj/project.pbxproj @@ -3842,7 +3842,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.7; PRODUCT_BUNDLE_IDENTIFIER = com.poppoolIOS.poppool; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -3880,7 +3880,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.7; PRODUCT_BUNDLE_IDENTIFIER = com.poppoolIOS.poppool; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/Poppool/Poppool/Presentation/Admin/AdminReactor.swift b/Poppool/Poppool/Presentation/Admin/AdminReactor.swift index 2a9fdce0..a2e737b0 100644 --- a/Poppool/Poppool/Presentation/Admin/AdminReactor.swift +++ b/Poppool/Poppool/Presentation/Admin/AdminReactor.swift @@ -43,7 +43,7 @@ final class AdminReactor: Reactor { case .viewDidLoad, .reloadData: return .concat([ .just(.setIsLoading(true)), - useCase.fetchStoreList(query: nil, page: 0, size: 20) + useCase.fetchStoreList(query: nil, page: 0, size: 100) .map { .setStores($0.popUpStoreList ?? []) }, // ✅ nil 방지 .just(.setIsLoading(false)) ]) @@ -51,7 +51,7 @@ final class AdminReactor: Reactor { case let .updateSearchQuery(query): return .concat([ .just(.setIsLoading(true)), - useCase.fetchStoreList(query: query, page: 0, size: 20) + useCase.fetchStoreList(query: query, page: 0, size: 100) .do(onNext: { response in Logger.log(message: "조회 성공 - 응답 데이터: \(response)", category: .info) }, onError: { error in diff --git a/Poppool/Poppool/Presentation/Scene/Home/Main/HomeReactor.swift b/Poppool/Poppool/Presentation/Scene/Home/Main/HomeReactor.swift index 5909a123..dc23eb27 100644 --- a/Poppool/Poppool/Presentation/Scene/Home/Main/HomeReactor.swift +++ b/Poppool/Poppool/Presentation/Scene/Home/Main/HomeReactor.swift @@ -91,7 +91,7 @@ final class HomeReactor: Reactor { switch action { case .changeIndicatorColor(let controller, let row): if !loginImageBannerSection.isEmpty { - loginImageBannerSection.inputDataList[0].imagePaths[row].isBrightImagePath { [weak controller] isBright in + loginImageBannerSection.inputDataList[0].imagePaths[row - 1].isBrightImagePath { [weak controller] isBright in controller?.systemStatusBarIsDark.accept(isBright) } } @@ -272,7 +272,7 @@ final class HomeReactor: Reactor { if isLoign { switch indexPath.section { case 0: - if let id = loginImageBannerSection.inputDataList.first?.idList[indexPath.row] { + if let id = loginImageBannerSection.inputDataList.first?.idList[indexPath.row - 1] { let controller = DetailController() controller.reactor = DetailReactor(popUpID: id) currentController.navigationController?.pushViewController(controller, animated: true) diff --git a/Poppool/Poppool/Presentation/Scene/Home/Main/View/ImageBannerSection/ImageBannerSection/ImageBannerSectionCell.swift b/Poppool/Poppool/Presentation/Scene/Home/Main/View/ImageBannerSection/ImageBannerSection/ImageBannerSectionCell.swift index 34a7f996..7dff5682 100644 --- a/Poppool/Poppool/Presentation/Scene/Home/Main/View/ImageBannerSection/ImageBannerSection/ImageBannerSectionCell.swift +++ b/Poppool/Poppool/Presentation/Scene/Home/Main/View/ImageBannerSection/ImageBannerSection/ImageBannerSectionCell.swift @@ -66,8 +66,10 @@ final class ImageBannerSectionCell: UICollectionViewCell { let bannerTapped: PublishSubject = .init() + private var currentIndex: Int = 1 private var stopButtonLeadingConstraints: Constraint? private var playButtonLeadingConstraints: Constraint? + private var isHiddenPauseButton: Bool = true // MARK: - init @@ -102,7 +104,11 @@ final class ImageBannerSectionCell: UICollectionViewCell { playButton.isHidden = true isAutoBannerPlay = true autoScrollTimer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { [weak self] _ in - self?.scrollToNextItem() + guard let self = self else { return } + self.contentCollectionView.scrollToItem( + at: .init(row: self.currentIndex + 1, section: 0), + at: .centeredHorizontally, animated: true + ) } } } @@ -149,20 +155,6 @@ private extension ImageBannerSectionCell { func getSection() -> [any Sectionable] { return [imageSection] } - - // 다음 배너로 스크롤 - private func scrollToNextItem() { - - let visibleIndexPaths = contentCollectionView.indexPathsForVisibleItems.sorted() - guard let currentIndex = visibleIndexPaths.first else { return } - - let nextIndex = IndexPath( - item: (currentIndex.item + 1) % imageSection.dataCount, - section: currentIndex.section - ) - contentCollectionView.scrollToItem(at: nextIndex, at: .centeredHorizontally, animated: true) - pageControl.currentPage = nextIndex.item - } private func findViewController() -> BaseViewController? { var nextResponder = self.next @@ -202,7 +194,11 @@ private extension ImageBannerSectionCell { .distinctUntilChanged() .withUnretained(self) .subscribe { (owner, index) in - owner.pageControl.currentPage = index + var index = index + owner.currentIndex = index + if index == 0 { index = 1 } + if index == owner.imageSection.dataCount - 1 { index = owner.imageSection.dataCount - 2 } + owner.pageControl.currentPage = index - 1 } .disposed(by: disposeBag) } @@ -216,15 +212,27 @@ extension ImageBannerSectionCell: Inputable { } func injection(with input: Input) { - pageControl.numberOfPages = input.imagePaths.count - let stopButtonLeadingOffset = input.imagePaths.count == 3 ? -40 : input.imagePaths.count == 2 ? -36 : 0 - stopButtonLeadingConstraints?.update(offset: stopButtonLeadingOffset) - playButtonLeadingConstraints?.update(offset: stopButtonLeadingOffset) - let datas = zip(input.imagePaths, input.idList) - imageSection.inputDataList = datas.map { .init(imagePath: $0.0, id: $0.1) } + if imageSection.isEmpty { + pageControl.numberOfPages = input.imagePaths.count + let stopButtonLeadingOffset = input.imagePaths.count == 3 ? -40 : input.imagePaths.count == 2 ? -36 : 0 + stopButtonLeadingConstraints?.update(offset: stopButtonLeadingOffset) + playButtonLeadingConstraints?.update(offset: stopButtonLeadingOffset) + let datas = zip(input.imagePaths, input.idList) + let backContents = datas.suffix(1) + let frontContents = datas.prefix(1) + imageSection.inputDataList = datas.map { .init(imagePath: $0.0, id: $0.1) } + imageSection.inputDataList.append(contentsOf: frontContents.map { .init(imagePath: $0.0, id: $0.1) }) + imageSection.inputDataList = backContents.map {.init(imagePath: $0.0, id: $0.1) } + imageSection.inputDataList + DispatchQueue.main.async { [weak self] in + self?.contentCollectionView.scrollToItem( + at: .init(row: 1, section: 0), + at: .centeredHorizontally, animated: false + ) + } + } contentCollectionView.reloadData() - + isHiddenPauseButton = input.isHiddenPauseButton if isFirstResponseAutoScroll { startAutoScroll() isFirstResponseAutoScroll = false @@ -267,4 +275,23 @@ extension ImageBannerSectionCell: UICollectionViewDelegate, UICollectionViewData func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { bannerTapped.onNext(indexPath.row) } + + func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { + if currentIndex == 0 { + contentCollectionView.scrollToItem( + at: .init(row: imageSection.dataCount - 2, section: 0), + at: .centeredHorizontally, animated: false + ) + } + if currentIndex == imageSection.dataCount - 1 { + contentCollectionView.scrollToItem( + at: .init(row: 1, section: 0), + at: .centeredHorizontally, animated: false + ) + } + if !isHiddenPauseButton { + startAutoScroll() + } + + } } diff --git a/Poppool/Poppool/Presentation/Utills/Controllers/BaseViewController.swift b/Poppool/Poppool/Presentation/Utills/Controllers/BaseViewController.swift index 78616b0b..8c2b573f 100644 --- a/Poppool/Poppool/Presentation/Utills/Controllers/BaseViewController.swift +++ b/Poppool/Poppool/Presentation/Utills/Controllers/BaseViewController.swift @@ -54,14 +54,11 @@ class BaseViewController: UIViewController { systemStatusBarIsDark .withUnretained(self) .subscribe { (owner, isDark) in - UIView.animate(withDuration: 0.3) { [weak owner] in - if isDark { - owner?.navigationController?.navigationBar.barStyle = .default - } else { - owner?.navigationController?.navigationBar.barStyle = .black - } + if isDark { + owner.navigationController?.navigationBar.barStyle = .default + } else { + owner.navigationController?.navigationBar.barStyle = .black } - } .disposed(by: systemStatusBarDisposeBag) }