Skip to content

Commit

Permalink
fix: 댓글 이미지 둥글기 반경 수정 등 (depromeet#656)
Browse files Browse the repository at this point in the history
* fix: 댓글이미지radius수정

* fix: 캘린더화면 스크롤 문제 수정

* fix: 작성자 이름이 짤리는 문제 수정

* fix: 작성자가 알수없음이라 뜨는 문제 수정

* fix: 스플래시에서 가족멤버 불러오기 구현

* delete: Splash에서 가족멤버 불러오는 코드 삭제
  • Loading branch information
rlarjsdn3 authored Sep 26, 2024
1 parent c1c593c commit 0e94bcd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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<Mutation>.just(.setAuthorName(authorName))

case .requestAuthorImageUrl:
let authorId = initialState.post.authorId
let authorImageUrl = meUseCase.executeProfileImageUrlString(memberId: authorId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public final class MonthlyCalendarViewReactor: Reactor {
case pushDailyCalendarViewController(Date)
case setInfoPopover(UIView)
case setCalendarItems([String])
// TODO: - 싹다 코드 리팩토링하기
case setCalendarPageIndexPath(IndexPath)
}

// MARK: - State
Expand All @@ -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
}


Expand Down Expand Up @@ -80,7 +84,12 @@ public final class MonthlyCalendarViewReactor: Reactor {
return Observable<Mutation>.just(.popViewController)

case let .addCalendarItems(items):
return Observable<Mutation>.just(.setCalendarItems(items))
let indexPath = IndexPath(item: items.count-1, section: 0)

return Observable<Mutation>.concat(
Observable<Mutation>.just(.setCalendarItems(items)),
Observable<Mutation>.just(.setCalendarPageIndexPath(indexPath))
)

}
}
Expand All @@ -104,7 +113,12 @@ public final class MonthlyCalendarViewReactor: Reactor {
items: items
)
newState.displayCalendar = [newDatasource]

case let .setCalendarPageIndexPath(indexPath):
newState.initalCalendarPageIndexPath = indexPath
}


return newState
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ final class CalendarPostCell: BaseCollectionViewCell<CalendarPostCellReactor> {

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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MonthlyCalendarViewReactor> {
Expand Down Expand Up @@ -52,21 +48,23 @@ public final class MonthlyCalendarViewController: TempNavigationViewController<M
.bind(with: self) { owner, _ in
UIView.transition(
with: owner.calendarCollectionView,
duration: 0.15,
duration: 0.25,
options: .transitionCrossDissolve
) { [weak self] in
self?.calendarCollectionView.isHidden = false
}
}
.disposed(by: disposeBag)

App.Repository.member.familyCreatedAt
App.Repository.member.familyCreatedAt // 캘린더 페이지를 생성하는 코드 ex) 2024년 3월 ~ 9월
.withUnretained(self)
.map {
guard let createdAt = $0.1 else {
let _20230101 = Date._20230101
return $0.0.createCalendarItems(from: _20230101)
}
print("======= \(createdAt)")
print("======= \($0.0.createCalendarItems(from: createdAt))")
return $0.0.createCalendarItems(from: createdAt)
}
.map { Reactor.Action.addCalendarItems($0)}
Expand All @@ -85,6 +83,12 @@ public final class MonthlyCalendarViewController: TempNavigationViewController<M
.bind(to: calendarCollectionView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)

reactor.state.compactMap { $0.initalCalendarPageIndexPath }
.bind(with: self) { owner, indexPath in
owner.scrollToLastIndexPath(indexPath)
}
.disposed(by: disposeBag)

reactor.pulse(\.$shouldPushDailyCalendarViewController).compactMap { $0 }
.withUnretained(self)
.subscribe { $0.0.pushWeeklyCalendarViewController($0.1) }
Expand Down Expand Up @@ -134,7 +138,6 @@ public final class MonthlyCalendarViewController: TempNavigationViewController<M
$0.backgroundColor = UIColor.clear
$0.register(CalendarCell.self, forCellWithReuseIdentifier: CalendarCell.id)
}
scrollToLastIndexPath()
}
}

Expand Down Expand Up @@ -174,9 +177,7 @@ extension MonthlyCalendarViewController {
private func prepareDatasource() -> RxCollectionViewSectionedReloadDataSource<MonthlyCalendarSectionModel> {
return RxCollectionViewSectionedReloadDataSource<MonthlyCalendarSectionModel> { 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
}
}
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ final public class CommentCell: BaseTableViewCell<CommentCellReactor> {
}

profileImage.do {
$0.layer.masksToBounds = true
$0.layer.cornerRadius = 44 / 2
$0.contentMode = .scaleAspectFill
}
Expand Down

0 comments on commit 0e94bcd

Please sign in to comment.