Skip to content

Commit 7720087

Browse files
committed
[FIX/#322] 컨플릭트 해결
2 parents 76611f2 + f51f632 commit 7720087

9 files changed

Lines changed: 156 additions & 81 deletions

File tree

core/designsystem/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
<!--SortByBottom-->
3030
<string name="sort_by_earliest">채용 마감 이른 순</string>
31-
<string name="sort_by_shortest">짧은 근무 기간 순</string>
32-
<string name="sort_by_longest">근무 기간 순</string>
31+
<string name="sort_by_shortest">근무 기간 짧은 순</string>
32+
<string name="sort_by_longest">근무 기간 순</string>
3333
<string name="sort_by_scrap">스크랩 많은 순</string>
3434
<string name="sort_by_view_count">조회수 많은 순</string>
3535
<string name="sort_button_description">정렬 기준</string>

feature/calendar/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import androidx.compose.foundation.pager.PagerState
1414
import androidx.compose.foundation.pager.rememberPagerState
1515
import androidx.compose.material3.HorizontalDivider
1616
import androidx.compose.runtime.Composable
17+
import androidx.compose.runtime.DisposableEffect
1718
import androidx.compose.runtime.LaunchedEffect
1819
import androidx.compose.runtime.getValue
1920
import androidx.compose.runtime.rememberCoroutineScope
@@ -47,6 +48,7 @@ fun CalendarRoute(
4748
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
4849
val amplitudeTracker = LocalTracker.current
4950

51+
5052
CalendarScreen(
5153
uiState = uiState,
5254
navigateToAnnouncement = navigateToAnnouncement,
@@ -65,6 +67,12 @@ fun CalendarRoute(
6567
},
6668
modifier = modifier,
6769
)
70+
71+
DisposableEffect(true) {
72+
onDispose {
73+
viewModel.resetUiState()
74+
}
75+
}
6876
}
6977

7078
@Composable
@@ -90,6 +98,10 @@ private fun CalendarScreen(
9098
pageCount = { uiState.calendarModel.pageCount }
9199
)
92100

101+
LaunchedEffect(true) {
102+
pagerState.scrollToPage(uiState.calendarModel.initialPage)
103+
}
104+
93105
LaunchedEffect(key1 = pagerState, key2 = uiState.selectedDate) {
94106
snapshotFlow { pagerState.currentPage }
95107
.collect { current ->
@@ -115,7 +127,7 @@ private fun CalendarScreen(
115127
date = uiState.calendarModel.getYearMonthByPage(pagerState.settledPage),
116128
isListExpanded = uiState.isListEnabled,
117129
onListButtonClicked = {
118-
if(!calendarListTransition.isRunning)
130+
if (!calendarListTransition.isRunning)
119131
onClickListButton()
120132
},
121133
onMonthNavigationButtonClicked = { direction ->

feature/calendar/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ class CalendarViewModel @Inject constructor() : ViewModel() {
2727
}
2828
}
2929

30+
fun resetUiState() = _uiState.update { currentState ->
31+
currentState.copy(
32+
selectedDate = DayModel(),
33+
isListEnabled = false,
34+
isWeekEnabled = false
35+
)
36+
}
37+
3038
fun updateSelectedDate(value: DayModel) = _uiState.update { currentState ->
3139
currentState.copy(
3240
selectedDate = value

feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeFilteringBottomSheet.kt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import androidx.compose.material3.HorizontalDivider
1717
import androidx.compose.material3.Text
1818
import androidx.compose.material3.rememberModalBottomSheetState
1919
import androidx.compose.runtime.Composable
20-
import androidx.compose.runtime.LaunchedEffect
2120
import androidx.compose.runtime.getValue
2221
import androidx.compose.runtime.mutableIntStateOf
2322
import androidx.compose.runtime.mutableStateOf
@@ -69,8 +68,12 @@ internal fun HomeFilteringBottomSheet(
6968
val density = LocalDensity.current
7069
var pageHeight by remember { mutableIntStateOf(0) }
7170

72-
LaunchedEffect(pagerState.currentPage) {
73-
currentFilteringInfo = defaultFilteringInfo
71+
var isCheckBoxChecked by remember {
72+
mutableStateOf(
73+
with(currentFilteringInfo) {
74+
listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 }
75+
}
76+
)
7477
}
7578

7679
GetPagerHeight(
@@ -142,6 +145,7 @@ internal fun HomeFilteringBottomSheet(
142145
1 -> {
143146
PlanFilteringScreen(
144147
currentFilteringInfo = currentFilteringInfo,
148+
isCheckBoxChecked = isCheckBoxChecked,
145149
updateGrade = {
146150
currentFilteringInfo = currentFilteringInfo.copy(
147151
grade = if (it != null) {
@@ -166,6 +170,9 @@ internal fun HomeFilteringBottomSheet(
166170
startMonth = it
167171
)
168172
},
173+
updateIsCheckBoxChecked = {
174+
isCheckBoxChecked = it
175+
}
169176
)
170177
}
171178
}
@@ -189,7 +196,10 @@ internal fun HomeFilteringBottomSheet(
189196
)
190197
}
191198
},
192-
isEnabled = checkButtonEnable(currentFilteringInfo = currentFilteringInfo)
199+
isEnabled = checkButtonEnable(
200+
currentFilteringInfo = currentFilteringInfo,
201+
isCheckBoxChecked = isCheckBoxChecked
202+
)
193203
)
194204
}
195205

@@ -243,10 +253,12 @@ fun TerningTab(
243253
}
244254
}
245255

246-
private fun checkButtonEnable(currentFilteringInfo: HomeFilteringInfo): Boolean =
256+
private fun checkButtonEnable(
257+
currentFilteringInfo: HomeFilteringInfo,
258+
isCheckBoxChecked: Boolean
259+
): Boolean =
247260
with(currentFilteringInfo) {
248-
listOf(grade, workingPeriod, startYear, startMonth).all { it == null || it == 0 } ||
249-
listOf(grade, workingPeriod, startYear, startMonth).none { it == null || it == 0 }
261+
isCheckBoxChecked || listOf(grade, workingPeriod, startYear, startMonth).none { it == null }
250262
}
251263

252264
@Composable
@@ -255,6 +267,7 @@ private fun GetPagerHeight(
255267
) {
256268
PlanFilteringScreen(
257269
currentFilteringInfo = HomeFilteringInfo(null, null, null, null, "total"),
270+
isCheckBoxChecked = false,
258271
modifier = Modifier
259272
.onGloballyPositioned {
260273
onHeightMeasured(it.size.height)

feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/HomeYearMonthPicker.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ private fun DatePicker(
130130
if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex)
131131
}
132132

133+
val savedIndex by remember { mutableIntStateOf(startIndex) }
134+
135+
LaunchedEffect(itemHeightPixel, savedIndex) {
136+
scrollState.scrollToItem(savedIndex)
137+
}
138+
133139
LaunchedEffect(scrollState) {
134140
snapshotFlow { scrollState.firstVisibleItemIndex }
135141
.map { index ->

feature/home/src/main/java/com/terning/feature/home/component/bottomsheet/PlanFilteringScreen.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ import kotlinx.collections.immutable.toImmutableList
4343
@Composable
4444
internal fun PlanFilteringScreen(
4545
currentFilteringInfo: HomeFilteringInfo,
46+
isCheckBoxChecked: Boolean,
4647
modifier: Modifier = Modifier,
4748
updateGrade: (Int?) -> Unit = {},
4849
updateWorkingPeriod: (Int?) -> Unit = {},
4950
updateStartYear: (Int?) -> Unit = {},
5051
updateStartMonth: (Int?) -> Unit = {},
52+
updateIsCheckBoxChecked: (Boolean) -> Unit = {},
5153
) {
5254
var isYearNull by remember { mutableStateOf(currentFilteringInfo.startYear == 0 || currentFilteringInfo.startYear == null) }
5355
var isMonthNull by remember { mutableStateOf(currentFilteringInfo.startMonth == 0 || currentFilteringInfo.startMonth == null) }
5456

55-
var isCheckBoxChecked by remember { mutableStateOf(false) }
56-
5757
val yearsList by remember(isYearNull) {
5858
mutableStateOf(
5959
if (isYearNull) years + NULL_DATE
@@ -91,7 +91,7 @@ internal fun PlanFilteringScreen(
9191
).toImmutableList(),
9292
onButtonClick = {
9393
updateGrade(it)
94-
isCheckBoxChecked = false
94+
updateIsCheckBoxChecked(false)
9595
},
9696
columns = 4,
9797
modifier = Modifier
@@ -116,7 +116,7 @@ internal fun PlanFilteringScreen(
116116
).toImmutableList(),
117117
onButtonClick = {
118118
updateWorkingPeriod(it)
119-
isCheckBoxChecked = false
119+
updateIsCheckBoxChecked(false)
120120
},
121121
modifier = Modifier
122122
.padding(horizontal = 23.dp),
@@ -134,14 +134,14 @@ internal fun PlanFilteringScreen(
134134
onYearChosen = { year ->
135135
updateStartYear(year)
136136
if (year != null) {
137-
isCheckBoxChecked = false
137+
updateIsCheckBoxChecked(false)
138138
isYearNull = false
139139
}
140140
},
141141
onMonthChosen = { month ->
142142
updateStartMonth(month)
143143
if (month != null) {
144-
isCheckBoxChecked = false
144+
updateIsCheckBoxChecked(false)
145145
isMonthNull = false
146146
}
147147
},
@@ -174,7 +174,7 @@ internal fun PlanFilteringScreen(
174174
updateStartYear(null)
175175
updateStartMonth(null)
176176
}
177-
isCheckBoxChecked = isChecked
177+
updateIsCheckBoxChecked(isChecked)
178178
},
179179
colors = CheckboxDefaults.colors(
180180
checkedColor = TerningMain,

feature/main/src/main/java/com/terning/feature/main/MainScreen.kt

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,11 @@ package com.terning.feature.main
33
import android.app.Activity
44
import android.content.Intent
55
import androidx.activity.compose.BackHandler
6-
import androidx.compose.animation.AnimatedVisibility
76
import androidx.compose.animation.EnterTransition
87
import androidx.compose.animation.ExitTransition
9-
import androidx.compose.animation.fadeIn
10-
import androidx.compose.animation.fadeOut
11-
import androidx.compose.animation.slideIn
12-
import androidx.compose.animation.slideOut
138
import androidx.compose.foundation.layout.Column
149
import androidx.compose.foundation.layout.fillMaxSize
1510
import androidx.compose.foundation.layout.padding
16-
import androidx.compose.material3.Icon
17-
import androidx.compose.material3.NavigationBar
18-
import androidx.compose.material3.NavigationBarItem
19-
import androidx.compose.material3.NavigationBarItemDefaults
2011
import androidx.compose.material3.Scaffold
2112
import androidx.compose.material3.SnackbarDuration
2213
import androidx.compose.material3.SnackbarHost
@@ -30,20 +21,13 @@ import androidx.compose.runtime.rememberCoroutineScope
3021
import androidx.compose.runtime.setValue
3122
import androidx.compose.ui.Modifier
3223
import androidx.compose.ui.platform.LocalContext
33-
import androidx.compose.ui.res.painterResource
34-
import androidx.compose.ui.res.stringResource
35-
import androidx.compose.ui.unit.IntOffset
3624
import androidx.compose.ui.unit.dp
37-
import androidx.compose.ui.unit.sp
3825
import androidx.navigation.NavOptions
3926
import androidx.navigation.compose.NavHost
4027
import androidx.navigation.navOptions
4128
import com.terning.core.analytics.EventType
4229
import com.terning.core.designsystem.component.snackbar.TerningBasicSnackBar
43-
import com.terning.core.designsystem.theme.Grey300
44-
import com.terning.core.designsystem.theme.TerningMain
4530
import com.terning.core.designsystem.theme.White
46-
import com.terning.core.designsystem.util.NoRippleInteractionSource
4731
import com.terning.feature.calendar.calendar.navigation.calendarNavGraph
4832
import com.terning.feature.calendar.calendar.navigation.navigateCalendar
4933
import com.terning.feature.filtering.filteringone.navigation.filteringOneNavGraph
@@ -57,6 +41,7 @@ import com.terning.feature.home.navigation.homeNavGraph
5741
import com.terning.feature.home.navigation.navigateHome
5842
import com.terning.feature.intern.navigation.internNavGraph
5943
import com.terning.feature.intern.navigation.navigateIntern
44+
import com.terning.feature.main.component.MainBottomBar
6045
import com.terning.feature.mypage.mypage.navigation.myPageNavGraph
6146
import com.terning.feature.mypage.profileedit.navigation.profileEditNavGraph
6247
import com.terning.feature.onboarding.signin.navigation.navigateSignIn
@@ -68,7 +53,6 @@ import com.terning.feature.onboarding.splash.navigation.splashNavGraph
6853
import com.terning.feature.search.search.navigation.searchNavGraph
6954
import com.terning.feature.search.searchprocess.navigation.navigateSearchProcess
7055
import com.terning.feature.search.searchprocess.navigation.searchProcessNavGraph
71-
import kotlinx.collections.immutable.ImmutableList
7256
import kotlinx.collections.immutable.toImmutableList
7357
import kotlinx.coroutines.launch
7458

@@ -277,49 +261,3 @@ fun MainScreen(
277261
}
278262
}
279263
}
280-
281-
@Composable
282-
private fun MainBottomBar(
283-
isVisible: Boolean,
284-
tabs: ImmutableList<MainTab>,
285-
currentTab: MainTab?,
286-
onTabSelected: (MainTab) -> Unit,
287-
) {
288-
AnimatedVisibility(
289-
visible = isVisible,
290-
enter = fadeIn() + slideIn { IntOffset(0, 0) },
291-
exit = fadeOut() + slideOut { IntOffset(0, 0) }
292-
) {
293-
NavigationBar(containerColor = White) {
294-
tabs.forEach { itemType ->
295-
NavigationBarItem(
296-
interactionSource = NoRippleInteractionSource,
297-
selected = currentTab == itemType,
298-
onClick = {
299-
onTabSelected(itemType)
300-
},
301-
icon = {
302-
Icon(
303-
painter = painterResource(id = (itemType.icon)),
304-
contentDescription = stringResource(id = itemType.contentDescription)
305-
)
306-
},
307-
label = {
308-
Text(
309-
stringResource(id = itemType.contentDescription),
310-
fontSize = 9.sp
311-
)
312-
},
313-
colors = NavigationBarItemDefaults
314-
.colors(
315-
selectedIconColor = TerningMain,
316-
selectedTextColor = TerningMain,
317-
unselectedIconColor = Grey300,
318-
unselectedTextColor = Grey300,
319-
indicatorColor = White
320-
)
321-
)
322-
}
323-
}
324-
}
325-
}

0 commit comments

Comments
 (0)