Skip to content

Commit

Permalink
[DEL/#309] 로그 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Dec 20, 2024
1 parent 23f2f6a commit 81e0769
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.feature.home.component

import android.util.Log
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -19,7 +18,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -35,10 +33,6 @@ import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.type.Grade
import com.terning.core.designsystem.type.WorkingPeriod
import com.terning.core.designsystem.util.CalendarDefaults.END_MONTH
import com.terning.core.designsystem.util.CalendarDefaults.END_YEAR
import com.terning.core.designsystem.util.CalendarDefaults.START_MONTH
import com.terning.core.designsystem.util.CalendarDefaults.START_YEAR
import java.util.Calendar

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -67,14 +61,6 @@ fun HomeFilteringBottomSheet(
)
}

// todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기
var isYearNull by remember { mutableStateOf(false) }
var isMonthNull by remember { mutableStateOf(false) }
// todo: year와 month의 서버통신 값이 null이면 true로 넣기
var isCheck by remember { mutableStateOf(false) }

var isFirstNullAndFirstChange by remember { mutableStateOf(false) }

TerningBasicBottomSheet(
content = {
Column(
Expand Down Expand Up @@ -147,9 +133,15 @@ fun HomeFilteringBottomSheet(
.padding(horizontal = 24.dp)
)

val years = (START_YEAR..END_YEAR).map { "${it}" }
val months = (START_MONTH..END_MONTH).map { "${it}" }
// todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기
var isYearNull by remember { mutableStateOf(false) }
var isMonthNull by remember { mutableStateOf(false) }
// todo: year와 month의 서버통신 값이 null이면 true로 넣기
var isCheck by remember { mutableStateOf(false) }

var isFirstNullAndFirstChange by remember { mutableStateOf(false) }

// todo: 변수명 바꾸기
val yearsWithNull by remember(isYearNull) {
mutableStateOf(
if (isYearNull || isFirstNullAndFirstChange) years + "-"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.feature.home.component

import android.util.Log
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -43,11 +42,9 @@ import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import okhttp3.internal.toImmutableList

private val years =
(START_YEAR..END_YEAR).map { "${it}" }.toImmutableList()
val years = (START_YEAR..END_YEAR).map { "${it}" }.toImmutableList()

private val months =
(START_MONTH..END_MONTH).map { "${it}" }.toImmutableList()
val months = (START_MONTH..END_MONTH).map { "${it}" }.toImmutableList()

class PickerState {
var selectedItem by mutableStateOf("")
Expand All @@ -69,19 +66,15 @@ fun HomeYearMonthPicker(
months: List<String>,
isFirstNullAndFirstChange: Boolean
) {
// todo: 변수명 바꾸기
// val yearsWithNull = if (isYearNull) years + "-" else years
// val monthsWithNull = if (isMonthNull) months + "-" else months

val yearPickerState = rememberPickerState()
val monthPickerState = rememberPickerState()

var isFirst = isFirstNullAndFirstChange

val startYearIndex = remember(isYearNull) {
if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}")
.takeIf { it >= 0 } ?: 0
}
if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}")
.takeIf { it >= 0 } ?: 0
}

val startMonthIndex = remember(isMonthNull) {
if (isMonthNull) months.lastIndex else months.indexOf("${chosenMonth ?: "-"}")
Expand Down Expand Up @@ -156,15 +149,13 @@ fun DatePicker(
.map { index ->
var newItem = items
if (isNullSize) newItem = items + "-"
Log.d("PickerDebug", "Index: $index, Item: ${newItem.getOrNull(index)}")
newItem.getOrNull(index)
}
.distinctUntilChanged()
.collect { item ->
item?.let {
pickerState.selectedItem = it
onItemSelected(it)
Log.d("PickerDebug", "Selected Item: $it")
}
}
}
Expand Down

0 comments on commit 81e0769

Please sign in to comment.