From 3df0618e777bb5b1c457f884a809c0424dc1da0e Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 15:59:12 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[FEAT/#306]=20=ED=83=90=EC=83=89=20?= =?UTF-8?q?=EB=B7=B0=20=ED=8F=B0=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/search/search/component/SearchIntern.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt b/feature/search/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt index ac785610..d1bf5f3c 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt @@ -90,7 +90,7 @@ fun SearchIntern( Column { ThreeLineHeightText( text = title, - style = TerningTheme.typography.body6 + style = TerningTheme.typography.body5 ) } } From b4df9474af1f3b7db6f2107c507dcf25a28f14dc Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 16:18:29 +0900 Subject: [PATCH 02/10] =?UTF-8?q?[FEAT/#306]=20=ED=83=90=EC=83=89=20?= =?UTF-8?q?=EB=B7=B0=20=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/search/search/SearchRoute.kt | 13 +++++----- .../search/navigation/SearchNavigation.kt | 25 +++---------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt index f52c33d8..c9b11cfe 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -4,6 +4,7 @@ import androidx.browser.customtabs.CustomTabsIntent import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -38,10 +39,10 @@ import okhttp3.internal.toImmutableList @Composable fun SearchRoute( - modifier: Modifier, + paddingValues: PaddingValues, + viewModel: SearchViewModel = hiltViewModel(), navigateToSearchProcess: () -> Unit, navigateToIntern: (Long) -> Unit, - viewModel: SearchViewModel = hiltViewModel(), ) { val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current @@ -78,7 +79,7 @@ fun SearchRoute( } SearchScreen( - modifier = modifier, + paddingValues = paddingValues, bannerList = SearchViewModel.bannerList, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, @@ -103,7 +104,7 @@ fun SearchRoute( @Composable fun SearchScreen( - modifier: Modifier = Modifier, + paddingValues: PaddingValues, bannerList: List, searchViewsList: List, searchScrapsList: List, @@ -112,9 +113,9 @@ fun SearchScreen( onAdvertisementClick: (Int) -> Unit, ) { Column( - modifier = modifier - .fillMaxSize() + modifier = Modifier .background(White) + .padding(paddingValues) ) { TerningImage( painter = R.drawable.ic_terning_logo_typo, diff --git a/feature/search/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt b/feature/search/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt index caa41ce8..f3be18a9 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt @@ -1,18 +1,12 @@ package com.terning.feature.search.search.navigation -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.padding -import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder -import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute import com.terning.feature.search.search.SearchRoute -import com.terning.feature.search.searchprocess.navigation.navigateSearchProcess import kotlinx.serialization.Serializable fun NavController.navigateSearch(navOptions: NavOptions? = null) { @@ -23,26 +17,13 @@ fun NavController.navigateSearch(navOptions: NavOptions? = null) { } fun NavGraphBuilder.searchNavGraph( + paddingValues: PaddingValues, navigateSearchProcess: () -> Unit, navigateIntern: (Long) -> Unit, - paddingValues: PaddingValues, ) { - composable( - exitTransition = { - ExitTransition.None - }, - popEnterTransition = { - EnterTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popExitTransition = { - ExitTransition.None - } - ) { + composable { SearchRoute( - modifier = Modifier.padding(paddingValues), + paddingValues = paddingValues, navigateToSearchProcess = navigateSearchProcess, navigateToIntern = navigateIntern ) From 1d56e22a52305c754e21ae7eb837c5c4c3765e56 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 16:21:57 +0900 Subject: [PATCH 03/10] =?UTF-8?q?[FEAT/#306]=20=ED=83=90=EC=83=89=20?= =?UTF-8?q?=EC=A7=84=ED=96=89=20=EB=B7=B0=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../searchprocess/SearchProcessRoute.kt | 13 ++++++------ .../navigation/SearchProcessNavigation.kt | 21 +++---------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index 0cc28017..d9390e0c 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentWidth @@ -56,7 +55,7 @@ import com.terning.feature.search.searchprocess.models.SearchProcessState @Composable fun SearchProcessRoute( - modifier: Modifier, + paddingValues: PaddingValues, navController: NavHostController, navigateIntern: (Long) -> Unit, viewModel: SearchProcessViewModel = hiltViewModel(), @@ -93,7 +92,7 @@ fun SearchProcessRoute( } SearchProcessScreen( - modifier = modifier, + paddingValues = paddingValues, navigateToIntern = { viewModel.navigateIntern(it) }, navigateToBack = { navController.navigateUp() }, state = state, @@ -154,7 +153,7 @@ fun SearchProcessRoute( @Composable fun SearchProcessScreen( - modifier: Modifier = Modifier, + paddingValues: PaddingValues, navigateToIntern: (Long) -> Unit, navigateToBack: () -> Unit, state: SearchProcessState = SearchProcessState(), @@ -179,10 +178,10 @@ fun SearchProcessScreen( } Column( - modifier = modifier - .fillMaxSize() + modifier = Modifier .background(White) - .addFocusCleaner(focusManager), + .addFocusCleaner(focusManager) + .padding(paddingValues), ) { BackButtonTopAppBar( title = stringResource( diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt index b302fe19..474a91ca 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt @@ -1,7 +1,5 @@ package com.terning.feature.search.searchprocess.navigation -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.ui.Modifier @@ -22,26 +20,13 @@ fun NavController.navigateSearchProcess(navOptions: NavOptions? = null) { } fun NavGraphBuilder.searchProcessNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController, navigateIntern: (Long) -> Unit, - paddingValues: PaddingValues ) { - composable( - exitTransition = { - ExitTransition.None - }, - popEnterTransition = { - EnterTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popExitTransition = { - ExitTransition.None - } - ) { + composable { SearchProcessRoute( - modifier = Modifier.padding(paddingValues), + paddingValues = paddingValues, navController = navHostController, navigateIntern = { internshipAnnouncementId -> navigateIntern(internshipAnnouncementId) From 7342eff68d47213db5fbf1eaf95fb403390c2894 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 16:23:57 +0900 Subject: [PATCH 04/10] =?UTF-8?q?[DEL/#306]=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/searchprocess/navigation/SearchProcessNavigation.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt index 474a91ca..1b12b783 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/navigation/SearchProcessNavigation.kt @@ -1,8 +1,6 @@ package com.terning.feature.search.searchprocess.navigation import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.padding -import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController From 608733b59b154cd3245f0cba7b8c3a02496b8c06 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 16:31:32 +0900 Subject: [PATCH 05/10] =?UTF-8?q?[FEAT/#306]=20=EC=A2=8C=EC=9A=B0=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=20=ED=8C=A8=EB=94=A9=20=EA=B0=92=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/search/component/SearchInternList.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index f9e86d53..dedace6a 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -22,9 +22,7 @@ fun SearchInternList( searchViewsList: List?, navigateToIntern: (Long) -> Unit, ) { - Column( - modifier = Modifier.padding(horizontal = 24.dp) - ) { + Column { Text( text = stringResource( id = when (type) { @@ -33,12 +31,15 @@ fun SearchInternList( } ), style = TerningTheme.typography.body3, - color = Grey400 + color = Grey400, + modifier = Modifier.padding(horizontal = 24.dp) ) LazyRow( - modifier = Modifier.padding(vertical = 12.dp), + modifier = Modifier + .padding(vertical = 12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp), + contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 24.dp) ) { when (type) { InternListType.VIEW -> searchViewsList?.let { @@ -64,6 +65,7 @@ fun SearchInternList( } } } + Spacer(modifier = Modifier.padding(top = 20.dp)) } -} \ No newline at end of file +} From 7e525046906424485a2562213bd5fb4116583a2e Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 17:08:03 +0900 Subject: [PATCH 06/10] =?UTF-8?q?[FEAT/#306]=20=EB=B0=B0=EB=84=88=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/datasource/SearchDataSource.kt | 2 + .../datasourceimpl/SearchDataSourceImpl.kt | 4 ++ .../dto/response/SearchBannersResponseDto.kt | 18 +++++++ .../data/search/mapper/SearchBannersMapper.kt | 13 +++++ .../repositoryimpl/SearchRepositoryImpl.kt | 7 +++ .../data/search/service/SearchService.kt | 4 ++ .../domain/search/entity/SearchBanner.kt | 4 +- .../search/repository/SearchRepository.kt | 3 ++ .../feature/search/search/SearchRoute.kt | 12 +++-- .../feature/search/search/SearchViewModel.kt | 38 +++++++------ .../search/search/component/ImageSlider.kt | 53 ++++++++++--------- .../search/model/SearchBannerListState.kt | 8 +++ 12 files changed, 119 insertions(+), 47 deletions(-) create mode 100644 data/search/src/main/java/com/terning/data/search/dto/response/SearchBannersResponseDto.kt create mode 100644 data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt create mode 100644 feature/search/src/main/java/com/terning/feature/search/search/model/SearchBannerListState.kt diff --git a/data/search/src/main/java/com/terning/data/search/datasource/SearchDataSource.kt b/data/search/src/main/java/com/terning/data/search/datasource/SearchDataSource.kt index 9743bf91..c7a997b7 100644 --- a/data/search/src/main/java/com/terning/data/search/datasource/SearchDataSource.kt +++ b/data/search/src/main/java/com/terning/data/search/datasource/SearchDataSource.kt @@ -3,10 +3,12 @@ package com.terning.data.search.datasource import com.terning.core.network.BaseResponse import com.terning.data.search.dto.request.SearchRequestDto import com.terning.data.search.dto.response.SearchAnnouncementResponseDto +import com.terning.data.search.dto.response.SearchBannersResponseDto import com.terning.data.search.dto.response.SearchResultResponseDto interface SearchDataSource { suspend fun getSearch(request: SearchRequestDto): BaseResponse suspend fun getSearchViews(): BaseResponse suspend fun getSearchScraps(): BaseResponse + suspend fun getSearchBanners(): BaseResponse } \ No newline at end of file diff --git a/data/search/src/main/java/com/terning/data/search/datasourceimpl/SearchDataSourceImpl.kt b/data/search/src/main/java/com/terning/data/search/datasourceimpl/SearchDataSourceImpl.kt index 774624f7..9b4136bb 100644 --- a/data/search/src/main/java/com/terning/data/search/datasourceimpl/SearchDataSourceImpl.kt +++ b/data/search/src/main/java/com/terning/data/search/datasourceimpl/SearchDataSourceImpl.kt @@ -4,6 +4,7 @@ import com.terning.core.network.BaseResponse import com.terning.data.search.datasource.SearchDataSource import com.terning.data.search.dto.request.SearchRequestDto import com.terning.data.search.dto.response.SearchAnnouncementResponseDto +import com.terning.data.search.dto.response.SearchBannersResponseDto import com.terning.data.search.dto.response.SearchResultResponseDto import com.terning.data.search.service.SearchService import javax.inject.Inject @@ -26,4 +27,7 @@ class SearchDataSourceImpl @Inject constructor( override suspend fun getSearchScraps(): BaseResponse = searchService.getSearchScrapsList() + + override suspend fun getSearchBanners(): BaseResponse = + searchService.getSearchBannerList() } \ No newline at end of file diff --git a/data/search/src/main/java/com/terning/data/search/dto/response/SearchBannersResponseDto.kt b/data/search/src/main/java/com/terning/data/search/dto/response/SearchBannersResponseDto.kt new file mode 100644 index 00000000..b4b70ee6 --- /dev/null +++ b/data/search/src/main/java/com/terning/data/search/dto/response/SearchBannersResponseDto.kt @@ -0,0 +1,18 @@ +package com.terning.data.search.dto.response + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class SearchBannersResponseDto( + @SerialName("banners") + val banners: List, +) { + @Serializable + data class BannerDto( + @SerialName("imageUrl") + val imageUrl: String, + @SerialName("link") + val link: String, + ) +} \ No newline at end of file diff --git a/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt b/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt new file mode 100644 index 00000000..ee8506d2 --- /dev/null +++ b/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt @@ -0,0 +1,13 @@ +package com.terning.data.search.mapper + +import com.terning.data.search.dto.response.SearchBannersResponseDto +import com.terning.domain.search.entity.SearchBanner + +fun SearchBannersResponseDto.toSearchBannerList(): List { + return banners.map { + SearchBanner( + imageRes = it.imageUrl, + url = it.link, + ) + } +} \ No newline at end of file diff --git a/data/search/src/main/java/com/terning/data/search/repositoryimpl/SearchRepositoryImpl.kt b/data/search/src/main/java/com/terning/data/search/repositoryimpl/SearchRepositoryImpl.kt index 15b697c2..69ce5e55 100644 --- a/data/search/src/main/java/com/terning/data/search/repositoryimpl/SearchRepositoryImpl.kt +++ b/data/search/src/main/java/com/terning/data/search/repositoryimpl/SearchRepositoryImpl.kt @@ -2,8 +2,10 @@ package com.terning.data.search.repositoryimpl import com.terning.data.search.datasource.SearchDataSource import com.terning.data.search.dto.request.SearchRequestDto +import com.terning.data.search.mapper.toSearchBannerList import com.terning.data.search.mapper.toSearchPopularAnnouncementList import com.terning.data.search.mapper.toSearchResultList +import com.terning.domain.search.entity.SearchBanner import com.terning.domain.search.entity.SearchPopularAnnouncement import com.terning.domain.search.entity.SearchResult import com.terning.domain.search.repository.SearchRepository @@ -39,4 +41,9 @@ class SearchRepositoryImpl @Inject constructor( runCatching { searchDataSource.getSearchScraps().result.toSearchPopularAnnouncementList() } + + override suspend fun getSearchBannersList(): Result> = + kotlin.runCatching { + searchDataSource.getSearchBanners().result.toSearchBannerList() + } } \ No newline at end of file diff --git a/data/search/src/main/java/com/terning/data/search/service/SearchService.kt b/data/search/src/main/java/com/terning/data/search/service/SearchService.kt index 1fd70ecb..0e8a15ae 100644 --- a/data/search/src/main/java/com/terning/data/search/service/SearchService.kt +++ b/data/search/src/main/java/com/terning/data/search/service/SearchService.kt @@ -2,6 +2,7 @@ package com.terning.data.search.service import com.terning.core.network.BaseResponse import com.terning.data.search.dto.response.SearchAnnouncementResponseDto +import com.terning.data.search.dto.response.SearchBannersResponseDto import com.terning.data.search.dto.response.SearchResultResponseDto import retrofit2.http.GET import retrofit2.http.Query @@ -20,4 +21,7 @@ interface SearchService { @GET("api/v1/search/scraps") suspend fun getSearchScrapsList(): BaseResponse + + @GET("api/v1/search/banners") + suspend fun getSearchBannerList(): BaseResponse } \ No newline at end of file diff --git a/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt b/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt index fcc52d65..4da5bfdf 100644 --- a/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt +++ b/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt @@ -1,6 +1,6 @@ package com.terning.domain.search.entity data class SearchBanner( - val imageRes: Int, - val url: String + val imageRes: String, + val url: String, ) diff --git a/domain/search/src/main/java/com/terning/domain/search/repository/SearchRepository.kt b/domain/search/src/main/java/com/terning/domain/search/repository/SearchRepository.kt index 52b38dd0..9600fda8 100644 --- a/domain/search/src/main/java/com/terning/domain/search/repository/SearchRepository.kt +++ b/domain/search/src/main/java/com/terning/domain/search/repository/SearchRepository.kt @@ -1,5 +1,6 @@ package com.terning.domain.search.repository +import com.terning.domain.search.entity.SearchBanner import com.terning.domain.search.entity.SearchPopularAnnouncement import com.terning.domain.search.entity.SearchResult @@ -10,6 +11,8 @@ interface SearchRepository { page: Int, size: Int, ): Result> + suspend fun getSearchViewsList(): Result> suspend fun getSearchScrapsList(): Result> + suspend fun getSearchBannersList(): Result> } \ No newline at end of file diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt index c9b11cfe..6f8483bd 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -47,6 +46,7 @@ fun SearchRoute( val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current + val bannerState by viewModel.bannerState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner) val viewState by viewModel.viewState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner) val scrapState by viewModel.scrapState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner) @@ -55,6 +55,7 @@ fun SearchRoute( LaunchedEffect(key1 = true) { viewModel.getSearchViews() viewModel.getSearchScraps() + viewModel.getSearchBanners() } LaunchedEffect(viewModel.sideEffect, lifecycleOwner) { @@ -68,6 +69,11 @@ fun SearchRoute( } } + val bannerList = when (bannerState.searchBannersList) { + is UiState.Success -> (bannerState.searchBannersList as UiState.Success>).data.toImmutableList() + else -> emptyList() + } + val searchViewsList = when (viewState.searchViewsList) { is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data.toImmutableList() else -> emptyList() @@ -80,7 +86,7 @@ fun SearchRoute( SearchScreen( paddingValues = paddingValues, - bannerList = SearchViewModel.bannerList, + bannerList = bannerList, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, navigateToSearchProcess = { @@ -97,7 +103,7 @@ fun SearchRoute( name = "quest_banner" ) CustomTabsIntent.Builder().build() - .launchUrl(context, SearchViewModel.bannerList[pageIndex].url.toUri()) + .launchUrl(context, bannerList[pageIndex].url.toUri()) } ) } diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt index d741c947..1c0f4014 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.core.designsystem.state.UiState import com.terning.feature.search.R +import com.terning.feature.search.search.model.SearchBannerListState import com.terning.feature.search.search.model.SearchScrapsListState import com.terning.feature.search.search.model.SearchViewsListState import dagger.hilt.android.lifecycle.HiltViewModel @@ -27,12 +28,20 @@ class SearchViewModel @Inject constructor( MutableStateFlow(SearchScrapsListState()) val scrapState: StateFlow = _scrapState.asStateFlow() + private val _bannerState: MutableStateFlow = + MutableStateFlow(SearchBannerListState()) + val bannerState: StateFlow = _bannerState.asStateFlow() + private val _sideEffect: MutableSharedFlow = MutableSharedFlow() val sideEffect = _sideEffect.asSharedFlow() + private val _bannerList: MutableStateFlow> = + MutableStateFlow(emptyList()) + init { getSearchViews() getSearchScraps() + getSearchBanners() } fun getSearchViews() { @@ -61,20 +70,17 @@ class SearchViewModel @Inject constructor( } } - companion object { - val bannerList: List = listOf( - com.terning.domain.search.entity.SearchBanner( - imageRes = R.drawable.img_ad_1, - url = "https://www.instagram.com/p/DBWCO97TRds/?igsh=bDhjMGxlMGliNDc2" - ), - com.terning.domain.search.entity.SearchBanner( - imageRes = R.drawable.img_ad_2, - url = "https://www.instagram.com/terning_official/" - ), - com.terning.domain.search.entity.SearchBanner( - imageRes = R.drawable.img_ad_3, - url = "https://forms.gle/4btEwEbUQ3JSjTKP7" - ) - ) + fun getSearchBanners() { + viewModelScope.launch { + searchRepository.getSearchBannersList() + .onSuccess { searchBannersList -> + _bannerState.value = _bannerState.value.copy( + searchBannersList = UiState.Success(searchBannersList) + ) + _bannerList.value = searchBannersList + }.onFailure { + _sideEffect.emit(SearchSideEffect.Toast(R.string.server_failure)) + } + } } -} \ No newline at end of file +} diff --git a/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt b/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt index 1e7a6ed4..6a5c675f 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt @@ -1,6 +1,5 @@ package com.terning.feature.search.search.component -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -15,8 +14,8 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp +import coil3.compose.AsyncImage import com.terning.core.designsystem.extension.noRippleClickable import com.terning.core.designsystem.theme.Grey200 import kotlinx.coroutines.delay @@ -29,7 +28,7 @@ fun ImageSlider( ) { val pagerState = rememberPagerState( initialPage = 0, - pageCount = { Int.MAX_VALUE } + pageCount = { if (images.isEmpty()) 0 else Int.MAX_VALUE } ) val autoScroll = remember { mutableStateOf(true) } @@ -37,8 +36,8 @@ fun ImageSlider( if (autoScroll.value) { while (true) { delay(2500) - if (!pagerState.isScrollInProgress) { - val nextPage = pagerState.currentPage + 1 + if (!pagerState.isScrollInProgress && images.isNotEmpty()) { + val nextPage = (pagerState.currentPage + 1) % images.size pagerState.animateScrollToPage(nextPage) } } @@ -51,30 +50,32 @@ fun ImageSlider( .background(Grey200), horizontalAlignment = Alignment.CenterHorizontally ) { - Box( - modifier = modifier, - contentAlignment = Alignment.BottomCenter - ) { - HorizontalPager( - state = pagerState, + if (images.isNotEmpty()) { + Box( modifier = modifier, - beyondViewportPageCount = 1 - ) { currentPage -> - val pageIndex = currentPage % images.size - Image( - painter = painterResource(id = images[pageIndex].imageRes), - contentDescription = null, - modifier = modifier - .fillMaxWidth() - .height(112.dp) - .noRippleClickable { onAdvertisementClick(pageIndex) }, - contentScale = ContentScale.Crop, + contentAlignment = Alignment.BottomCenter + ) { + HorizontalPager( + state = pagerState, + modifier = modifier, + beyondViewportPageCount = 1 + ) { currentPage -> + val pageIndex = currentPage % images.size + AsyncImage( + model = images[pageIndex].url, + contentDescription = null, + modifier = modifier + .fillMaxWidth() + .height(112.dp) + .noRippleClickable { onAdvertisementClick(pageIndex) }, + contentScale = ContentScale.Crop + ) + } + DotsIndicator( + pageCount = images.size, + currentPage = pagerState.currentPage % images.size ) } - DotsIndicator( - pageCount = images.size, - currentPage = pagerState.currentPage % images.size - ) } } } diff --git a/feature/search/src/main/java/com/terning/feature/search/search/model/SearchBannerListState.kt b/feature/search/src/main/java/com/terning/feature/search/search/model/SearchBannerListState.kt new file mode 100644 index 00000000..b56b59d2 --- /dev/null +++ b/feature/search/src/main/java/com/terning/feature/search/search/model/SearchBannerListState.kt @@ -0,0 +1,8 @@ +package com.terning.feature.search.search.model + +import com.terning.core.designsystem.state.UiState +import com.terning.domain.search.entity.SearchBanner + +data class SearchBannerListState( + var searchBannersList: UiState> = UiState.Loading, +) \ No newline at end of file From 9f149eb59ee6f261bd01df0b1296e30d9ab1a59b Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 4 Jan 2025 17:23:35 +0900 Subject: [PATCH 07/10] =?UTF-8?q?[FEAT/#306]=20=EB=B0=B0=EB=84=88=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EB=A7=A4=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/search/mapper/SearchBannersMapper.kt | 2 +- .../domain/search/entity/SearchBanner.kt | 2 +- .../feature/search/search/SearchRoute.kt | 2 +- .../search/search/component/ImageSlider.kt | 27 ++++++++++++------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt b/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt index ee8506d2..82a4583e 100644 --- a/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt +++ b/data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt @@ -6,7 +6,7 @@ import com.terning.domain.search.entity.SearchBanner fun SearchBannersResponseDto.toSearchBannerList(): List { return banners.map { SearchBanner( - imageRes = it.imageUrl, + imageUrl = it.imageUrl, url = it.link, ) } diff --git a/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt b/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt index 4da5bfdf..94c5b778 100644 --- a/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt +++ b/domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt @@ -1,6 +1,6 @@ package com.terning.domain.search.entity data class SearchBanner( - val imageRes: String, + val imageUrl: String, val url: String, ) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt index 6f8483bd..c7ce931b 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -152,7 +152,7 @@ fun SearchScreen( LazyColumn { item { ImageSlider( - images = bannerList, + searchBanners = bannerList, onAdvertisementClick = onAdvertisementClick, ) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt b/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt index 6a5c675f..fc3a5e6f 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt @@ -14,21 +14,25 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import coil3.compose.AsyncImage +import coil3.request.ImageRequest +import coil3.request.crossfade import com.terning.core.designsystem.extension.noRippleClickable import com.terning.core.designsystem.theme.Grey200 +import com.terning.domain.search.entity.SearchBanner import kotlinx.coroutines.delay @Composable fun ImageSlider( modifier: Modifier = Modifier, - images: List, + searchBanners: List, onAdvertisementClick: (Int) -> Unit, ) { val pagerState = rememberPagerState( initialPage = 0, - pageCount = { if (images.isEmpty()) 0 else Int.MAX_VALUE } + pageCount = { Int.MAX_VALUE } ) val autoScroll = remember { mutableStateOf(true) } @@ -36,8 +40,8 @@ fun ImageSlider( if (autoScroll.value) { while (true) { delay(2500) - if (!pagerState.isScrollInProgress && images.isNotEmpty()) { - val nextPage = (pagerState.currentPage + 1) % images.size + if (!pagerState.isScrollInProgress) { + val nextPage = pagerState.currentPage + 1 pagerState.animateScrollToPage(nextPage) } } @@ -50,7 +54,7 @@ fun ImageSlider( .background(Grey200), horizontalAlignment = Alignment.CenterHorizontally ) { - if (images.isNotEmpty()) { + if (searchBanners.isNotEmpty()) { Box( modifier = modifier, contentAlignment = Alignment.BottomCenter @@ -60,20 +64,23 @@ fun ImageSlider( modifier = modifier, beyondViewportPageCount = 1 ) { currentPage -> - val pageIndex = currentPage % images.size + val pageIndex = currentPage % searchBanners.size AsyncImage( - model = images[pageIndex].url, + model = ImageRequest.Builder(LocalContext.current) + .data(searchBanners[pageIndex].imageUrl) + .crossfade(true) + .build(), contentDescription = null, modifier = modifier .fillMaxWidth() .height(112.dp) .noRippleClickable { onAdvertisementClick(pageIndex) }, - contentScale = ContentScale.Crop + contentScale = ContentScale.Crop, ) } DotsIndicator( - pageCount = images.size, - currentPage = pagerState.currentPage % images.size + pageCount = searchBanners.size, + currentPage = pagerState.currentPage % searchBanners.size ) } } From f52bcc1bcece108e9347a559dd2daba3e5482b41 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 10 Jan 2025 09:45:40 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[FIX/#306]=20=EA=B2=80=EC=83=89=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=9D=B4?= =?UTF-8?q?=EC=8A=88=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/search/searchprocess/SearchProcessRoute.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index d9390e0c..d86a2c57 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -70,7 +70,7 @@ fun SearchProcessRoute( viewModel.getSearchList( keyword = state.text, page = 0, - size = 0 + size = 100 ) } From 93639af7f4ad4b0feec03902cc9fe1dc687486a2 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 10 Jan 2025 10:02:43 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[FIX/#306]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EA=B8=B0=EB=B0=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/search/search/SearchRoute.kt | 25 +++++++++++-------- .../feature/search/search/SearchSideEffect.kt | 2 +- .../feature/search/search/SearchViewModel.kt | 11 +++----- .../search/search/component/ImageSlider.kt | 7 +++--- .../search/component/SearchInternList.kt | 3 ++- .../searchprocess/SearchProcessRoute.kt | 2 +- .../searchprocess/SearchProcessSideEffect.kt | 2 +- .../searchprocess/SearchProcessViewModel.kt | 2 +- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt index c7ce931b..452020cb 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -30,11 +30,14 @@ import com.terning.core.designsystem.state.UiState import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White +import com.terning.domain.search.entity.SearchBanner +import com.terning.domain.search.entity.SearchPopularAnnouncement import com.terning.feature.search.R import com.terning.feature.search.search.component.ImageSlider import com.terning.feature.search.search.component.InternListType import com.terning.feature.search.search.component.SearchInternList -import okhttp3.internal.toImmutableList +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList @Composable fun SearchRoute( @@ -62,7 +65,7 @@ fun SearchRoute( viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is SearchSideEffect.Toast -> { + is SearchSideEffect.ShowToast -> { sideEffect.message } } @@ -70,18 +73,18 @@ fun SearchRoute( } val bannerList = when (bannerState.searchBannersList) { - is UiState.Success -> (bannerState.searchBannersList as UiState.Success>).data.toImmutableList() - else -> emptyList() + is UiState.Success -> (bannerState.searchBannersList as UiState.Success>).data.toImmutableList() + else -> emptyList().toImmutableList() } val searchViewsList = when (viewState.searchViewsList) { - is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data.toImmutableList() - else -> emptyList() + is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data.toImmutableList() + else -> emptyList().toImmutableList() } val searchScrapsList = when (scrapState.searchScrapsList) { - is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data.toImmutableList() - else -> emptyList() + is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data.toImmutableList() + else -> emptyList().toImmutableList() } SearchScreen( @@ -111,9 +114,9 @@ fun SearchRoute( @Composable fun SearchScreen( paddingValues: PaddingValues, - bannerList: List, - searchViewsList: List, - searchScrapsList: List, + bannerList: ImmutableList, + searchViewsList: ImmutableList, + searchScrapsList: ImmutableList, navigateToSearchProcess: () -> Unit, navigateToIntern: (Long) -> Unit, onAdvertisementClick: (Int) -> Unit, diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchSideEffect.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchSideEffect.kt index b001b4c4..8be0348e 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchSideEffect.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchSideEffect.kt @@ -3,5 +3,5 @@ package com.terning.feature.search.search import androidx.annotation.StringRes sealed class SearchSideEffect { - data class Toast(@StringRes val message: Int) : SearchSideEffect() + data class ShowToast(@StringRes val message: Int) : SearchSideEffect() } \ No newline at end of file diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt index aadac376..59e35ea0 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchViewModel.kt @@ -3,7 +3,6 @@ package com.terning.feature.search.search import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.core.designsystem.state.UiState -import com.terning.feature.search.R import com.terning.feature.search.search.model.SearchBannerListState import com.terning.feature.search.search.model.SearchScrapsListState import com.terning.feature.search.search.model.SearchViewsListState @@ -37,9 +36,6 @@ class SearchViewModel @Inject constructor( private val _sideEffect: MutableSharedFlow = MutableSharedFlow() val sideEffect = _sideEffect.asSharedFlow() - private val _bannerList: MutableStateFlow> = - MutableStateFlow(emptyList()) - init { getSearchViews() getSearchScraps() @@ -54,7 +50,7 @@ class SearchViewModel @Inject constructor( searchViewsList = UiState.Success(searchViewsList) ) }.onFailure { - _sideEffect.emit(SearchSideEffect.Toast(DesignSystemR.string.server_failure)) + _sideEffect.emit(SearchSideEffect.ShowToast(DesignSystemR.string.server_failure)) } } } @@ -67,7 +63,7 @@ class SearchViewModel @Inject constructor( searchScrapsList = UiState.Success(searchScrapsList) ) }.onFailure { - _sideEffect.emit(SearchSideEffect.Toast(DesignSystemR.string.server_failure)) + _sideEffect.emit(SearchSideEffect.ShowToast(DesignSystemR.string.server_failure)) } } } @@ -79,9 +75,8 @@ class SearchViewModel @Inject constructor( _bannerState.value = _bannerState.value.copy( searchBannersList = UiState.Success(searchBannersList) ) - _bannerList.value = searchBannersList }.onFailure { - _sideEffect.emit(SearchSideEffect.Toast(R.string.server_failure)) + _sideEffect.emit(SearchSideEffect.ShowToast(DesignSystemR.string.server_failure)) } } } diff --git a/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt b/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt index fc3a5e6f..9c2b4951 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/component/ImageSlider.kt @@ -22,12 +22,13 @@ import coil3.request.crossfade import com.terning.core.designsystem.extension.noRippleClickable import com.terning.core.designsystem.theme.Grey200 import com.terning.domain.search.entity.SearchBanner +import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.delay @Composable fun ImageSlider( modifier: Modifier = Modifier, - searchBanners: List, + searchBanners: ImmutableList, onAdvertisementClick: (Int) -> Unit, ) { val pagerState = rememberPagerState( @@ -61,7 +62,7 @@ fun ImageSlider( ) { HorizontalPager( state = pagerState, - modifier = modifier, + modifier = Modifier, beyondViewportPageCount = 1 ) { currentPage -> val pageIndex = currentPage % searchBanners.size @@ -71,7 +72,7 @@ fun ImageSlider( .crossfade(true) .build(), contentDescription = null, - modifier = modifier + modifier = Modifier .fillMaxWidth() .height(112.dp) .noRippleClickable { onAdvertisementClick(pageIndex) }, diff --git a/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index dedace6a..8fae084d 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -2,6 +2,7 @@ package com.terning.feature.search.search.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyRow @@ -39,7 +40,7 @@ fun SearchInternList( modifier = Modifier .padding(vertical = 12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 24.dp) + contentPadding = PaddingValues(horizontal = 24.dp) ) { when (type) { InternListType.VIEW -> searchViewsList?.let { diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index d86a2c57..3c3bd52c 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -78,7 +78,7 @@ fun SearchProcessRoute( viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is SearchProcessSideEffect.Toast -> context.toast(sideEffect.message) + is SearchProcessSideEffect.ShowToast -> context.toast(sideEffect.message) is SearchProcessSideEffect.ScrapUpdate -> { sideEffect.keyword diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessSideEffect.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessSideEffect.kt index dcbc4a4a..cbbc4192 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessSideEffect.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessSideEffect.kt @@ -3,7 +3,7 @@ package com.terning.feature.search.searchprocess import androidx.annotation.StringRes sealed class SearchProcessSideEffect { - data class Toast(@StringRes val message: Int) : SearchProcessSideEffect() + data class ShowToast(@StringRes val message: Int) : SearchProcessSideEffect() data class ScrapUpdate(val keyword: String) : SearchProcessSideEffect() data class NavigateIntern(val internshipAnnouncementId: Long) : SearchProcessSideEffect() } \ No newline at end of file diff --git a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt index 0a47e8e2..f38e59db 100644 --- a/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt +++ b/feature/search/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt @@ -45,7 +45,7 @@ class SearchProcessViewModel @Inject constructor( _internSearchResultData.value = results } .onFailure { - _sideEffect.emit(SearchProcessSideEffect.Toast(DesignSystemR.string.server_failure)) + _sideEffect.emit(SearchProcessSideEffect.ShowToast(DesignSystemR.string.server_failure)) } } } From a4d4f6fb483679bf2be708338fea03ed9770bd28 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 10 Jan 2025 10:05:02 +0900 Subject: [PATCH 10/10] =?UTF-8?q?[FIX/#306]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EA=B8=B0=EB=B0=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/feature/search/search/SearchRoute.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt index 452020cb..0dbf6dd4 100644 --- a/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/search/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -42,9 +42,9 @@ import kotlinx.collections.immutable.toImmutableList @Composable fun SearchRoute( paddingValues: PaddingValues, - viewModel: SearchViewModel = hiltViewModel(), navigateToSearchProcess: () -> Unit, navigateToIntern: (Long) -> Unit, + viewModel: SearchViewModel = hiltViewModel(), ) { val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current