-
Notifications
You must be signed in to change notification settings - Fork 2
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
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.
조아융~~~~~~~~
조폼미미미미미미미미
viewModel.patchQuitTripFromServer() | ||
val intent = Intent(requireActivity(), DashBoardActivity::class.java) | ||
startActivity(intent) |
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.
아차차 맞다! 불필요한 객체 추가 하지 않기.. 명심하겠습니다 🤓
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) | ||
} |
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.
오 이런 기능도 있군요!!
val intent = Intent(this, DashBoardActivity::class.java) | ||
startActivity(intent) |
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.
요기두~ 스코프 함수의 습관화!
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) |
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.
액티비티에서 이친구들을 전부 다 옵저브하고있지 않은데 LiveData로 쓴 이유가 있을까욤?
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.
맞아요 옵저브나 데이터 바인딩에서 활용하지 않는 단순 저장값들은 그냥 라이브데이터 대신 var 또는 val 로 활용하는 것이 좋아보여요 ~
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.
이제는 진짜 너무 잘해버려서 ...
디테일 살려서 더 좋은 코드짜기 위한 조언들을 담아보았습니다 !
아니 근데 그냥 성장 속도가 말이 안되는디 ;; 곧 잡히겟삼 나
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> | ||
} |
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.
한번에 서버통신 3개 처리해버리는 그녀... 실력 말안됨
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.
속도 미쳐따,,,
tvEditTripName.text = viewModel?.title | ||
tvEditTripInfoStartDate.text = viewModel?.startDate | ||
tvEditTripInfoEndDate.text = viewModel?.endDate | ||
viewModel?.gettitleLength() |
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.
요 친구들 ?를 넣지 않으면 실행할 때 널러블이 있을 수 있다는 오류가 떠서 넣어주었습니다!
setResult(Activity.RESULT_OK) | ||
finish() | ||
return@onEach |
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.
캬~
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) { |
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.
이 로직들은 뷰모델 내부에서 진행해줘도 좋을 것 같아요 !
maxDate = Calendar.getInstance().apply { | ||
set(2100, 0, 1) | ||
}.timeInMillis | ||
val calendar = Calendar.getInstance() |
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.
영상보니깐 바텀시트 값들이 2024 / 3 / 10 이 아니라 다른 형식이던데, 수정된 이유가 있었을까요?
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.
바텀시트에 뜨는 날짜 말씀하시는 거라면 영어로 뜨는 이유는 아마두 애뮬이 영어로 되어 있어서 그런 것 같숩니다.. 실기기에서는 원래 바텀시트 데이트피커 나오는 것(2024 3 10) 처럼 나옵니다!!
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) |
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.
요 친구들도 뷰모델 내부에서 진행해줄 수 있을 것 같아요 !
const val TRIP_ID = "TRIP_ID" | ||
const val TITLE = "TITLE" | ||
const val START_DATE = "START_DATE" | ||
const val END_DATE = "END_DATE" |
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.
사실 다 같아서 성능에 영향은 없지만, 캡슐화를 제대로 해주려면 private 달아주면 더 인텐트 진행을 숨겨줄 수 있어요! 잘해보이는 꿀팁 ㅋㅋ
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) |
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.
맞아요 옵저브나 데이터 바인딩에서 활용하지 않는 단순 저장값들은 그냥 라이브데이터 대신 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" |
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.
요 친구 잘못 들어간듯 ~~
android:gravity="center" | ||
android:paddingHorizontal="12dp" | ||
android:enabled="@{viewModel.isCheckTripAvailable()}" | ||
android:outlineProvider="none" |
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.
버튼 그림자 효과를 제거해주는 친구라고 알고 있습니다! 앱잼 기간 때 버튼 그림자 없애라고 했었어서 요번에도 추가했습니다!
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.
진짜 세연니,,최고야,, 서버통신 마스터!!!!
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> | ||
} |
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.
속도 미쳐따,,,
override fun onDestroy() { | ||
super.onDestroy() | ||
if (quitDialog?.isAdded == true) quitDialog?.dismiss() | ||
} |
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.
오 굿굿!!!
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) | ||
} |
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.
진짜 실력 말안되네 ..
viewModel.splitStartDate() | ||
viewModel.splitEndDate() |
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.
굿굿!!! 완벽하네욥
⛳️ Work Description
📸 Screenshot
pr_seyeon.mp4
📢 To Reviewers