From 5da459778bd05cadd00111064814040e663530ab Mon Sep 17 00:00:00 2001 From: re4rk <37167652+re4rk@users.noreply.github.com> Date: Thu, 2 May 2024 02:09:26 +0900 Subject: [PATCH] refactor(Bookmark): ktlint --- .../di/singletonscope/RepositoryModule.kt | 1 - .../festivaldetail/FestivalDetailViewModel.kt | 35 ++++++++----------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/android/festago/data/src/main/java/com/festago/festago/data/di/singletonscope/RepositoryModule.kt b/android/festago/data/src/main/java/com/festago/festago/data/di/singletonscope/RepositoryModule.kt index 645ea4154..4d316faf7 100644 --- a/android/festago/data/src/main/java/com/festago/festago/data/di/singletonscope/RepositoryModule.kt +++ b/android/festago/data/src/main/java/com/festago/festago/data/di/singletonscope/RepositoryModule.kt @@ -7,7 +7,6 @@ import com.festago.festago.data.repository.DefaultRecentSearchRepository import com.festago.festago.data.repository.DefaultSchoolRepository import com.festago.festago.data.repository.DefaultSearchRepository import com.festago.festago.data.repository.DefaultUserRepository -import com.festago.festago.data.repository.FakeBookmarkRepository import com.festago.festago.domain.repository.ArtistRepository import com.festago.festago.domain.repository.BookmarkRepository import com.festago.festago.domain.repository.FestivalRepository diff --git a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/festivaldetail/FestivalDetailViewModel.kt b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/festivaldetail/FestivalDetailViewModel.kt index f99db44c7..d571b1674 100644 --- a/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/festivaldetail/FestivalDetailViewModel.kt +++ b/android/festago/presentation/src/main/java/com/festago/festago/presentation/ui/festivaldetail/FestivalDetailViewModel.kt @@ -60,27 +60,24 @@ class FestivalDetailViewModel @Inject constructor( value = it.message.toString(), ) } - - } } - private fun FestivalDetail.toSuccessUiState() = - FestivalDetailUiState.Success( - festival = FestivalUiState( - id = id, - name = name, - startDate = startDate, - endDate = endDate, - posterImageUrl = posterImageUrl, - school = school, - onSchoolClick = ::showSchoolDetail, - socialMedias = socialMedias, - ), - bookmarked = false, - stages = stages.map { it.toUiState() }, - onBookmarkClick = { festivalId -> toggleFestivalBookmark(festivalId) }, - ) + private fun FestivalDetail.toSuccessUiState() = FestivalDetailUiState.Success( + festival = FestivalUiState( + id = id, + name = name, + startDate = startDate, + endDate = endDate, + posterImageUrl = posterImageUrl, + school = school, + onSchoolClick = ::showSchoolDetail, + socialMedias = socialMedias, + ), + bookmarked = false, + stages = stages.map { it.toUiState() }, + onBookmarkClick = { festivalId -> toggleFestivalBookmark(festivalId) }, + ) private fun toggleFestivalBookmark(festivalId: Long) { viewModelScope.launch { @@ -90,12 +87,10 @@ class FestivalDetailViewModel @Inject constructor( bookmarkRepository.deleteFestivalBookmark(festivalId) .onSuccess { _uiState.value = uiState.copy(bookmarked = false) } .onFailure { _event.emit(FailedToFetchBookmarkList("최대 북마크 갯수를 초과했습니다")) } - } else { bookmarkRepository.addFestivalBookmark(festivalId) .onSuccess { _uiState.value = uiState.copy(bookmarked = true) } .onFailure { _event.emit(FailedToFetchBookmarkList("최대 북마크 갯수를 초과했습니다")) } - } } }