Skip to content

Commit

Permalink
[AN] fix: v0.2.1 QA 마이페이지 이슈 (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
junjange authored and takoyakimchi committed Oct 23, 2024
1 parent 45a6d0e commit 54082f6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,27 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_

is MyPageNavigationAction.NavigateToMyClubManger ->
(activity as MainActivityActionHandler).navigateToMyClub(isMyHead = true)

is MyPageNavigationAction.NavigateToMyParticipation ->
(activity as MainActivityActionHandler).navigateToMyClub(isMyHead = false)

is MyPageNavigationAction.NavigateToPetEdit ->
(activity as MainActivityActionHandler).navigateToRegisterPet(action.petProfile)
}
}

viewModel.uiState.observe(viewLifecycleOwner) { uiState ->
adapter.submitList(uiState.pets)
adapter.submitList(uiState.pets) {
binding.vpPetProfile.post {
binding.vpPetProfile.setCurrentItem(0, false)
}
}
}
}

override fun onResume() {
super.onResume()
viewModel.fetchPetMine()
viewModel.fetchMemberMine()
viewModel.updateCurrentPage(0)
binding.vpPetProfile.setCurrentItem(0, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ class MyPageViewModel(
MutableLiveData(null)
val navigateAction: LiveData<Event<MyPageNavigationAction>> get() = _navigateAction

init {
fetchMemberMine()
fetchPetMine()
}

fun fetchMemberMine() {
viewModelScope.launch {
getMemberMineUseCase().onSuccess { member ->
Expand All @@ -60,7 +55,11 @@ class MyPageViewModel(

val state = uiState.value ?: return@launch

_uiState.value = state.copy(pets = petsView + PetAddView(memberId = state.id))
if (petsView.size >= MAX_PET_SIZE) {
_uiState.value = state.copy(pets = petsView)
} else {
_uiState.value = state.copy(pets = petsView + PetAddView(memberId = state.id))
}
}.onFailure {
// TODO 예외 처리
}
Expand Down Expand Up @@ -143,6 +142,8 @@ class MyPageViewModel(
}

companion object {
const val MAX_PET_SIZE = 5

fun factory(
getPetsMineUseCase: GetPetsMineUseCase,
getMemberMineUseCase: GetMemberMineUseCase,
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/layout/item_pet_add.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:id="@+id/iv_empty_pet"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_empty_pet"
android:src="@drawable/ic_add_image"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<!--프로필 설정-->
<string name="profile_setting_nickname">닉네임</string>
<string name="profile_setting_nickname_hint">닉네임을 입력해주세요</string>
<string name="profile_setting_nickname_hint">사용자 닉네임을 입력해주세요</string>
<string name="profile_setting_profile_pic">프로필 사진</string>
<string name="make_profile_title">프로필 만들기</string>
<string name="make_profile_edit_title">프로필 수정하기</string>
Expand Down

0 comments on commit 54082f6

Please sign in to comment.