-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/440 선물 등록 시 사전 질문 작성 #446
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
Merged
Changes from 10 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
d6a2d6b
fix: response의 answer와 description을 nullable 타입으로 변경했어요.
HamBP 00a5a24
feat: 선물 dto 필드 추가
HamBP b965c3e
fix: 점심 모드를 변경했어요.
HamBP a42e040
refactor: 같은 브랜치에 여러 조건을 묶었어요.
HamBP ab3812d
feat: 사전 질문을 작성하는 화면을 위한 파일을 만들었어요.
HamBP 251ab9e
feat: 등록하기 시 만약 사전 질문이 있다면 질문 작성 화면으로 내비게이션 해요.
HamBP b3c78b9
feat: git에 누락된 파일을 추가했어요.
HamBP 29aca98
fix: cold start 시 로그인 정보를 가져오지 못 하는 문제를 수정했어요.
HamBP 6c4397b
feat: 공연 정보와 사전 질문 목록을 가져와요
HamBP a7c013d
feat: 공연 정보를 표시해요
HamBP 74cdac9
feat: 사전 질문 작성 폼을 만들었어요.
HamBP 85375f9
feat: 등록하기 버튼을 추가했어요.
HamBP a68e790
refactor: 텍스트들을 리소스화 했어요.
HamBP cf5897f
feat: 페이지 이탈 전 다이얼로그를 띄워줘요.
HamBP 027432f
feat: 등록하기 버튼 클릭 시 필요한 API를 호출해요.
HamBP 85f11b7
feat: 첫 번째 API 실패 시 오류 이벤트를 내보내요.
HamBP d6cd666
feat: API 호출 성공 여부를 체크하여 메시지를 띄워요
HamBP f2227a6
feat: 선물 받기 API 호출 순서를 변경했어요.
HamBP f0f1c5d
feat: 캐시된 값이 있다면 캐시된 값을 사용해요.
HamBP 72a9961
merge
HamBP 8acfb7c
feat: 등록 버튼 enabled 처리했어요.
HamBP bf8d778
chore: 버전 업
HamBP 7a93107
feat: retry 로직을 넣었어요.
HamBP 275adbf
Merge branch 'develop' into feat/440
HamBP d782148
fix: 제목 가운데 정렬
HamBP 4bb749f
fix: 취소 시 실패 팝업 제거
HamBP ff5a353
Merge remote-tracking branch 'origin/develop' into fix/453
HamBP ae1e373
fix: 더 넓은 범위의 실패를 받을 수 있게 변경했어요.
HamBP a30c10f
fix: 복사 과정에서 생긴 문제를 수정했어요.
HamBP f66e245
feat: 선물 등록 실패 시 스낵바 대신 다이얼로그를 띄워요.
HamBP 9e30ddf
fix: 사전 질문이 있을 경우 다이얼로그를 표시하지 않고 질문 화면으로 넘어가요.
HamBP c2ecb81
feat: 선물 수령 시 티켓 탭으로 이동하도록 수정했어요.
HamBP 2d72fdc
feat: 선물 다이얼로그의 X 버튼을 제거했어요.
HamBP 95e2ba3
fix: 화면 이동 처리 시점을 변경했어요.
HamBP 25d549e
fix: 다이얼로그의 X 버튼을 제거했어요.
HamBP a16048e
feat: (사전질문 작성) 선물을 받으면 티켓 탭으로 이동해요.
HamBP 93a90fe
feat: 딥 링크를 감지하는 주체를 Main.kt로 변경했어요.
HamBP c8a1add
fix: 사전질문 작성 화면이 두 번 뜨는 문제를 수정했어요.
HamBP 7b708fc
feat: 선물 등록 실패 시 뒤로가기
HamBP 7640b54
Merge remote-tracking branch 'origin/develop' into fix/453
HamBP c56565c
fix: 빌드 오류 수정
HamBP a4d1280
Disable pre-question editing for cancelled reservations
ef81928
Refactor pre-question edit condition into view model
ebd1a6d
Hide pre-question section for cancelled reservations
c54f01d
chore: rename -> copy로 변경
HamBP 875492a
fix: grid의 columns를 2로 고정. 및 하나의 list와 content type을 통한 lazy grid 사용
HamBP aebb433
Merge pull request #461 from Nexters/fix/453-refactorgrid
HamBP 0d20a00
fix: 타이밍 이슈 해결 (home event 유실 문제)
HamBP e7f9862
Merge pull request #458 from Nexters/fix/453
HamBP b980377
Merge pull request #460 from Nexters/feature/Boolti-459
mangbaam 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
5 changes: 5 additions & 0 deletions
5
.../main/java/com/nexters/boolti/presentation/screen/giftprequestion/GiftPreQuestionEvent.kt
This file contains hidden or 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,5 @@ | ||
| package com.nexters.boolti.presentation.screen.giftprequestion | ||
|
|
||
| sealed interface GiftPreQuestionEvent { | ||
|
|
||
| } |
17 changes: 17 additions & 0 deletions
17
.../java/com/nexters/boolti/presentation/screen/giftprequestion/GiftPreQuestionNavigation.kt
This file contains hidden or 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,17 @@ | ||
| package com.nexters.boolti.presentation.screen.giftprequestion | ||
|
|
||
| import androidx.navigation.NavGraphBuilder | ||
| import androidx.navigation.compose.composable | ||
| import androidx.navigation.toRoute | ||
| import com.nexters.boolti.presentation.screen.LocalNavController | ||
| import com.nexters.boolti.presentation.screen.navigation.MainRoute | ||
|
|
||
| fun NavGraphBuilder.giftPreQuestionScreen() { | ||
| composable<MainRoute.GiftPreQuestion> { backStackEntry -> | ||
| val navController = LocalNavController.current | ||
|
|
||
| GiftPreQuestionScreen( | ||
| onBackPressed = navController::navigateUp, | ||
| ) | ||
| } | ||
| } |
87 changes: 87 additions & 0 deletions
87
...main/java/com/nexters/boolti/presentation/screen/giftprequestion/GiftPreQuestionScreen.kt
This file contains hidden or 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,87 @@ | ||
| package com.nexters.boolti.presentation.screen.giftprequestion | ||
|
|
||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.material3.Scaffold | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel | ||
| import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
| import com.nexters.boolti.domain.model.Gift | ||
| import com.nexters.boolti.domain.model.PreQuestion | ||
| import com.nexters.boolti.presentation.R | ||
| import com.nexters.boolti.presentation.component.BtCloseableAppBar | ||
| import com.nexters.boolti.presentation.component.ShowItemV2 | ||
| import com.nexters.boolti.presentation.theme.Grey05 | ||
| import com.nexters.boolti.presentation.theme.marginHorizontal | ||
| import com.nexters.boolti.presentation.theme.point4 | ||
| import kotlinx.collections.immutable.ImmutableList | ||
|
|
||
| @Composable | ||
| fun GiftPreQuestionScreen( | ||
| onBackPressed: () -> Unit, | ||
| viewModel: GiftPreQuestionViewModel = hiltViewModel(), | ||
| ) { | ||
| val uiState by viewModel.uiState.collectAsStateWithLifecycle() | ||
|
|
||
| Scaffold( | ||
| topBar = { | ||
| BtCloseableAppBar( | ||
| onClickClose = { | ||
| TODO() | ||
| onBackPressed() | ||
| } | ||
| ) | ||
| } | ||
| ) { innerPadding -> | ||
| Box(modifier = Modifier.padding(innerPadding)) { | ||
| val state = uiState | ||
|
|
||
| if (state is GiftPreQuestionUiState.Success) { | ||
| GiftPreQuestionScreen( | ||
| gift = state.gift, | ||
| preQuestions = state.preQuestions, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| fun GiftPreQuestionScreen( | ||
| gift: Gift, | ||
| preQuestions: ImmutableList<PreQuestion> | ||
| ) { | ||
| Column() { | ||
| Text( | ||
| modifier = Modifier | ||
| .padding(top = 16.dp) | ||
| .padding(horizontal = marginHorizontal), | ||
| text = stringResource(R.string.gift_pre_question_title), | ||
| style = point4, | ||
| color = Grey05, | ||
| ) | ||
|
|
||
| Column { | ||
| ShowItemV2( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(top = 12.dp) | ||
| .padding(horizontal = marginHorizontal), | ||
| poster = gift.showImage, | ||
| title = gift.showName, | ||
| description = stringResource( | ||
| id = R.string.reservation_ticket_info_format, | ||
| gift.salesTicketName, | ||
| gift.ticketCount, | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
23 changes: 23 additions & 0 deletions
23
...ain/java/com/nexters/boolti/presentation/screen/giftprequestion/GiftPreQuestionUiState.kt
This file contains hidden or 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,23 @@ | ||
| package com.nexters.boolti.presentation.screen.giftprequestion | ||
|
|
||
| import com.nexters.boolti.domain.model.Gift | ||
| import com.nexters.boolti.domain.model.PreQuestion | ||
| import kotlinx.collections.immutable.ImmutableList | ||
| import kotlinx.collections.immutable.ImmutableMap | ||
| import kotlinx.collections.immutable.ImmutableSet | ||
| import kotlinx.collections.immutable.persistentListOf | ||
| import kotlinx.collections.immutable.persistentMapOf | ||
| import kotlinx.collections.immutable.persistentSetOf | ||
|
|
||
| sealed interface GiftPreQuestionUiState { | ||
| data object Loading : GiftPreQuestionUiState | ||
|
|
||
| data class Success( | ||
| val gift: Gift, | ||
| val preQuestions: ImmutableList<PreQuestion> = persistentListOf(), | ||
| ) : GiftPreQuestionUiState | ||
|
|
||
| companion object { | ||
| const val MAX_ANSWER_LENGTH = 100 | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
...n/java/com/nexters/boolti/presentation/screen/giftprequestion/GiftPreQuestionViewModel.kt
This file contains hidden or 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,59 @@ | ||
| package com.nexters.boolti.presentation.screen.giftprequestion | ||
|
|
||
| import androidx.lifecycle.SavedStateHandle | ||
| import androidx.lifecycle.viewModelScope | ||
| import com.nexters.boolti.domain.repository.GiftRepository | ||
| import com.nexters.boolti.domain.repository.TicketingRepository | ||
| import com.nexters.boolti.presentation.base.BaseViewModel | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.collections.immutable.toImmutableList | ||
| import kotlinx.coroutines.async | ||
| import kotlinx.coroutines.flow.MutableStateFlow | ||
| import kotlinx.coroutines.flow.StateFlow | ||
| import kotlinx.coroutines.flow.asStateFlow | ||
| import kotlinx.coroutines.flow.first | ||
| import kotlinx.coroutines.flow.update | ||
| import kotlinx.coroutines.launch | ||
| import javax.inject.Inject | ||
|
|
||
| @HiltViewModel | ||
| class GiftPreQuestionViewModel @Inject constructor( | ||
| savedStateHandle: SavedStateHandle, | ||
| private val giftRepository: GiftRepository, // TODO: 캐시 | ||
| private val ticketingRepository: TicketingRepository, | ||
| ) : BaseViewModel() { | ||
|
|
||
| private val giftUuid: String = checkNotNull(savedStateHandle["giftUuid"]) { | ||
| "giftUuid가 전달되어야 합니다." | ||
| } | ||
| private val showId: String = checkNotNull(savedStateHandle["showId"]) { | ||
| "showId가 전달되어야 합니다." | ||
| } | ||
|
|
||
| private val _uiState = MutableStateFlow<GiftPreQuestionUiState>(GiftPreQuestionUiState.Loading) | ||
| val uiState: StateFlow<GiftPreQuestionUiState> = _uiState.asStateFlow() | ||
|
|
||
| init { | ||
| fetchGiftAndPreQuestions() | ||
| } | ||
|
|
||
| private fun fetchGiftAndPreQuestions() { | ||
| viewModelScope.launch(recordExceptionHandler) { | ||
| _uiState.update { GiftPreQuestionUiState.Loading } | ||
HamBP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| val gift = async { | ||
| giftRepository.getGift(giftUuid).first() | ||
| } | ||
| val preQuestions = async { | ||
| ticketingRepository.getPreQuestions(showId).first() | ||
| } | ||
|
|
||
| _uiState.update { | ||
| GiftPreQuestionUiState.Success( | ||
| gift = gift.await(), | ||
| preQuestions = preQuestions.await().toImmutableList(), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.