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

refactor : EventDetail 코드 리팩토링 #282

Merged
merged 11 commits into from
Aug 11, 2023

Conversation

chws0508
Copy link
Collaborator

#️⃣연관된 이슈

#277

📝작업 내용

EventDetail 부분 포맷팅 맞췄어요

스크린샷 (선택)

예상 소요 시간 및 실제 소요 시간

1시간/1시간

💬리뷰 요구사항(선택)

EventDetail 부분만 봐주셨으면 좋겠어요 ㅎㅎ

@chws0508 chws0508 added the Android 안드로이드 관련 이슈 label Aug 10, 2023
@chws0508 chws0508 added this to the 4차 스프린트 1주차 milestone Aug 10, 2023
@chws0508 chws0508 self-assigned this Aug 10, 2023
@chws0508 chws0508 requested review from ki960213 and tmdgh1592 and removed request for ki960213 August 10, 2023 08:46
Comment on lines -8 to +11
val startDate: String,
val endDate: String,
val startDate: LocalDateTime,
val endDate: LocalDateTime,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

데이터 모델에서 날짜 표현을 위해 String에서 LocalDateTime으로 타입을 바꾼 것 좋네요 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사요

@@ -3,6 +3,8 @@ package com.emmsale.data.eventdetail.dto
import com.emmsale.data.eventdetail.EventDetail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

@Serializable
data class EventDetailApiModel(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ApiModel을 다른 레이어의 모델로 변경하는 작업은 Mapper에서 하기로 컨벤션을 결정했던 것 같습니다! 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 맞네요 ㅎㅎ깜빡했어요 감사요

@@ -71,7 +72,7 @@ class EventDetailActivity : AppCompatActivity() {
text = tag
}

private fun setBackPress() {
private fun onBackPressButtonClick() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위로 가기 버튼을 클릭했을 때 실행되어야 할 작업 모음을 정의하는 함수의 이름이라면 onBackPressButtonClick이라는 이름이 괜찮다고 생각합니다! 하지만 위 함수는 위로 가기 버튼이 클릭 이벤트가 발생했을 때 처리하는 일을 하는 OnClickListener를 변경하므로 initBackPressOnClickListener 이렇게 이름을 짓는 것이 더 정확하다고 생각합니다:)
저라면 initUpButton 혹은 setupUpButton 이렇게 지을 것 같습니다 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 특정 View에 ClickListener를 설정할 때 initXxxClickListener() 라는 메서드명을 자주 사용합니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인정이요 반영할게요

val startDate: String,
val endDate: String,
val startDate: LocalDateTime,
val endDate: LocalDateTime,
val informationUrl: String,
val tags: List<String>,
val imageUrl: String?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imageUrl 대신에 posterImageUrl은 어떤가요?
imageUrl이라고 하면 어떤 이미지의 Url인지 파악하기가 어려울 수 있을 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인정

Comment on lines +30 to +31
binding.lifecycleOwner = this
binding.vm = viewModel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드는 setContentView 이후에 호출해주는 것도 좋을 것 같아요.
viewModel이 초기화되면서 실행되는 로직이 있다면 버그가 발생할 수 있습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인이요

if (eventDetailUiState.isError) {
showToast(getString(R.string.eventdetail_fetch_eventdetail_error_message))
} else {
addTag(eventDetailUiState.tags)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떤 태그를 추가하는 메서드인지 구체적으로 명명해주시면 좋을 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인이요

@@ -71,7 +72,7 @@ class EventDetailActivity : AppCompatActivity() {
text = tag
}

private fun setBackPress() {
private fun onBackPressButtonClick() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 특정 View에 ClickListener를 설정할 때 initXxxClickListener() 라는 메서드명을 자주 사용합니다.

private val _eventDetail: MutableLiveData<EventDetailUiState> =
MutableLiveData<EventDetailUiState>()
val eventDetail: LiveData<EventDetailUiState>
private val _eventDetail: NotNullMutableLiveData<EventDetailUiState> =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_eventDetail의 타입을 명시해주지 않으면 한 줄에 깔끔하게 작성할 수 있어요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 무조건 타입을 명시해야 한다고 생각합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떤 타입인지 명확하게 적는 것이 실수를 방지한다고 생각해요

Comment on lines 23 to 24
val eventDetail: NotNullLiveData<EventDetailUiState>
get() = _eventDetail
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다음과 같이 작성해보는 것은 어떠신가요?
val eventDetail: NotNullLiveData<EventDetailUiState>= _eventDetail

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네^^

Comment on lines 126 to 131

<string name="conference_default_people_count">0</string>
<string name="eventdetail_fetch_eventdetail_error_message">이벤트를 불러올 수 없어요</string>
<string name="eventdetail_tab_infromation">상세 정보</string>
<string name="eventdetail_tab_comment">댓글</string>
<string name="eventdetail_tab_recruitment">같이가요</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conference_default_people_count과 한 칸 띄어주세요~

- 함수명 변경
- strings.xml 포맷 변경
- initFragmentStateAdapter 리스트 생성하여 attach 하도록 변경
- imageUrl 을 postImageUrl 로 좀더 명확하게 변경
Copy link
Member

@tmdgh1592 tmdgh1592 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 반영 고생하셨습니다!
approve 하겠습니다 : )

Copy link
Collaborator

@ki960213 ki960213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰를 잘 반영해주셨네요 👍
더 이상 리뷰할 게 없는 것 같습니다!

@chws0508 chws0508 merged commit c53f59e into android-main Aug 11, 2023
@chws0508 chws0508 deleted the Feature/#277-스캇_코드_리팩토링 branch August 11, 2023 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android 안드로이드 관련 이슈
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants