diff --git a/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/CalendarPostCellReactor.swift b/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/CalendarPostCellReactor.swift index 22e1be498..04c815277 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/CalendarPostCellReactor.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/CalendarPostCellReactor.swift @@ -39,6 +39,8 @@ public final class CalendarPostCellReactor: Reactor { // MARK: - Properties public var initialState: State + @Injected var fetchUserNameUseCase: FetchUserNameUseCaseProtocol + @Injected var meUseCase: MemberUseCaseProtocol @Injected var provider: ServiceProviderProtocol @@ -72,9 +74,9 @@ public final class CalendarPostCellReactor: Reactor { case .requestAuthorName: let authorId = initialState.post.authorId - let authorName = meUseCase.executeFetchUserName(memberId: authorId) + let authorName = fetchUserNameUseCase.execute(memberId: authorId) ?? "알 수 없음" return Observable.just(.setAuthorName(authorName)) - + case .requestAuthorImageUrl: let authorId = initialState.post.authorId let authorImageUrl = meUseCase.executeProfileImageUrlString(memberId: authorId) diff --git a/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/MonthlyCalendarViewReactor.swift b/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/MonthlyCalendarViewReactor.swift index e27bfd078..43c893eb6 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/MonthlyCalendarViewReactor.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Calendar/Reactor/MonthlyCalendarViewReactor.swift @@ -26,6 +26,8 @@ public final class MonthlyCalendarViewReactor: Reactor { case pushDailyCalendarViewController(Date) case setInfoPopover(UIView) case setCalendarItems([String]) + // TODO: - 싹다 코드 리팩토링하기 + case setCalendarPageIndexPath(IndexPath) } // MARK: - State @@ -34,6 +36,8 @@ public final class MonthlyCalendarViewReactor: Reactor { @Pulse var shouldPushDailyCalendarViewController: Date? @Pulse var shouldPresnetInfoPopover: UIView? @Pulse var displayCalendar: [MonthlyCalendarSectionModel] + + var initalCalendarPageIndexPath: IndexPath? = nil } @@ -80,7 +84,12 @@ public final class MonthlyCalendarViewReactor: Reactor { return Observable.just(.popViewController) case let .addCalendarItems(items): - return Observable.just(.setCalendarItems(items)) + let indexPath = IndexPath(item: items.count-1, section: 0) + + return Observable.concat( + Observable.just(.setCalendarItems(items)), + Observable.just(.setCalendarPageIndexPath(indexPath)) + ) } } @@ -104,7 +113,12 @@ public final class MonthlyCalendarViewReactor: Reactor { items: items ) newState.displayCalendar = [newDatasource] + + case let .setCalendarPageIndexPath(indexPath): + newState.initalCalendarPageIndexPath = indexPath } + + return newState } } diff --git a/14th-team5-iOS/App/Sources/Presentation/Calendar/View/Cell/CalendarPostCell.swift b/14th-team5-iOS/App/Sources/Presentation/Calendar/View/Cell/CalendarPostCell.swift index f6b22c684..d32c4d8b8 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Calendar/View/Cell/CalendarPostCell.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Calendar/View/Cell/CalendarPostCell.swift @@ -110,7 +110,7 @@ final class CalendarPostCell: BaseCollectionViewCell { reactor.state.compactMap { $0.authorName } .distinctUntilChanged() - .bind(with: self) { $0.authorNameLabel.text = $1[0] } + .bind(to: authorFirstNameLabel.rx.firstLetterText) .disposed(by: disposeBag) reactor.state.compactMap { $0.authorImageUrl } diff --git a/14th-team5-iOS/App/Sources/Presentation/Calendar/ViewController/MonthlyCalendarViewController.swift b/14th-team5-iOS/App/Sources/Presentation/Calendar/ViewController/MonthlyCalendarViewController.swift index d96c76bd1..bf426b69c 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Calendar/ViewController/MonthlyCalendarViewController.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Calendar/ViewController/MonthlyCalendarViewController.swift @@ -16,12 +16,8 @@ import RxDataSources import SnapKit import Then -import MacrosInterface - -@Codable -struct MemberDTO { - var name: String -} +// 지금 당장 BBNavigationViewController로 바꿔도 안됨 +// 왜냐하면, PopoverViewController Delegate 문제가 발생하기 때문! fileprivate typealias _Str = CalendarStrings public final class MonthlyCalendarViewController: TempNavigationViewController { @@ -52,7 +48,7 @@ public final class MonthlyCalendarViewController: TempNavigationViewController RxCollectionViewSectionedReloadDataSource { return RxCollectionViewSectionedReloadDataSource { datasource, collectionView, indexPath, yearMonth in let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CalendarCell.id, for: indexPath) as! CalendarCell - cell.reactor = CalendarCellDIContainer( - yearMonth: yearMonth - ).makeReactor() + cell.reactor = CalendarCellReactor(yearMonth: yearMonth) return cell } } @@ -190,12 +191,11 @@ extension MonthlyCalendarViewController { ) } - private func scrollToLastIndexPath() { + private func scrollToLastIndexPath(_ indexPath: IndexPath) { calendarCollectionView.layoutIfNeeded() - let indexPath: IndexPath = IndexPath( - item: dataSource[0].items.count - 1, - section: 0 - ) + + print("======= \(dataSource[0].items.count - 1)") + calendarCollectionView.scrollToItem( at: indexPath, at: .centeredHorizontally, diff --git a/14th-team5-iOS/App/Sources/Presentation/Comment/View/Cell/CommentCell.swift b/14th-team5-iOS/App/Sources/Presentation/Comment/View/Cell/CommentCell.swift index cea16f36c..ebd4d01e4 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Comment/View/Cell/CommentCell.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Comment/View/Cell/CommentCell.swift @@ -160,6 +160,7 @@ final public class CommentCell: BaseTableViewCell { } profileImage.do { + $0.layer.masksToBounds = true $0.layer.cornerRadius = 44 / 2 $0.contentMode = .scaleAspectFill }