-
Notifications
You must be signed in to change notification settings - Fork 16
[Feat] #493 - 신규 홈뷰 - 화면 전환 구현 #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
9e61d71
fb5733e
f6fbd77
83a5302
bfc9cd4
8dbd9f9
fb33cb1
a7289fd
1e612d5
2497a78
7cc1883
8351988
5b4b581
b170c9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,24 +16,51 @@ public class HomeRepository { | |
|
||
private let homeService: HomeService | ||
private let calendarService: CalendarService | ||
private let userService: UserService | ||
|
||
private let cancelBag = CancelBag() | ||
|
||
public init(homeService: HomeService, | ||
calendarService: CalendarService | ||
calendarService: CalendarService, | ||
userService: UserService | ||
) { | ||
self.homeService = homeService | ||
self.calendarService = calendarService | ||
self.userService = userService | ||
} | ||
} | ||
|
||
extension HomeRepository: HomeRepositoryInterface { | ||
|
||
public func getAppServices() -> AnyPublisher<[Domain.HomeAppServicesModel], any Error> { | ||
homeService.getAppServiceAccessStatus() | ||
.map { $0.map { $0.toDomain() } } | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
public func getUserInfo() -> AnyPublisher<Domain.UserMainInfoModel?, Domain.MainError> { | ||
userService.getUserMainInfo() | ||
.mapError { error -> MainError in | ||
guard let error = error as? APIError else { | ||
return MainError.networkError(message: "Moya 에러") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제가 생각한 대안책은 두 가지가 있습니다. 1️⃣ // requestObjectWithNetworkErrorInCombine
// AS-IS
promise(.failure(error))
// TO-BE
promise(.failure(MoyaError.objectMapping(error, value))) // HomeRepository
...
guard let error as? APIError else {
return MainError.networkError(message: "MoyaError \(error.localizedDescription)")
} 실제 MoyaError로 처리되는지 테스트하기 위해 MoyaError 코드를 수정해보았어요. 단점은 적절한 MoyaError를 지정해주어야한다는 것인데요, 번거로움을 줄이기 위해 2️⃣ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앗 말씀해주신대로 반영하고 다시 리뷰달겠습니다! 감사합니다 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2번 방식으로 수정해두었어용 |
||
} | ||
|
||
switch error { | ||
case .network(let statusCode, _): | ||
if statusCode == 401 { | ||
return MainError.authFailed | ||
} | ||
return MainError.networkError(message: "\(statusCode) 네트워크 에러") | ||
case .tokenReissuanceFailed: | ||
return MainError.authFailed | ||
default: | ||
return MainError.networkError(message: "API 에러 디폴트") | ||
} | ||
} | ||
.map { $0.toDomain() } | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
public func getInsightPosts() -> AnyPublisher<[Domain.HomeInsightPostsModel], any Error> { | ||
homeService.getInsightPosts() | ||
.map { $0.map { $0.toDomain() } } | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,18 +14,20 @@ import DSKit | |||||
|
||||||
final class CalendarCardCVC: UICollectionViewCell { | ||||||
|
||||||
// MARK: - Properties | ||||||
|
||||||
lazy var attendanceButtonTap = attendanceButton.publisher(for: .touchUpInside) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
// MARK: - UI Components | ||||||
|
||||||
private let dateLabel = UILabel().then { | ||||||
$0.text = "10.22" | ||||||
$0.textColor = DSKitAsset.Colors.gray400.color | ||||||
$0.font = DSKitFontFamily.Suit.semiBold.font(size: 14) | ||||||
} | ||||||
|
||||||
private let scheduleCategoryTagView = HomeSquareTagView() | ||||||
|
||||||
private let scheduleTitleLabel = UILabel().then { | ||||||
$0.text = "1차 행사" | ||||||
$0.textColor = DSKitAsset.Colors.white.color | ||||||
$0.font = DSKitFontFamily.Suit.semiBold.font(size: 16) | ||||||
} | ||||||
|
@@ -126,7 +128,7 @@ extension CalendarCardCVC { | |||||
extension CalendarCardCVC { | ||||||
func configureCell(model: HomePresentationModel.RecentSchedule, | ||||||
userType: UserType) { | ||||||
self.dateLabel.text = model.date | ||||||
self.dateLabel.text = setDateFormat(date: model.date, to: "MM.dd") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 이거 저번에 dateFormatter 성능 관련해 얘기하면서 ... 서버에 요청하기로 구두로 얘기했던 것 같은데 (그래서 안 고쳐놨었나봐요 ㅋㅋ ) 얘도 서버 쌤들이 바꿔주시고 나면 원래대로 돌려놓겠습니다! |
||||||
self.scheduleTitleLabel.text = model.title | ||||||
if let tagType = CalenderCategoryTagType(rawValue: model.type) { | ||||||
self.scheduleCategoryTagView.setData(title: tagType.text, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명을 보니 해당 함수는 메소드 체이닝을 위해 반환값을 만들어둔 것 같아요. 반환값이 필요없다면 같은 역할을 하는
setLineSpacing
함수를 사용하는 것이 좋을 듯 합니다!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋ ㅋ 원래대로 돌려놓을게요 오 오 ..