-
Notifications
You must be signed in to change notification settings - Fork 0
2026 봄 축제 탭 추가 및 데이터 반영 #519
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package com.eatssu.android.data.remote.dto.response | ||
|
|
||
| import com.eatssu.android.domain.model.Partnership | ||
| import com.eatssu.common.enums.PeriodType | ||
| import com.eatssu.common.enums.StoreType | ||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
@@ -37,7 +38,9 @@ data class PartnershipResponse( | |
| @SerialName("startDate") | ||
| val startDate: String? = null, | ||
| @SerialName("endDate") | ||
| val endDate: String? = null | ||
| val endDate: String? = null, | ||
| @SerialName("periodType") | ||
| val periodType: String? = null | ||
| ) | ||
| } | ||
|
|
||
|
|
@@ -57,7 +60,11 @@ fun PartnershipResponse.toDomain(): Partnership = | |
| isLiked = it.isLiked ?: false, | ||
| description = it.description ?: "", | ||
| startDate = it.startDate ?: "", | ||
| endDate = it.endDate ?: "" | ||
| endDate = it.endDate ?: "", | ||
| periodType = when (it.periodType) { | ||
| "FESTIVAL" -> PeriodType.FESTIVAL | ||
| else -> PeriodType.NORMAL | ||
| } | ||
|
Contributor
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. |
||
| ) | ||
| } | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ import com.eatssu.common.UiEvent | |
| import com.eatssu.common.UiState | ||
| import com.eatssu.common.analytics.AnalyticsTracker | ||
| import com.eatssu.common.analytics.MapAnalyticsEvent | ||
| import com.eatssu.common.enums.PeriodType | ||
| import com.eatssu.common.enums.StoreType | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||
|
|
@@ -83,15 +84,16 @@ class MapViewModel @Inject constructor( | |
| // departmentId가 변경되면 필터 자동 설정 | ||
| val current = uiState.value | ||
| val currentData = if (current is UiState.Success) current.data else MapState() | ||
| val initialFilter = if (newDepartmentId == -1L) FilterType.All else FilterType.Mine | ||
|
|
||
| // val initialFilter = if (newDepartmentId == -1L) FilterType.All else FilterType.Mine // TODO 축제기간 종료 시 주석 해제 | ||
| val initialFilter = FilterType.Festival // TODO 축제기간 한정 Festival 강제. 축제기간 끝나면 주석 | ||
|
Contributor
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.
Member
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. 이 부분 무조건 Festival이 아니라 Festival인 애가 존재하는 경우에만 이렇게 initialFilter를 Festival로 설정해야해요!!
Collaborator
Author
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. ! 넵! |
||
| _uiState.value = UiState.Success( | ||
| MapState(selectedFilter = initialFilter) | ||
| ) | ||
|
|
||
| // 초기 필터에 따라 데이터 로드 | ||
| when (initialFilter) { | ||
| FilterType.All -> loadPartnerships() | ||
| FilterType.Festival -> loadFestivalPartnerships() | ||
| FilterType.Mine -> loadUserCollegePartnerships() | ||
| } | ||
|
|
||
|
|
@@ -130,6 +132,10 @@ class MapViewModel @Inject constructor( | |
| analyticsTracker.track(MapAnalyticsEvent.AllClicked) | ||
| } | ||
|
|
||
| FilterType.Festival -> { | ||
| loadFestivalPartnerships() | ||
| } | ||
|
|
||
| FilterType.Mine -> { | ||
| loadUserCollegePartnerships() | ||
| analyticsTracker.track( | ||
|
|
@@ -160,6 +166,33 @@ class MapViewModel @Inject constructor( | |
| } | ||
| } | ||
|
|
||
| // 축제 정보 로딩 | ||
| private fun loadFestivalPartnerships() { | ||
| viewModelScope.launch { | ||
| val current = uiState.value | ||
| val currentData = if (current is UiState.Success) current.data else MapState() | ||
|
|
||
| _uiState.value = UiState.Loading | ||
|
|
||
| val partnerships = partnershipRepository.getAllPartnerships().mapNotNull { | ||
| val festivalInfos = | ||
| it.partnershipInfos.filter { info -> info.periodType == PeriodType.FESTIVAL } | ||
| if (festivalInfos.isEmpty()) return@mapNotNull null | ||
|
|
||
| it.copy( | ||
| partnershipInfos = festivalInfos | ||
| ) | ||
| } | ||
|
|
||
| _uiState.value = UiState.Success( | ||
| currentData.copy( | ||
| partnerships = partnerships, | ||
| filterChangeResult = null | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
|
Contributor
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. |
||
|
|
||
| // 사용자 단과대 제휴 정보 로딩 | ||
| private fun loadUserCollegePartnerships() { | ||
| viewModelScope.launch { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.eatssu.common.enums | ||
|
|
||
| enum class PeriodType { | ||
| FESTIVAL, NORMAL | ||
| } |
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.
kotlinx.serialization이 enum 직렬화 처리를 해줘서 String을 받고 아래에서 파싱하는 방법이 아니어도 됩니다! 대신 PeriodType를 @serializable로 달아야 해요.
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.
@serializable로 수정했습니다 !