diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt index c5aa71711..f030ccec4 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt @@ -11,6 +11,19 @@ import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme + +/** + * 검색창 텍스트 필드 컴포저블입니다. + * + * @param text 텍스트 필드에 표시될 텍스트입니다. + * @param onValueChange 텍스트 필드의 값이 변경될 때 호출되는 콜백 함수입니다. + * @param modifier 텍스트 필드에 적용될 Modifier입니다. + * @param hint 텍스트 필드에 아무것도 입력하지 않았을 때 표시될 힌트 텍스트입니다. + * @param leftIcon 텍스트 필드의 왼쪽에 표시될 아이콘의 리소스 ID입니다. + * @param enabled 텍스트 필드가 활성화되어 있는지 여부를 나타냅니다. + * @param readOnly 텍스트 필드가 읽기 전용인지 여부를 나타냅니다. + * @param onSearchAction 사용자가 키보드에서 검색을 실행할 때 호출되는 콜백 함수입니다. + */ @Composable fun SearchTextField( text: String = "", diff --git a/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt b/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt index 9539e0424..5e00c6955 100644 --- a/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt +++ b/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt @@ -3,11 +3,10 @@ package com.terning.data.datasource import com.terning.data.dto.BaseResponse import com.terning.data.dto.request.SearchRequestDto import com.terning.data.dto.response.SearchResultResponseDto -import com.terning.data.dto.response.SearchScrapsResponseDto -import com.terning.data.dto.response.SearchViewsResponseDto +import com.terning.data.dto.response.SearchAnnouncementResponseDto interface SearchDataSource { suspend fun getSearch(request: SearchRequestDto): BaseResponse - suspend fun getSearchViews(): BaseResponse - suspend fun getSearchScraps(): BaseResponse + suspend fun getSearchViews(): BaseResponse + suspend fun getSearchScraps(): BaseResponse } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt index ba16f394a..2d2397e79 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt @@ -4,8 +4,7 @@ import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.BaseResponse import com.terning.data.dto.request.SearchRequestDto import com.terning.data.dto.response.SearchResultResponseDto -import com.terning.data.dto.response.SearchScrapsResponseDto -import com.terning.data.dto.response.SearchViewsResponseDto +import com.terning.data.dto.response.SearchAnnouncementResponseDto import com.terning.data.service.SearchService import javax.inject.Inject @@ -22,9 +21,9 @@ class SearchDataSourceImpl @Inject constructor( request.size ) - override suspend fun getSearchViews(): BaseResponse = + override suspend fun getSearchViews(): BaseResponse = searchService.getSearchViewsList() - override suspend fun getSearchScraps(): BaseResponse = + override suspend fun getSearchScraps(): BaseResponse = searchService.getSearchScrapsList() } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchAnnouncementResponseDto.kt similarity index 54% rename from data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt rename to data/src/main/java/com/terning/data/dto/response/SearchAnnouncementResponseDto.kt index f099507e6..350218693 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchAnnouncementResponseDto.kt @@ -1,12 +1,11 @@ package com.terning.data.dto.response -import com.terning.domain.entity.response.InternshipAnnouncementModel import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class SearchScrapsResponseDto( +data class SearchAnnouncementResponseDto( @SerialName("announcements") val announcements: List, ) { @@ -19,14 +18,4 @@ data class SearchScrapsResponseDto( @SerialName("title") val title: String, ) - - fun toSearchScrapsEntity(): List { - return announcements.map { - InternshipAnnouncementModel( - announcementId = it.internshipAnnouncementId, - companyImage = it.companyImage, - title = it.title, - ) - } - } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt index 35a1baba1..14e7e4bf2 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt @@ -1,6 +1,5 @@ package com.terning.data.dto.response -import com.terning.domain.entity.response.SearchResultModel import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -34,20 +33,4 @@ data class SearchResultResponseDto( @SerialName("deadline") val deadline: String, ) - - fun toSearchResultEntity(): List { - return announcements.map { - SearchResultModel( - internshipAnnouncementId = it.internshipAnnouncementId, - title = it.title, - dDay = it.dDay, - workingPeriod = it.workingPeriod, - companyImage = it.companyImage, - scrapId = it.scrapId, - deadline = it.deadline, - startYearMonth = it.startYearMonth, - color = it.color - ) - } - } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt deleted file mode 100644 index 99ebe7227..000000000 --- a/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.terning.data.dto.response - -import com.terning.domain.entity.response.InternshipAnnouncementModel -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -data class SearchViewsResponseDto( - @SerialName("announcements") - val announcements: List, -) { - @Serializable - data class ViewsAnnouncementDto( - @SerialName("internshipAnnouncementId") - val internshipAnnouncementId: Long, - @SerialName("companyImage") - val companyImage: String, - @SerialName("title") - val title: String, - ) - - fun toSearchViewsEntity(): List { - return announcements.map { - InternshipAnnouncementModel( - announcementId = it.internshipAnnouncementId, - companyImage = it.companyImage, - title = it.title, - ) - } - } -} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt new file mode 100644 index 000000000..739297bff --- /dev/null +++ b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt @@ -0,0 +1,14 @@ +package com.terning.data.mapper.search + +import com.terning.data.dto.response.SearchAnnouncementResponseDto +import com.terning.domain.entity.search.SearchPopularAnnouncement + +fun SearchAnnouncementResponseDto.toSearchPopularAnnouncementList(): List { + return announcements.map { + SearchPopularAnnouncement( + announcementId = it.internshipAnnouncementId, + companyImage = it.companyImage, + title = it.title, + ) + } +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt b/data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt new file mode 100644 index 000000000..4d61da372 --- /dev/null +++ b/data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt @@ -0,0 +1,21 @@ +package com.terning.data.mapper.search + +import com.terning.data.dto.response.SearchResultResponseDto +import com.terning.domain.entity.search.SearchResult + + +fun SearchResultResponseDto.toSearchResultList(): List { + return announcements.map { + SearchResult( + internshipAnnouncementId = it.internshipAnnouncementId, + title = it.title, + dDay = it.dDay, + workingPeriod = it.workingPeriod, + companyImage = it.companyImage, + scrapId = it.scrapId, + deadline = it.deadline, + startYearMonth = it.startYearMonth, + color = it.color + ) + } +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt index cc2438a5b..80bbea1c0 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt @@ -2,8 +2,10 @@ package com.terning.data.repositoryimpl import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.request.SearchRequestDto -import com.terning.domain.entity.response.InternshipAnnouncementModel -import com.terning.domain.entity.response.SearchResultModel +import com.terning.data.mapper.search.toSearchPopularAnnouncementList +import com.terning.data.mapper.search.toSearchResultList +import com.terning.domain.entity.search.SearchPopularAnnouncement +import com.terning.domain.entity.search.SearchResult import com.terning.domain.repository.SearchRepository import javax.inject.Inject @@ -15,7 +17,7 @@ class SearchRepositoryImpl @Inject constructor( sortBy: String, page: Int, size: Int, - ): Result> { + ): Result> { return runCatching { searchDataSource.getSearch( SearchRequestDto( @@ -24,17 +26,17 @@ class SearchRepositoryImpl @Inject constructor( page = page, size = size ) - ).result.toSearchResultEntity() + ).result.toSearchResultList() } } - override suspend fun getSearchViewsList(): Result> = + override suspend fun getSearchViewsList(): Result> = runCatching { - searchDataSource.getSearchViews().result.toSearchViewsEntity() + searchDataSource.getSearchViews().result.toSearchPopularAnnouncementList() } - override suspend fun getSearchScrapsList(): Result> = + override suspend fun getSearchScrapsList(): Result> = runCatching { - searchDataSource.getSearchScraps().result.toSearchScrapsEntity() + searchDataSource.getSearchScraps().result.toSearchPopularAnnouncementList() } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/service/SearchService.kt b/data/src/main/java/com/terning/data/service/SearchService.kt index 3f3a25c7b..bd52620cb 100644 --- a/data/src/main/java/com/terning/data/service/SearchService.kt +++ b/data/src/main/java/com/terning/data/service/SearchService.kt @@ -2,8 +2,7 @@ package com.terning.data.service import com.terning.data.dto.BaseResponse import com.terning.data.dto.response.SearchResultResponseDto -import com.terning.data.dto.response.SearchScrapsResponseDto -import com.terning.data.dto.response.SearchViewsResponseDto +import com.terning.data.dto.response.SearchAnnouncementResponseDto import retrofit2.http.GET import retrofit2.http.Query @@ -17,8 +16,8 @@ interface SearchService { ): BaseResponse @GET("api/v1/search/views") - suspend fun getSearchViewsList(): BaseResponse + suspend fun getSearchViewsList(): BaseResponse @GET("api/v1/search/scraps") - suspend fun getSearchScrapsList(): BaseResponse + suspend fun getSearchScrapsList(): BaseResponse } \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncementModel.kt b/domain/src/main/java/com/terning/domain/entity/search/SearchPopularAnnouncement.kt similarity index 50% rename from domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncementModel.kt rename to domain/src/main/java/com/terning/domain/entity/search/SearchPopularAnnouncement.kt index 23f4adfa1..4866d3179 100644 --- a/domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncementModel.kt +++ b/domain/src/main/java/com/terning/domain/entity/search/SearchPopularAnnouncement.kt @@ -1,6 +1,6 @@ -package com.terning.domain.entity.response +package com.terning.domain.entity.search -data class InternshipAnnouncementModel( +data class SearchPopularAnnouncement( val title: String, val companyImage: String, val announcementId: Long, diff --git a/domain/src/main/java/com/terning/domain/entity/response/SearchResultModel.kt b/domain/src/main/java/com/terning/domain/entity/search/SearchResult.kt similarity index 77% rename from domain/src/main/java/com/terning/domain/entity/response/SearchResultModel.kt rename to domain/src/main/java/com/terning/domain/entity/search/SearchResult.kt index c6714f598..057357870 100644 --- a/domain/src/main/java/com/terning/domain/entity/response/SearchResultModel.kt +++ b/domain/src/main/java/com/terning/domain/entity/search/SearchResult.kt @@ -1,6 +1,6 @@ -package com.terning.domain.entity.response +package com.terning.domain.entity.search -data class SearchResultModel( +data class SearchResult( val internshipAnnouncementId: Long, val title: String, val dDay: String, diff --git a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt index 50a29e95f..f4f94ab53 100644 --- a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt @@ -1,7 +1,7 @@ package com.terning.domain.repository -import com.terning.domain.entity.response.SearchResultModel -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.search.SearchResult +import com.terning.domain.entity.search.SearchPopularAnnouncement interface SearchRepository { suspend fun getSearchList( @@ -9,7 +9,7 @@ interface SearchRepository { sortBy: String, page: Int, size: Int, - ): Result> - suspend fun getSearchViewsList(): Result> - suspend fun getSearchScrapsList(): Result> + ): Result> + suspend fun getSearchViewsList(): Result> + suspend fun getSearchScrapsList(): Result> } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt index 90c845b17..486134573 100644 --- a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt +++ b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt @@ -13,8 +13,8 @@ import com.terning.feature.intern.InternRoute import kotlinx.serialization.Serializable fun NavController.navigateIntern( - navOptions: NavOptions? = null, announcementId: Long = 0, + navOptions: NavOptions? = null, ) { navigate( route = Intern(announcementId), diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index 11a76b6d1..3d4b3f611 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -20,7 +20,6 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import androidx.navigation.NavHostController import com.terning.core.designsystem.component.textfield.SearchTextField import com.terning.core.designsystem.component.topappbar.LogoTopAppBar import com.terning.core.designsystem.theme.Black @@ -28,16 +27,17 @@ import com.terning.core.designsystem.theme.Grey100 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.feature.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 com.terning.feature.search.searchprocess.navigation.navigateSearchProcess +import okhttp3.internal.toImmutableList @Composable fun SearchRoute( - navController: NavHostController, + navigateToSearchProcess: () -> Unit, + navigateToIntern: (Long) -> Unit, viewModel: SearchViewModel = hiltViewModel(), ) { val lifecycleOwner = LocalLifecycleOwner.current @@ -62,29 +62,32 @@ fun SearchRoute( } val searchViewsList = when (viewState.searchViewsList) { - is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data + is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data.toImmutableList() else -> emptyList() } val searchScrapsList = when (scrapState.searchScrapsList) { - is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data + is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data.toImmutableList() else -> emptyList() } SearchScreen( - navController = navController, searchViewsList = searchViewsList, - searchScrapsList = searchScrapsList + searchScrapsList = searchScrapsList, + navigateToSearchProcess = navigateToSearchProcess, + navigateToIntern = navigateToIntern, ) } @Composable fun SearchScreen( modifier: Modifier = Modifier, - navController: NavHostController, - searchViewsList: List, - searchScrapsList: List, + searchViewsList: List, + searchScrapsList: List, + navigateToSearchProcess: () -> Unit, + navigateToIntern: (Long) -> Unit, ) { + val images = listOf( R.drawable.img_ad_1, R.drawable.img_ad_2, @@ -109,7 +112,7 @@ fun SearchScreen( vertical = 16.dp ) .noRippleClickable { - navController.navigateSearchProcess() + navigateToSearchProcess() } ) { SearchTextField( @@ -133,12 +136,11 @@ fun SearchScreen( style = TerningTheme.typography.title1, color = Black ) - SearchInternList( type = InternListType.VIEW, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, - navController = navController + navigateToIntern = navigateToIntern, ) HorizontalDivider( thickness = 4.dp, @@ -149,7 +151,7 @@ fun SearchScreen( type = InternListType.SCRAP, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, - navController = navController + navigateToIntern = navigateToIntern, ) } } diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt index 8065cc0f0..3d11ab374 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt @@ -24,7 +24,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import androidx.navigation.NavHostController import coil.compose.AsyncImage import coil.request.ImageRequest import com.terning.core.designsystem.theme.Black @@ -34,14 +33,13 @@ import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White import com.terning.core.extension.noRippleClickable import com.terning.feature.R -import com.terning.feature.intern.navigation.navigateIntern @Composable fun SearchIntern( companyImage: String, title: String, - navController: NavHostController, announcementId: Long, + navigateToIntern: (Long) -> Unit, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -63,7 +61,7 @@ fun SearchIntern( ) .padding(top = 8.dp) .noRippleClickable { - navController.navigateIntern(announcementId = announcementId) + navigateToIntern(announcementId) } ) { AsyncImage( diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index 132bff1ef..5a0099763 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -9,18 +9,17 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.navigation.NavHostController import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.feature.R @Composable fun SearchInternList( type: InternListType, - searchScrapsList: List?, - searchViewsList: List?, - navController: NavHostController, + searchScrapsList: List?, + searchViewsList: List?, + navigateToIntern: (Long) -> Unit, ) { Column(modifier = Modifier.padding(horizontal = 24.dp)) { Text( @@ -44,8 +43,8 @@ fun SearchInternList( SearchIntern( companyImage = searchViewsList[index].companyImage, title = searchViewsList[index].title, - navController = navController, - announcementId = searchViewsList[index].announcementId + announcementId = searchViewsList[index].announcementId, + navigateToIntern = navigateToIntern, ) } } @@ -55,8 +54,8 @@ fun SearchInternList( SearchIntern( companyImage = searchScrapsList[index].companyImage, title = searchScrapsList[index].title, - navController = navController, - announcementId = searchScrapsList[index].announcementId + announcementId = searchScrapsList[index].announcementId, + navigateToIntern = navigateToIntern, ) } } diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt index 8c89cde45..d52f3c17e 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.core.state.UiState data class SearchScrapsListState( - var searchScrapsList: UiState> = UiState.Loading, + var searchScrapsList: UiState> = UiState.Loading, ) diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt index bc0c6b576..5550e1e3c 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.core.state.UiState data class SearchViewsListState( - var searchViewsList: UiState> = UiState.Loading, + var searchViewsList: UiState> = UiState.Loading, ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt index fabf93899..98a5a730d 100644 --- a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt +++ b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt @@ -8,7 +8,9 @@ import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute +import com.terning.feature.intern.navigation.navigateIntern 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) { @@ -36,7 +38,8 @@ fun NavGraphBuilder.searchNavGraph( } ) { SearchRoute( - navController = navHostController + navigateToSearchProcess = { navHostController.navigateSearchProcess() }, + navigateToIntern = { announcementId -> navHostController.navigateIntern(announcementId) } ) } } diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt index a12ef5d40..a36b01dcd 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt @@ -4,7 +4,7 @@ import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.domain.entity.CalendarScrapRequest -import com.terning.domain.entity.response.SearchResultModel +import com.terning.domain.entity.search.SearchResult import com.terning.domain.repository.ScrapRepository import com.terning.domain.repository.SearchRepository import com.terning.feature.R @@ -37,8 +37,8 @@ class SearchProcessViewModel @Inject constructor( MutableStateFlow(SearchResultState()) val searchListState: StateFlow = _searchListState.asStateFlow() - private val _internSearchResultData = MutableStateFlow>(emptyList()) - val internSearchResultData: StateFlow> = + private val _internSearchResultData = MutableStateFlow>(emptyList()) + val internSearchResultData: StateFlow> = _internSearchResultData.asStateFlow() private val _dialogState: MutableStateFlow = diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt index 09bbedbd9..8cb4b6856 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.searchprocess.models import com.terning.core.state.UiState -import com.terning.domain.entity.response.SearchResultModel +import com.terning.domain.entity.search.SearchResult data class SearchResultState( - var searchListState: UiState> = UiState.Loading, + var searchListState: UiState> = UiState.Loading, ) \ No newline at end of file