-
Notifications
You must be signed in to change notification settings - Fork 0
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/#23] "좌석 선택 뷰", "승차권 확인 뷰" 서버통신 구현 #24
base: develop
Are you sure you want to change the base?
Conversation
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.
api 통신 방법 많이 참고했습니당 굿굿
} | ||
|
||
LaunchedEffect(viewModel.leftSeatsState) { | ||
snapshotFlow { viewModel.leftSeatsState.value } |
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.
[3]
저는 collectAsState를 사용했는데 snapshotFlow라는 것을 사용해서 flow를 관찰할 수도 있군용
items(seatsMapData.size) { index -> | ||
val coach = seatsMapData[index] |
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.
[3]
itemsIndexed를 사용하면 index, item을 반환할 수 있더라구요!
private val ticketRepository: TicketRepository | ||
) : ViewModel() { | ||
var showDialog = mutableStateOf(false) | ||
private var _ticketState = MutableStateFlow<TicketState>(TicketState.Idle) | ||
val ticketState: StateFlow<TicketState> = _ticketState | ||
|
||
val ticketDummy = TicketData( | ||
departurePlace = "서울", | ||
arrivalPlace = "부산", | ||
date = "2024년 10월 30일 (수)", | ||
trainName = "KTX 001", | ||
departureTime = "09:30", | ||
arrivalTime = "12:45", | ||
seatName = "16A", | ||
ticketPrice = 50000, | ||
limitPaymentTime = formatDate(), | ||
coachesNumber = 4 | ||
private val _ticketData = MutableStateFlow<TicketData>( | ||
TicketData( | ||
departurePlace = "", | ||
arrivalPlace = "", | ||
date = "", | ||
trainName = "", | ||
departureTime = "", | ||
arrivalTime = "", | ||
seatName = "", | ||
ticketPrice = 0, | ||
limitPaymentTime = "", | ||
coachesNumber = 0 | ||
) | ||
) |
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.
[3]
참고하겠습니다!! 감사합니당ㅎㅎ
Related issue 🛠
Work Description ✏️
Screenshot 📸
https://rumbling-chip-236.notion.site/23-14db4062d9c980f8b5d2e955a5cfe32b?pvs=4
Uncompleted Tasks 😅
To Reviewers 📢
정리해주신 것 바탕으로 clean architecutre와 repository 구조를 이해하려고 공부했습니다! viewModel에서는 model을 따로 정의해야하는지, domain의 model을 사용해도 의존성 규칙을 지키는지 궁금합니다..! 현재 코드에서는 domain의 모델을 viewModel에서 사용중입니다.