-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT/#306] 3차 스프린트 탐색 뷰 #320
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3df0618
[FEAT/#306] 탐색 뷰 폰트 변경
arinming b4df947
[FEAT/#306] 탐색 뷰 네비게이션 변경
arinming 1d56e22
[FEAT/#306] 탐색 진행 뷰 네비게이션 변경
arinming 7342eff
[DEL/#306] 사용하지 않는 코드 삭제
arinming 608733b
[FEAT/#306] 좌우 스크롤 패딩 값 삭제
arinming 7e52504
[FEAT/#306] 배너 조회 API 연동
arinming 9f149eb
[FEAT/#306] 배너 조회 API 매핑
arinming f52bcc1
[FIX/#306] 검색 결과 초기화 이슈 해결
arinming faece48
Merge remote-tracking branch 'origin/develop' into feat/#306-search
arinming 93639af
[FIX/#306] 코드 리뷰 기반 수정
arinming a4d4f6f
[FIX/#306] 코드 리뷰 기반 수정
arinming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
data/search/src/main/java/com/terning/data/search/dto/response/SearchBannersResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<BannerDto>, | ||
) { | ||
@Serializable | ||
data class BannerDto( | ||
@SerialName("imageUrl") | ||
val imageUrl: String, | ||
@SerialName("link") | ||
val link: String, | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
data/search/src/main/java/com/terning/data/search/mapper/SearchBannersMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SearchBanner> { | ||
return banners.map { | ||
SearchBanner( | ||
imageUrl = it.imageUrl, | ||
url = it.link, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
domain/search/src/main/java/com/terning/domain/search/entity/SearchBanner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.terning.domain.search.entity | ||
|
||
data class SearchBanner( | ||
val imageRes: Int, | ||
val url: String | ||
val imageUrl: String, | ||
val url: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ 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 | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
|
@@ -30,22 +30,26 @@ 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( | ||
modifier: Modifier, | ||
paddingValues: PaddingValues, | ||
navigateToSearchProcess: () -> Unit, | ||
navigateToIntern: (Long) -> Unit, | ||
viewModel: SearchViewModel = hiltViewModel(), | ||
) { | ||
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) | ||
Comment on lines
+52
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 궁금해서 물어보는 건데요...! 혹시 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 배너 / 조회수 많은 공고 / 스크랩 많은 공고로 state를 나누었습니다! |
||
|
||
|
@@ -54,32 +58,38 @@ fun SearchRoute( | |
LaunchedEffect(key1 = true) { | ||
viewModel.getSearchViews() | ||
viewModel.getSearchScraps() | ||
viewModel.getSearchBanners() | ||
} | ||
|
||
LaunchedEffect(viewModel.sideEffect, lifecycleOwner) { | ||
viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) | ||
.collect { sideEffect -> | ||
when (sideEffect) { | ||
is SearchSideEffect.Toast -> { | ||
is SearchSideEffect.ShowToast -> { | ||
sideEffect.message | ||
} | ||
} | ||
} | ||
} | ||
|
||
val bannerList = when (bannerState.searchBannersList) { | ||
is UiState.Success -> (bannerState.searchBannersList as UiState.Success<List<SearchBanner>>).data.toImmutableList() | ||
else -> emptyList<SearchBanner>().toImmutableList() | ||
} | ||
|
||
val searchViewsList = when (viewState.searchViewsList) { | ||
is UiState.Success -> (viewState.searchViewsList as UiState.Success<List<com.terning.domain.search.entity.SearchPopularAnnouncement>>).data.toImmutableList() | ||
else -> emptyList() | ||
is UiState.Success -> (viewState.searchViewsList as UiState.Success<List<SearchPopularAnnouncement>>).data.toImmutableList() | ||
else -> emptyList<SearchPopularAnnouncement>().toImmutableList() | ||
} | ||
|
||
val searchScrapsList = when (scrapState.searchScrapsList) { | ||
is UiState.Success -> (scrapState.searchScrapsList as UiState.Success<List<com.terning.domain.search.entity.SearchPopularAnnouncement>>).data.toImmutableList() | ||
else -> emptyList() | ||
is UiState.Success -> (scrapState.searchScrapsList as UiState.Success<List<SearchPopularAnnouncement>>).data.toImmutableList() | ||
else -> emptyList<SearchPopularAnnouncement>().toImmutableList() | ||
} | ||
|
||
SearchScreen( | ||
modifier = modifier, | ||
bannerList = SearchViewModel.bannerList, | ||
paddingValues = paddingValues, | ||
bannerList = bannerList, | ||
searchViewsList = searchViewsList, | ||
searchScrapsList = searchScrapsList, | ||
navigateToSearchProcess = { | ||
|
@@ -96,25 +106,25 @@ fun SearchRoute( | |
name = "quest_banner" | ||
) | ||
CustomTabsIntent.Builder().build() | ||
.launchUrl(context, SearchViewModel.bannerList[pageIndex].url.toUri()) | ||
.launchUrl(context, bannerList[pageIndex].url.toUri()) | ||
} | ||
) | ||
} | ||
|
||
@Composable | ||
fun SearchScreen( | ||
modifier: Modifier = Modifier, | ||
bannerList: List<com.terning.domain.search.entity.SearchBanner>, | ||
searchViewsList: List<com.terning.domain.search.entity.SearchPopularAnnouncement>, | ||
searchScrapsList: List<com.terning.domain.search.entity.SearchPopularAnnouncement>, | ||
paddingValues: PaddingValues, | ||
bannerList: ImmutableList<SearchBanner>, | ||
searchViewsList: ImmutableList<SearchPopularAnnouncement>, | ||
searchScrapsList: ImmutableList<SearchPopularAnnouncement>, | ||
navigateToSearchProcess: () -> Unit, | ||
navigateToIntern: (Long) -> Unit, | ||
onAdvertisementClick: (Int) -> Unit, | ||
) { | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
modifier = Modifier | ||
.background(White) | ||
.padding(paddingValues) | ||
) { | ||
TerningImage( | ||
painter = R.drawable.ic_terning_logo_typo, | ||
|
@@ -145,7 +155,7 @@ fun SearchScreen( | |
LazyColumn { | ||
item { | ||
ImageSlider( | ||
images = bannerList, | ||
searchBanners = bannerList, | ||
onAdvertisementClick = onAdvertisementClick, | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 이제 봤는데 kotlin 지워줘야 할 것 같아요!