From 549c7f3f815695c238d500a2f5ca3195cd235f19 Mon Sep 17 00:00:00 2001 From: Choi SeongHoon <108349655+SeongHoonC@users.noreply.github.com> Date: Mon, 20 May 2024 18:12:24 +0900 Subject: [PATCH] =?UTF-8?q?[AN/USER]=20fix:=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EC=B6=95=EC=A0=9C=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=B0=8F=20Throwable=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0(#986)=20(#987)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 상세 페이지 요청 분기 재작성 * fix: Throwable 을 throw 하지 않도록 변경 * feat: 마이페이지 개인정보처리약관 사이트 주소 변경 * feat(MyPage): 로그인 유무와 상관없이 기본 이미지를 프로필로 보여준다 * feat(Bookmark): 북마크 탭 선택된 아이템만 진하게 표시 * fix(ArtistDetail): 로그인 유무로 데이터가 잘못 들어오는 것 수정 * feat: 대학교 이미지를 디폴트 값으로 변경한다 * feat: 라인업이 공개되지 않았어요 로직을 뷰바인딩으로 변경 * refactor: ktlint check --- .../festago/festago/data/util/ResponseExt.kt | 1 - .../ui/artistdetail/ArtistDetailViewModel.kt | 27 +++++++++++-------- .../ArtistDetailFestivalViewHolder.kt | 1 + .../adapater/FestivalBookmarkViewHolder.kt | 1 + .../FestivalListFestivalViewHolder.kt | 1 + .../ui/home/mypage/MyPageFragment.kt | 2 +- .../SchoolDetailFestivalViewHolder.kt | 1 + .../ui/schooldetail/SchoolDetailFragment.kt | 3 --- .../ui/schooldetail/SchoolDetailViewModel.kt | 22 ++++++++------- .../FestivalSearchViewHolder.kt | 1 + .../res/layout/fragment_bookmark_list.xml | 2 +- .../src/main/res/layout/fragment_my_page.xml | 7 +++-- .../layout/item_artist_detail_festival.xml | 1 - .../res/layout/item_festival_bookmark.xml | 1 - .../layout/item_festival_list_festival.xml | 1 - .../main/res/layout/item_school_bookmark.xml | 3 +-- .../layout/item_school_detail_festival.xml | 1 - .../main/res/layout/item_search_artist.xml | 11 +++++--- .../main/res/layout/item_search_festival.xml | 1 - .../main/res/layout/item_search_school.xml | 4 +-- 20 files changed, 48 insertions(+), 44 deletions(-) diff --git a/android/festago/data/src/main/java/com/festago/festago/data/util/ResponseExt.kt b/android/festago/data/src/main/java/com/festago/festago/data/util/ResponseExt.kt index a44604558..e234ac33c 100644 --- a/android/festago/data/src/main/java/com/festago/festago/data/util/ResponseExt.kt +++ b/android/festago/data/src/main/java/com/festago/festago/data/util/ResponseExt.kt @@ -49,6 +49,5 @@ private fun handleBadRequestException(response: Response) { throw BookmarkLimitExceededException() } } - throw Throwable("400 Bad Request") } } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/ArtistDetailViewModel.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/ArtistDetailViewModel.kt index fe0dadc72..e19709cf7 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/ArtistDetailViewModel.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/ArtistDetailViewModel.kt @@ -52,7 +52,10 @@ class ArtistDetailViewModel @Inject constructor( runCatching { val deferredArtistDetail = async { artistRepository.loadArtistDetail(id, delayTimeMillis) } - val deferredFestivals = async { artistRepository.loadArtistFestivals(id, 10) } + val deferredFestivals = async { + artistRepository.loadArtistFestivals(id = id, size = FESTIVAL_PAGE_SIZE) + } + val artist = deferredArtistDetail.await().getOrThrow() val festivalPage = deferredFestivals.await().getOrThrow() @@ -66,7 +69,7 @@ class ArtistDetailViewModel @Inject constructor( artist = artist, bookMarked = isBookmarked, festivals = festivalPage.toUiState(), - userRepository.isSigned(), + festivalPage.isLastPage, onBookmarkClick = ::toggleArtistBookmark, ) @@ -89,18 +92,19 @@ class ArtistDetailViewModel @Inject constructor( viewModelScope.launch { val currentFestivals = successUiState.festivals - val lastItem = successUiState.festivals.lastOrNull() - val isPast = when { - lastItem == null -> true - lastItem.endDate < LocalDate.now() -> true - successUiState.isLast -> true - else -> false - } + val lastItem = currentFestivals.lastOrNull() + val isPast = + lastItem?.endDate?.isBefore(LocalDate.now()) ?: true || successUiState.isLast + + val lastFestivalId = if (successUiState.isLast) null else lastItem?.id + val lastStartDate = if (successUiState.isLast) null else lastItem?.startDate + artistRepository.loadArtistFestivals( id = artistId, - lastFestivalId = currentFestivals.lastOrNull()?.id, - lastStartDate = currentFestivals.lastOrNull()?.startDate, + lastFestivalId = lastFestivalId, + lastStartDate = lastStartDate, isPast = isPast, + size = FESTIVAL_PAGE_SIZE, ).onSuccess { festivalsPage -> _uiState.value = successUiState.copy( festivals = currentFestivals + festivalsPage.toUiState(), @@ -189,6 +193,7 @@ class ArtistDetailViewModel @Inject constructor( } companion object { + private const val FESTIVAL_PAGE_SIZE = 20 private const val KEY_LOAD_ARTIST_DETAIL = "KEY_LOAD_ARTIST_DETAIL" private const val KEY_LOAD_MORE_ARTIST_FESTIVAL = "KEY_LOAD_MORE_ARTIST_FESTIVAL" } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/adapter/festival/ArtistDetailFestivalViewHolder.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/adapter/festival/ArtistDetailFestivalViewHolder.kt index 7a0713565..55867a9cb 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/adapter/festival/ArtistDetailFestivalViewHolder.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/artistdetail/adapter/festival/ArtistDetailFestivalViewHolder.kt @@ -29,6 +29,7 @@ class ArtistDetailFestivalViewHolder( fun bind(item: FestivalItemUiState) { binding.item = item artistAdapter.submitList(item.artists) + binding.tvEmptyStage.visibility = if (item.artists.isEmpty()) View.VISIBLE else View.GONE bindDDayView(item) } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/bookmarklist/festivalbookmark/adapater/FestivalBookmarkViewHolder.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/bookmarklist/festivalbookmark/adapater/FestivalBookmarkViewHolder.kt index 718c2e7a9..40d85ece8 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/bookmarklist/festivalbookmark/adapater/FestivalBookmarkViewHolder.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/bookmarklist/festivalbookmark/adapater/FestivalBookmarkViewHolder.kt @@ -30,6 +30,7 @@ class FestivalBookmarkViewHolder( fun bind(item: FestivalBookmarkItemUiState) { binding.item = item artistAdapter.submitList(item.artists) + binding.tvEmptyStage.visibility = if (item.artists.isEmpty()) View.VISIBLE else View.GONE bindDDayView(item) } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/festivallist/festival/FestivalListFestivalViewHolder.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/festivallist/festival/FestivalListFestivalViewHolder.kt index 5620b4db4..384ca62f9 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/festivallist/festival/FestivalListFestivalViewHolder.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/festivallist/festival/FestivalListFestivalViewHolder.kt @@ -32,6 +32,7 @@ class FestivalListFestivalViewHolder( fun bind(item: FestivalItemUiState) { binding.item = item artistAdapter.submitList(item.artists) + binding.tvEmptyStage.visibility = if (item.artists.isEmpty()) View.VISIBLE else View.GONE bindDDayView(item) } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/mypage/MyPageFragment.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/mypage/MyPageFragment.kt index bd565da21..a5496471b 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/mypage/MyPageFragment.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/home/mypage/MyPageFragment.kt @@ -59,7 +59,7 @@ class MyPageFragment : Fragment() { binding.tvPersonalInfoPolicy.setOnClickListener { val intent = Intent(Intent.ACTION_VIEW) intent.data = - Uri.parse("https://wooteco-ash.notion.site/fe0ca28535044db999d998eb4ea37e83") + Uri.parse("https://sites.google.com/view/privacy-festago") startActivity(intent) } } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFestivalViewHolder.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFestivalViewHolder.kt index 66fb4407d..3450236c5 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFestivalViewHolder.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFestivalViewHolder.kt @@ -28,6 +28,7 @@ class SchoolDetailFestivalViewHolder( fun bind(item: FestivalItemUiState) { binding.item = item artistAdapter.submitList(item.artists) + binding.tvEmptyStage.visibility = if (item.artists.isEmpty()) View.VISIBLE else View.GONE bindDDayView(item) } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFragment.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFragment.kt index 530e5d158..7f16a4ed8 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFragment.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailFragment.kt @@ -17,7 +17,6 @@ import com.festago.festago.presentation.R import com.festago.festago.presentation.databinding.FragmentSchoolDetailBinding import com.festago.festago.presentation.databinding.ItemMediaBinding import com.festago.festago.presentation.ui.artistdetail.ArtistDetailArgs -import com.festago.festago.presentation.ui.bindingadapter.setImage import com.festago.festago.presentation.ui.festivaldetail.FestivalDetailArgs import com.festago.festago.presentation.ui.schooldetail.uistate.MoreItemUiState import com.festago.festago.presentation.ui.schooldetail.uistate.SchoolDetailUiState @@ -74,7 +73,6 @@ class SchoolDetailFragment : Fragment() { private fun loadSchoolDetail() { binding.tvSchoolName.text = args.school.name - binding.ivSchoolLogoImage.setImage(args.school.profileImageUrl) val delayTimeMillis = resources.getInteger(R.integer.nav_Anim_time).toLong() vm.loadSchoolDetail(args.school.id, delayTimeMillis) } @@ -97,7 +95,6 @@ class SchoolDetailFragment : Fragment() { binding.successUiState = uiState binding.ivBookmark.isSelected = uiState.bookmarked binding.tvSchoolName.text = uiState.schoolInfo.schoolName - binding.ivSchoolLogoImage.setImage(uiState.schoolInfo.logoUrl) val items: List = if (uiState.isLast) { uiState.festivals } else { diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailViewModel.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailViewModel.kt index d719183b2..15889257b 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailViewModel.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/schooldetail/SchoolDetailViewModel.kt @@ -49,7 +49,9 @@ class SchoolDetailViewModel @Inject constructor( viewModelScope.launch { val deferredSchoolInfo = async { schoolRepository.loadSchoolInfo(schoolId, delayTimeMillis) } - val deferredFestivalPage = async { schoolRepository.loadSchoolFestivals(schoolId) } + val deferredFestivalPage = async { + schoolRepository.loadSchoolFestivals(schoolId = schoolId, size = FESTIVAL_PAGE_SIZE) + } runCatching { val schoolInfo = deferredSchoolInfo.await().getOrThrow() @@ -87,18 +89,17 @@ class SchoolDetailViewModel @Inject constructor( viewModelScope.launch { val currentFestivals = successUiState.festivals - val lastItem = successUiState.festivals.lastOrNull() - val isPast = when { - lastItem == null -> true - lastItem.endDate > LocalDate.now() -> true - successUiState.isLast -> true - else -> false - } + val lastItem = currentFestivals.lastOrNull() + val isPast = + lastItem?.endDate?.isBefore(LocalDate.now()) ?: true || successUiState.isLast + val lastFestivalId = if (successUiState.isLast) null else lastItem?.id + val lastStartDate = if (successUiState.isLast) null else lastItem?.startDate schoolRepository.loadSchoolFestivals( schoolId = schoolId, - lastFestivalId = currentFestivals.lastOrNull()?.id?.toInt(), - lastStartDate = currentFestivals.lastOrNull()?.startDate, + lastFestivalId = lastFestivalId?.toInt(), + lastStartDate = lastStartDate, isPast = isPast, + size = FESTIVAL_PAGE_SIZE, ).onSuccess { festivalsPage -> _uiState.value = successUiState.copy( festivals = currentFestivals + festivalsPage.festivals.map { it.toUiState() }, @@ -185,6 +186,7 @@ class SchoolDetailViewModel @Inject constructor( ) companion object { + private const val FESTIVAL_PAGE_SIZE = 20 private const val KEY_LOAD_SCHOOL_DETAIL = "KEY_LOAD_SCHOOL_DETAIL" private const val KEY_LOAD_MORE_SCHOOL_FESTIVALS = "KEY_LOAD_MORE_SCHOOL_FESTIVALS" } diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/search/festivalsearch/FestivalSearchViewHolder.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/search/festivalsearch/FestivalSearchViewHolder.kt index 92cd60565..3a3de1cdb 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/search/festivalsearch/FestivalSearchViewHolder.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/search/festivalsearch/FestivalSearchViewHolder.kt @@ -30,6 +30,7 @@ class FestivalSearchViewHolder( fun bind(item: FestivalSearchItemUiState) { binding.item = item artistAdapter.submitList(item.artists) + binding.tvEmptyStage.visibility = if (item.artists.isEmpty()) View.VISIBLE else View.GONE binding.tvFestivalDDay.bindFestivalDday(item) } diff --git a/android/festago/presentation/src/main/res/layout/fragment_bookmark_list.xml b/android/festago/presentation/src/main/res/layout/fragment_bookmark_list.xml index 497ae5060..e33044f1f 100644 --- a/android/festago/presentation/src/main/res/layout/fragment_bookmark_list.xml +++ b/android/festago/presentation/src/main/res/layout/fragment_bookmark_list.xml @@ -34,7 +34,7 @@ app:tabIndicatorHeight="2dp" app:tabSelectedTextColor="@color/contents_gray_07" app:tabTextAppearance="@style/H4Bold16Lh20" - app:tabTextColor="@color/contents_gray_07"> + app:tabTextColor="@color/contents_gray_05"> + app:layout_constraintTop_toBottomOf="@id/tvMyPageAppbar"> + android:contentDescription="@null" + android:src="@drawable/ic_user_profile_default" /> diff --git a/android/festago/presentation/src/main/res/layout/item_artist_detail_festival.xml b/android/festago/presentation/src/main/res/layout/item_artist_detail_festival.xml index 2c162e18d..9de0574d5 100644 --- a/android/festago/presentation/src/main/res/layout/item_artist_detail_festival.xml +++ b/android/festago/presentation/src/main/res/layout/item_artist_detail_festival.xml @@ -106,7 +106,6 @@ + android:src="@drawable/img_default_school" /> + app:layout_constraintBottom_toBottomOf="parent" + + app:layout_constraintStart_toStartOf="@+id/tvArtistName" + app:layout_constraintTop_toBottomOf="@+id/tvArtistName" /> diff --git a/android/festago/presentation/src/main/res/layout/item_search_festival.xml b/android/festago/presentation/src/main/res/layout/item_search_festival.xml index bfe525bc6..e1b4c595c 100644 --- a/android/festago/presentation/src/main/res/layout/item_search_festival.xml +++ b/android/festago/presentation/src/main/res/layout/item_search_festival.xml @@ -107,7 +107,6 @@ + android:src="@drawable/img_default_school" + tools:src="@drawable/img_default_school" />