Skip to content
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// DetailController.swift
// Poppool
//
// Created by SeoJunYoung on 12/9/24.
//

import UIKit

import ReactorKit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// HomeController.swift
// Poppool
//
// Created by SeoJunYoung on 11/28/24.
//

import UIKit

import ReactorKit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// HomeReactor.swift
// Poppool
//
// Created by SeoJunYoung on 11/28/24.
//

import UIKit

import ReactorKit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// ImageBannerSectionCell.swift
// Poppool
//
// Created by SeoJunYoung on 11/28/24.
//

import UIKit

import RxSwift
Expand Down Expand Up @@ -91,6 +84,8 @@ final class ImageBannerSectionCell: UICollectionViewCell {
autoScrollTimer = nil
}

// FIXME: (홈 -> 상세) 이동 시 홈의 자동 스크롤이 계속 돌아감.
// FIXME: 또한 오토 스크롤을 한번만 실행하면 되는데, 사진이 넘어갈 때 마다 실행되는것으로 보임
func startAutoScroll(interval: TimeInterval = 3.0) {
stopAutoScroll() // 기존 타이머를 중지
stopButton.isHidden = false
Expand Down Expand Up @@ -206,16 +201,20 @@ extension ImageBannerSectionCell: Inputable {
if imageSection.isEmpty {
pageControl.setNumberOfPages(input.imagePaths.count)
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
)
if input.imagePaths.count > 1 {
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
)
}
} else {
imageSection.inputDataList = datas.map { .init(imagePath: $0.0, id: $0.1) }
}
}

Expand Down Expand Up @@ -264,6 +263,8 @@ extension ImageBannerSectionCell: UICollectionViewDelegate, UICollectionViewData
}

func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
guard imageSection.dataCount > 1 else { return }

if currentIndex == 0 {
contentCollectionView.scrollToItem(
at: .init(row: imageSection.dataCount - 2, section: 0),
Expand Down