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

[FEAT/#230] 여행 조회, 여행 수정, 여행 나가기 뷰 / 서버통신 구현 #241

Merged
merged 23 commits into from
Mar 11, 2024

Conversation

crownjoe
Copy link
Contributor

@crownjoe crownjoe commented Mar 9, 2024

⛳️ Work Description

  • 전에 짰던 ui 에서 달라진 부분 있어서 ui 구현
  • 여행 조회 api 구현
  • 여행 수정 api 구현
  • 여행 나가기 api 구현

📸 Screenshot

pr_seyeon.mp4

📢 To Reviewers

  • 여행 시작일보다 종료일이 빨라요~ 이런 토스트 안 띄우고 데이트 피커 내에서 해결하고 싶어서 열심히 했는데 코드가 별로 예뿌진 않네욥...
  • 수정하기 버튼 활성화는 여행 제목이 변경 or 시작일이 변경 or 종료일이 변경 셋 중에 하나만 수정되어도 활성화 되게 짰습니다!
  • 생각보다 시간이 많이 걸리는 군요.... 암튼 코리 부탁드립니도~!

@crownjoe crownjoe added 세연 🤤 FEAT ✨ 새로운 기능 구현 labels Mar 9, 2024
@crownjoe crownjoe added this to the 2차 스프린트 milestone Mar 9, 2024
@crownjoe crownjoe self-assigned this Mar 9, 2024
Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

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

조아융~~~~~~~~
조폼미미미미미미미미

Comment on lines 45 to 47
viewModel.patchQuitTripFromServer()
val intent = Intent(requireActivity(), DashBoardActivity::class.java)
startActivity(intent)
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
Contributor Author

Choose a reason for hiding this comment

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

아차차 맞다! 불필요한 객체 추가 하지 않기.. 명심하겠습니다 🤓

Comment on lines 68 to 74
fun splitDate(date: String): Triple<Int, Int, Int> {
val parts = date.split(".")
val year = parts[0].toInt()
val month = parts[1].toInt()
val day = parts[2].toInt()
return Triple(year, month, day)
}
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
Member

Choose a reason for hiding this comment

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

오 이런 기능도 있군요!!

Comment on lines 128 to 129
val intent = Intent(this, DashBoardActivity::class.java)
startActivity(intent)
Copy link
Member

Choose a reason for hiding this comment

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

요기두~ 스코프 함수의 습관화!

Comment on lines 32 to 53
var currentStartYear = MutableLiveData<Int>()
var currentStartMonth = MutableLiveData<Int>()
var currentStartDay = MutableLiveData<Int>()
var currentEndYear = MutableLiveData<Int>()
var currentEndMonth = MutableLiveData<Int>()
var currentEndDay = MutableLiveData<Int>()

val startYear = MutableLiveData<Int>()
val startMonth = MutableLiveData<Int>()
val startDay = MutableLiveData<Int>()
var startDate = MutableLiveData<String>()

val endYear = MutableLiveData<Int>()
val endMonth = MutableLiveData<Int>()
val endDay = MutableLiveData<Int>()
var endDate = MutableLiveData<String>()

val isStartDateAvailable = MutableLiveData(false)
val isEndDateAvailable = MutableLiveData(false)

val isTitleAvailable = MutableStateFlow(false)
var isCheckTripAvailable = MutableLiveData(false)
Copy link
Member

Choose a reason for hiding this comment

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

액티비티에서 이친구들을 전부 다 옵저브하고있지 않은데 LiveData로 쓴 이유가 있을까욤?

Copy link
Member

Choose a reason for hiding this comment

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

맞아요 옵저브나 데이터 바인딩에서 활용하지 않는 단순 저장값들은 그냥 라이브데이터 대신 var 또는 val 로 활용하는 것이 좋아보여요 ~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

조언 감사합니둥! 수정하겟숩니다!

Copy link
Member

@Marchbreeze Marchbreeze left a comment

Choose a reason for hiding this comment

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

이제는 진짜 너무 잘해버려서 ...
디테일 살려서 더 좋은 코드짜기 위한 조언들을 담아보았습니다 !
아니 근데 그냥 성장 속도가 말이 안되는디 ;; 곧 잡히겟삼 나

Comment on lines +6 to +18
interface EditTripRepository {

suspend fun getTripInfo(
tripId: Long
): Result<TripInfoModel>
suspend fun patchEditTripInfo(
tripId: Long,
request: EditTripRequestModel
): Result<Unit>
suspend fun patchQuitTrip(
tripId: Long
): Result<Unit>
}
Copy link
Member

Choose a reason for hiding this comment

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

한번에 서버통신 3개 처리해버리는 그녀... 실력 말안됨

Copy link
Member

@leeeyubin leeeyubin Mar 10, 2024

Choose a reason for hiding this comment

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

속도 미쳐따,,,

Comment on lines +53 to +56
tvEditTripName.text = viewModel?.title
tvEditTripInfoStartDate.text = viewModel?.startDate
tvEditTripInfoEndDate.text = viewModel?.endDate
viewModel?.gettitleLength()
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
Contributor Author

Choose a reason for hiding this comment

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

요 친구들 ?를 넣지 않으면 실행할 때 널러블이 있을 수 있다는 오류가 떠서 넣어주었습니다!

Comment on lines +74 to +76
setResult(Activity.RESULT_OK)
finish()
return@onEach
Copy link
Member

Choose a reason for hiding this comment

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

캬~

viewModel.currentEndDay.value ?: calendar.get(Calendar.DAY_OF_MONTH)
)
}
if (viewModel.startYear.value != viewModel.currentStartYear.value || viewModel.startMonth.value != viewModel.currentStartMonth.value || viewModel.startDay.value != viewModel.currentStartDay.value) {
Copy link
Member

Choose a reason for hiding this comment

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

이 로직들은 뷰모델 내부에서 진행해줘도 좋을 것 같아요 !

maxDate = Calendar.getInstance().apply {
set(2100, 0, 1)
}.timeInMillis
val calendar = Calendar.getInstance()
Copy link
Member

Choose a reason for hiding this comment

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

영상보니깐 바텀시트 값들이 2024 / 3 / 10 이 아니라 다른 형식이던데, 수정된 이유가 있었을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

바텀시트에 뜨는 날짜 말씀하시는 거라면 영어로 뜨는 이유는 아마두 애뮬이 영어로 되어 있어서 그런 것 같숩니다.. 실기기에서는 원래 바텀시트 데이트피커 나오는 것(2024 3 10) 처럼 나옵니다!!

Comment on lines 55 to 65
val (startYear, startMonth, startDay) = splitDate(viewModel.currentStartDate)
viewModel.currentStartYear.value = startYear
viewModel.currentStartMonth.value = startMonth
viewModel.currentStartDay.value = startDay
viewModel.setStartDate(startYear, startMonth, startDay)

val (endYear, endMonth, endDay) = splitDate(viewModel.currentEndDate)
viewModel.currentEndYear.value = endYear
viewModel.currentEndMonth.value = endMonth
viewModel.currentEndDay.value = endDay
viewModel.setEndDate(endYear, endMonth, endDay)
Copy link
Member

Choose a reason for hiding this comment

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

요 친구들도 뷰모델 내부에서 진행해줄 수 있을 것 같아요 !

Comment on lines 140 to 143
const val TRIP_ID = "TRIP_ID"
const val TITLE = "TITLE"
const val START_DATE = "START_DATE"
const val END_DATE = "END_DATE"
Copy link
Member

Choose a reason for hiding this comment

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

사실 다 같아서 성능에 영향은 없지만, 캡슐화를 제대로 해주려면 private 달아주면 더 인텐트 진행을 숨겨줄 수 있어요! 잘해보이는 꿀팁 ㅋㅋ

Comment on lines 32 to 53
var currentStartYear = MutableLiveData<Int>()
var currentStartMonth = MutableLiveData<Int>()
var currentStartDay = MutableLiveData<Int>()
var currentEndYear = MutableLiveData<Int>()
var currentEndMonth = MutableLiveData<Int>()
var currentEndDay = MutableLiveData<Int>()

val startYear = MutableLiveData<Int>()
val startMonth = MutableLiveData<Int>()
val startDay = MutableLiveData<Int>()
var startDate = MutableLiveData<String>()

val endYear = MutableLiveData<Int>()
val endMonth = MutableLiveData<Int>()
val endDay = MutableLiveData<Int>()
var endDate = MutableLiveData<String>()

val isStartDateAvailable = MutableLiveData(false)
val isEndDateAvailable = MutableLiveData(false)

val isTitleAvailable = MutableStateFlow(false)
var isCheckTripAvailable = MutableLiveData(false)
Copy link
Member

Choose a reason for hiding this comment

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

맞아요 옵저브나 데이터 바인딩에서 활용하지 않는 단순 저장값들은 그냥 라이브데이터 대신 var 또는 val 로 활용하는 것이 좋아보여요 ~

@@ -57,11 +58,11 @@
app:canBlankError="true"
app:hint="@string/edit_trip_info_et_name_hint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
Copy link
Member

Choose a reason for hiding this comment

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

요 친구 잘못 들어간듯 ~~

android:gravity="center"
android:paddingHorizontal="12dp"
android:enabled="@{viewModel.isCheckTripAvailable()}"
android:outlineProvider="none"
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
Contributor Author

Choose a reason for hiding this comment

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

버튼 그림자 효과를 제거해주는 친구라고 알고 있습니다! 앱잼 기간 때 버튼 그림자 없애라고 했었어서 요번에도 추가했습니다!

Copy link
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

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

진짜 세연니,,최고야,, 서버통신 마스터!!!!

Comment on lines +6 to +18
interface EditTripRepository {

suspend fun getTripInfo(
tripId: Long
): Result<TripInfoModel>
suspend fun patchEditTripInfo(
tripId: Long,
request: EditTripRequestModel
): Result<Unit>
suspend fun patchQuitTrip(
tripId: Long
): Result<Unit>
}
Copy link
Member

@leeeyubin leeeyubin Mar 10, 2024

Choose a reason for hiding this comment

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

속도 미쳐따,,,

Comment on lines +113 to +116
override fun onDestroy() {
super.onDestroy()
if (quitDialog?.isAdded == true) quitDialog?.dismiss()
}
Copy link
Member

Choose a reason for hiding this comment

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

오 굿굿!!!

Comment on lines 68 to 74
fun splitDate(date: String): Triple<Int, Int, Int> {
val parts = date.split(".")
val year = parts[0].toInt()
val month = parts[1].toInt()
val day = parts[2].toInt()
return Triple(year, month, day)
}
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
Member

@Marchbreeze Marchbreeze left a comment

Choose a reason for hiding this comment

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

진짜 실력 말안되네 ..

Comment on lines +54 to +55
viewModel.splitStartDate()
viewModel.splitEndDate()
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
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

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

굿굿!!! 완벽하네욥

@crownjoe crownjoe merged commit 1107543 into develop Mar 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FEAT ✨ 새로운 기능 구현 세연 🤤
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 여행 수정 뷰 / 서버 통신 구현
4 participants