-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FEAT/#95] 채팅 관련 정보 조회 API 연결 #107
Conversation
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.
뭐죠 이 미친 성장속도...? 아주 짱짱입니다!!👍🏻 수고많으셨고 리뷰확인 부탁드려용:)
import javax.inject.Inject | ||
|
||
class ChatDataSource @Inject constructor( | ||
private val service: ChatService |
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.
p1: 트콤
@SerialName("nickname") val nickname: String, | ||
@SerialName("firstPhoto") val firstPhoto: String, | ||
@SerialName("tradeType") val tradeType: String, | ||
@SerialName("title") val title: String, | ||
@SerialName("price") val price: Int, | ||
@SerialName("isPriceNegotiable") val isPriceNegotiable: Boolean, |
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.
p1: 개행해주세요~
@SerialName("nickname") val nickname: String, | |
@SerialName("firstPhoto") val firstPhoto: String, | |
@SerialName("tradeType") val tradeType: String, | |
@SerialName("title") val title: String, | |
@SerialName("price") val price: Int, | |
@SerialName("isPriceNegotiable") val isPriceNegotiable: Boolean, | |
@SerialName("nickname") | |
val nickname: String, | |
@SerialName("firstPhoto") | |
val firstPhoto: String, | |
@SerialName("tradeType") | |
val tradeType: String, | |
@SerialName("title") | |
val title: String, | |
@SerialName("price") | |
val price: Int, | |
@SerialName("isPriceNegotiable") | |
val isPriceNegotiable: Boolean, |
import javax.inject.Inject | ||
|
||
class ChatRepositoryImpl @Inject constructor( | ||
private val dataSource: ChatDataSource |
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.
p1: 트콤
tradeType = uiState.tradeType, | ||
title = uiState.title, | ||
firstPhoto = uiState.firstPhoto, | ||
price = "${uiState.price.toString().formatToPriceString()}원", |
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.
p1: '원'도 스트링 추출 해주세여~
onNavigateUp: () -> Unit, | ||
) { | ||
composable<DetailPage> { | ||
composable<DetailPage> { backStackEntry -> | ||
val productId = backStackEntry.arguments?.getLong("productId") ?: 0L |
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.
p2: productId가 nullable한 이유가 뭔가요?
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.
productId가 없거나 잘못된 데이터를 전달한 경우에도 앱이 튕기면서 꺼지는 경우를 대비해서 넣었습니다! 오류나면서 꺼지는 것보다 기본값 나오는 게 나을 것 같아서 적용했는데 수정할까욤??
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.
나날이 일취월장이네요! 장재원 멋지다
@Binds | ||
@Singleton | ||
abstract fun bindChatRepository( | ||
impl: ChatRepositoryImpl, |
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.
p1: 이름 컨벤션 => chatRepositoryImpl
val response = dataSource.getChatInfo(productId) | ||
if (response.status == 200) { | ||
response.data.toDomain() | ||
} else { | ||
throw IllegalStateException("Error fetching chat info: ${response.message}") | ||
} | ||
} |
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.
p1: 예전 리뷰에서도 언급한 적 있는 것 같은데, dataSource의 함수를 호출했을 때 오류가 발생하면 runCatching에서 자동으로 failure 처리를 합니다! 따라서 다음과 같이 수정해도 별탈 없이 코드가 수행됩니다
val response = dataSource.getChatInfo(productId) | |
if (response.status == 200) { | |
response.data.toDomain() | |
} else { | |
throw IllegalStateException("Error fetching chat info: ${response.message}") | |
} | |
} | |
val response = dataSource.getChatInfo(productId) | |
response.data.toDomain() | |
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.
아앗 맞네요!..
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.
안드 짱!!! 부상투혼 고생 많으셨습니다 ㅋㅎㅋㅎㅋ
Related issue 🛠
Work Description ✏️
Screenshot 📸
1.mp4
2, 구해요
2.mp4
To Reviewers 📢
채팅 관련 정보 조회 했습니다!