diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt
index 9109deb87..f9a1c8ddc 100644
--- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt
+++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt
@@ -1,7 +1,6 @@
package com.terning.core.designsystem.component.bottomsheet
import androidx.compose.foundation.Image
-import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
@@ -27,10 +26,10 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.terning.core.R
-import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable
import com.terning.core.type.ProfileImage
+import com.terning.core.type.SelectedProfileImage
import kotlinx.coroutines.launch
/**
@@ -98,7 +97,6 @@ fun RadioButtonGroup(
modifier: Modifier = Modifier,
) {
val options = ProfileImage.entries
-
var selectedOptionIndex by rememberSaveable {
mutableIntStateOf(ProfileImage.toIndex(ProfileImage.fromString(initialSelectedOption)))
}
@@ -110,29 +108,23 @@ fun RadioButtonGroup(
modifier = modifier.padding(horizontal = 34.dp)
) {
itemsIndexed(options.take(6)) { index, option ->
- val imageModifier = if (selectedOptionIndex == index) {
- Modifier
- .border(
- color = TerningMain,
- width = 2.dp,
- shape = CircleShape
- )
- .aspectRatio(1f)
- } else {
- Modifier.aspectRatio(1f)
+ val isSelected = selectedOptionIndex == index
+ val imageResId = when {
+ isSelected -> SelectedProfileImage.entries[index].drawableResId
+ else -> option.drawableResId
}
Image(
- painter = painterResource(id = option.drawableResId),
+ painter = painterResource(id = imageResId),
contentDescription = "profile image",
- modifier = imageModifier
+ modifier = Modifier
+ .aspectRatio(1f)
.noRippleClickable {
onOptionSelected(option)
selectedOptionIndex = index
}
.clip(shape = CircleShape)
- .size(76.dp)
- .aspectRatio(1f)
+ .size(76.dp),
)
}
}
diff --git a/core/src/main/java/com/terning/core/designsystem/component/button/FilteringButton.kt b/core/src/main/java/com/terning/core/designsystem/component/button/FilteringButton.kt
index bc0ca38db..6a59e6f51 100644
--- a/core/src/main/java/com/terning/core/designsystem/component/button/FilteringButton.kt
+++ b/core/src/main/java/com/terning/core/designsystem/component/button/FilteringButton.kt
@@ -26,8 +26,10 @@ import com.terning.core.R
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.Grey375
+import com.terning.core.designsystem.theme.Grey50
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningPointTheme
+import com.terning.core.designsystem.theme.TerningSub5
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.util.NoRippleTheme
@@ -56,15 +58,19 @@ fun FilteringButton(
) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
- val backgroundColor = White
+ val backgroundColor = when {
+ !isSelected && isPressed -> Grey50
+ isSelected && isPressed -> TerningSub5
+ else -> White
+ }
val textColor = when {
- !isSelected -> Grey375
- isPressed -> Grey375
+ !isSelected && !isPressed -> Grey375
+ !isSelected && isPressed -> Grey375
else -> TerningMain
}
val borderColor = when {
!isSelected && !isPressed -> Grey150
- isPressed -> Grey200
+ !isSelected && isPressed -> Grey200
else -> TerningMain
}
diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt
index 9620bde6c..cec5586d5 100644
--- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt
+++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt
@@ -25,7 +25,7 @@ data class NameFieldState(
val helperMessage: Int,
val helperIcon: Int?,
val helperColor: Color,
- val isValid: Boolean
+ val isButtonValid: Boolean
)
@Composable
@@ -35,7 +35,8 @@ fun NameTextField(
hint: String,
modifier: Modifier = Modifier,
onValidationChanged: (Boolean) -> Unit,
- initialView: Boolean = false
+ initialView: Boolean = false,
+ isProfileChangedButNameSame: Boolean = false,
) {
val focusManager = LocalFocusManager.current
val keyboardController = LocalSoftwareKeyboardController.current
@@ -44,7 +45,7 @@ fun NameTextField(
val trimmedName: String
var isNameOutOfBounds = false
if (value.length > MAX_LENGTH) {
- trimmedName = value.substring(0, MAX_LENGTH)
+ trimmedName = value.substring(0, MAX_LENGTH + 1)
isNameOutOfBounds = true
} else {
trimmedName = value
@@ -58,7 +59,18 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper,
helperIcon = R.drawable.ic_name_text_field_check,
helperColor = White,
- isValid = false
+ isButtonValid = false
+ )
+ }
+
+ isProfileChangedButNameSame -> {
+ NameFieldState(
+ name = trimmedName,
+ lineColor = Grey500,
+ helperMessage = R.string.sign_up_helper,
+ helperIcon = R.drawable.ic_name_text_field_check,
+ helperColor = White,
+ isButtonValid = true
)
}
@@ -69,7 +81,7 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper_error,
helperIcon = R.drawable.ic_name_text_field_error,
helperColor = WarningRed,
- isValid = false
+ isButtonValid = false
)
}
@@ -80,7 +92,7 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper,
helperIcon = null,
helperColor = Grey400,
- isValid = false
+ isButtonValid = false
)
}
@@ -91,7 +103,7 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper_out,
helperIcon = R.drawable.ic_name_text_field_error,
helperColor = WarningRed,
- isValid = false
+ isButtonValid = false
)
}
@@ -102,19 +114,19 @@ fun NameTextField(
helperMessage = R.string.sign_up_helper_available,
helperIcon = R.drawable.ic_name_text_field_check,
helperColor = TerningMain,
- isValid = true
+ isButtonValid = true
)
}
}
- onValidationChanged(state.isValid)
+ onValidationChanged(state.isButtonValid)
TerningBasicTextField(
value = state.name,
onValueChange = onValueChange,
modifier = modifier,
textStyle = TerningTheme.typography.detail1,
- textColor = Black,
+ textColor = if (value.isNotEmpty()) Black else Grey400,
drawLineColor = state.lineColor,
cursorBrush = SolidColor(Grey400),
hint = hint,
diff --git a/core/src/main/java/com/terning/core/type/ProfileImage.kt b/core/src/main/java/com/terning/core/type/ProfileImage.kt
index 8ccc58040..551485ee6 100644
--- a/core/src/main/java/com/terning/core/type/ProfileImage.kt
+++ b/core/src/main/java/com/terning/core/type/ProfileImage.kt
@@ -31,3 +31,14 @@ enum class ProfileImage(
entries.indexOf(profileImage)
}
}
+
+enum class SelectedProfileImage(
+ @DrawableRes val drawableResId: Int,
+) {
+ BASIC(drawableResId = R.drawable.ic_terning_selected_profile_00),
+ LUCKY(drawableResId = R.drawable.ic_terning_selected_profile_01),
+ SMART(drawableResId = R.drawable.ic_terning_selected_profile_02),
+ GLASS(drawableResId = R.drawable.ic_terning_selected_profile_03),
+ CALENDAR(drawableResId = R.drawable.ic_terning_selected_profile_04),
+ PASSION(drawableResId = R.drawable.ic_terning_selected_profile_05);
+}
\ No newline at end of file
diff --git a/core/src/main/res/drawable/ic_terning_selected_profile_00.xml b/core/src/main/res/drawable/ic_terning_selected_profile_00.xml
new file mode 100644
index 000000000..8a9b710e5
--- /dev/null
+++ b/core/src/main/res/drawable/ic_terning_selected_profile_00.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_terning_selected_profile_01.xml b/core/src/main/res/drawable/ic_terning_selected_profile_01.xml
new file mode 100644
index 000000000..2a523a251
--- /dev/null
+++ b/core/src/main/res/drawable/ic_terning_selected_profile_01.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_terning_selected_profile_02.xml b/core/src/main/res/drawable/ic_terning_selected_profile_02.xml
new file mode 100644
index 000000000..2506e7877
--- /dev/null
+++ b/core/src/main/res/drawable/ic_terning_selected_profile_02.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_terning_selected_profile_03.xml b/core/src/main/res/drawable/ic_terning_selected_profile_03.xml
new file mode 100644
index 000000000..99a8c53c8
--- /dev/null
+++ b/core/src/main/res/drawable/ic_terning_selected_profile_03.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_terning_selected_profile_04.xml b/core/src/main/res/drawable/ic_terning_selected_profile_04.xml
new file mode 100644
index 000000000..ea7e41f94
--- /dev/null
+++ b/core/src/main/res/drawable/ic_terning_selected_profile_04.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_terning_selected_profile_05.xml b/core/src/main/res/drawable/ic_terning_selected_profile_05.xml
new file mode 100644
index 000000000..ec760e325
--- /dev/null
+++ b/core/src/main/res/drawable/ic_terning_selected_profile_05.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneRoute.kt b/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneRoute.kt
index e3cd9d226..28438e817 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneRoute.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneRoute.kt
@@ -3,10 +3,11 @@ package com.terning.feature.filtering.filteringone
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -34,13 +35,16 @@ fun FilteringOneRoute(
name: String,
onNextClick: (String) -> Unit,
navigateUp: () -> Unit,
- paddingValues: PaddingValues,
viewModel: FilteringOneViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsStateWithLifecycle()
val lifecycleOwner = LocalLifecycleOwner.current
+ LaunchedEffect(key1 = true) {
+ viewModel.updateButton(false)
+ }
+
LaunchedEffect(viewModel.sideEffects, lifecycleOwner) {
viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle)
.collect { sideEffect ->
@@ -54,13 +58,17 @@ fun FilteringOneRoute(
FilteringOneScreen(
name = name,
onButtonClick = { grade ->
- viewModel.updateGradeAndButton(grade)
+ with(viewModel) {
+ if (grade.isNotEmpty()) {
+ updateGrade(grade)
+ updateButton(true)
+ } else updateButton(false)
+ }
},
onNextClick = viewModel::navigateToFilteringTwo,
navigateUp = viewModel::navigateUp,
buttonState = state.isButtonValid,
gradeState = state.grade,
- paddingValues = paddingValues
)
}
@@ -72,11 +80,11 @@ fun FilteringOneScreen(
onButtonClick: (String) -> Unit,
buttonState: Boolean,
gradeState: String,
- paddingValues: PaddingValues = PaddingValues(),
) {
Column(
modifier = Modifier
- .padding(paddingValues)
+ .statusBarsPadding()
+ .navigationBarsPadding()
.background(White)
) {
BackButtonTopAppBar(
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneViewModel.kt b/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneViewModel.kt
index 60704bd02..90f07f3c2 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneViewModel.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringone/FilteringOneViewModel.kt
@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
class FilteringOneViewModel : ViewModel() {
@@ -18,10 +19,17 @@ class FilteringOneViewModel : ViewModel() {
private val _sideEffects = MutableSharedFlow()
val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow()
- fun updateGradeAndButton(grade: String) {
+ fun updateButton(isButtonValid: Boolean) {
+ _state.update { currentState ->
+ currentState.copy(
+ isButtonValid = isButtonValid
+ )
+ }
+ }
+
+ fun updateGrade(grade: String) {
_state.value = _state.value.copy(
grade = grade,
- isButtonValid = true
)
}
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringone/component/StatusOneRadioGroup.kt b/feature/src/main/java/com/terning/feature/filtering/filteringone/component/StatusOneRadioGroup.kt
index c0c537db2..23630aeae 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringone/component/StatusOneRadioGroup.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringone/component/StatusOneRadioGroup.kt
@@ -35,7 +35,6 @@ fun StatusOneRadioGroup(
R.string.filtering_status1_description4
)
- val selectedIndex = remember { mutableIntStateOf(options[0]) }
val selectedButton = remember { mutableStateListOf(false, false, false, false) }
LazyVerticalGrid(
@@ -50,10 +49,14 @@ fun StatusOneRadioGroup(
modifier = modifier.fillMaxWidth(),
text = if (selectedButton[index]) selectedOptions[index] else option,
onButtonClick = {
- selectedIndex.intValue = option
- selectedButton.indices.forEach { i -> selectedButton[i] = false }
- selectedButton[index] = true
- onButtonClick(Grade.entries[index].stringValue)
+ if (selectedButton[index]) {
+ selectedButton[index] = false
+ onButtonClick("")
+ } else {
+ selectedButton.indices.forEach { i -> selectedButton[i] = false }
+ selectedButton[index] = true
+ onButtonClick(Grade.entries[index].stringValue)
+ }
},
cornerRadius = 15.dp,
paddingVertical = 14.dp
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringone/navigation/FilteringOneNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/filteringone/navigation/FilteringOneNavigation.kt
index d771d018f..dd84da037 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringone/navigation/FilteringOneNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringone/navigation/FilteringOneNavigation.kt
@@ -1,6 +1,5 @@
package com.terning.feature.filtering.filtering.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
@@ -22,13 +21,11 @@ fun NavController.navigateFilteringOne(
}
fun NavGraphBuilder.filteringOneNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController
) {
composable {
val args = it.toRoute()
FilteringOneRoute(
- paddingValues = paddingValues,
name = args.name,
onNextClick = navHostController::navigateFilteringTwo,
navigateUp = navHostController::navigateUp
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt b/feature/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt
index 59a24ebd6..186610ddb 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt
@@ -3,11 +3,12 @@ package com.terning.feature.filtering.filteringthree
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -41,7 +42,6 @@ fun FilteringThreeRoute(
workingPeriod: String,
navigateUp: () -> Unit,
navigateToStartHome: () -> Unit,
- paddingValues: PaddingValues,
viewModel: FilteringThreeViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsStateWithLifecycle()
@@ -75,7 +75,6 @@ fun FilteringThreeRoute(
}
FilteringThreeScreen(
- paddingValues = paddingValues,
navigateUp = viewModel::navigateUp,
chosenYear = Calendar.getInstance().currentYear,
chosenMonth = Calendar.getInstance().currentMonth,
@@ -93,11 +92,11 @@ fun FilteringThreeScreen(
onYearChosen: (Int) -> Unit,
onMonthChosen: (Int) -> Unit,
onNextClick: () -> Unit,
- paddingValues: PaddingValues = PaddingValues(),
) {
Column(
modifier = Modifier
- .padding(paddingValues)
+ .statusBarsPadding()
+ .navigationBarsPadding()
.background(White),
) {
BackButtonTopAppBar(
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringthree/navigation/FilteringThreeNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/filteringthree/navigation/FilteringThreeNavigation.kt
index d1213c9bd..24d255630 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringthree/navigation/FilteringThreeNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringthree/navigation/FilteringThreeNavigation.kt
@@ -1,6 +1,5 @@
package com.terning.feature.filtering.filteringthree.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
@@ -24,13 +23,11 @@ fun NavController.navigateFilteringThree(
}
fun NavGraphBuilder.filteringThreeNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController
) {
composable {
val args = it.toRoute()
FilteringThreeRoute(
- paddingValues = paddingValues,
grade = args.grade,
workingPeriod = args.workingPeriod,
navigateUp = navHostController::navigateUp,
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoRoute.kt b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoRoute.kt
index 2f4dc26fc..facee419f 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoRoute.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoRoute.kt
@@ -3,10 +3,11 @@ package com.terning.feature.filtering.filteringtwo
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -34,13 +35,16 @@ fun FilteringTwoRoute(
grade: String,
onNextClick: (String, String) -> Unit,
navigateUp: () -> Unit,
- paddingValues: PaddingValues,
viewModel: FilteringTwoViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsStateWithLifecycle()
val lifecycleOwner = LocalLifecycleOwner.current
+ LaunchedEffect(key1 = true) {
+ viewModel.updateButton(false)
+ }
+
LaunchedEffect(viewModel.sideEffects, lifecycleOwner) {
viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle)
.collect { sideEffect ->
@@ -59,11 +63,15 @@ fun FilteringTwoRoute(
onNextClick = viewModel::navigateToFilteringThree,
navigateUp = viewModel::navigateUp,
onButtonClick = { workingPeriod ->
- viewModel.updateWorkingPeriodAndButton(workingPeriod)
+ with(viewModel) {
+ if (workingPeriod.isNotEmpty()) {
+ updateWorkingPeriod(workingPeriod)
+ updateButton(true)
+ } else updateButton(false)
+ }
},
buttonState = state.isButtonValid,
workingPeriod = state.workingPeriod,
- paddingValues = paddingValues
)
}
@@ -75,12 +83,12 @@ fun FilteringTwoScreen(
onButtonClick: (String) -> Unit,
buttonState: Boolean,
workingPeriod: String,
- paddingValues: PaddingValues = PaddingValues(),
) {
Column(
modifier = Modifier
- .padding(paddingValues)
.background(White)
+ .statusBarsPadding()
+ .navigationBarsPadding()
) {
BackButtonTopAppBar(
onBackButtonClick = navigateUp
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoViewModel.kt b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoViewModel.kt
index 495fd3fd1..c4ed74cfe 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoViewModel.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/FilteringTwoViewModel.kt
@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
class FilteringTwoViewModel : ViewModel() {
@@ -18,10 +19,17 @@ class FilteringTwoViewModel : ViewModel() {
private val _sideEffects = MutableSharedFlow()
val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow()
- fun updateWorkingPeriodAndButton(workingPeriod: String) {
+ fun updateButton(isButtonValid: Boolean) {
+ _state.update { currentState ->
+ currentState.copy(
+ isButtonValid = isButtonValid
+ )
+ }
+ }
+
+ fun updateWorkingPeriod(workingPeriod: String) {
_state.value = _state.value.copy(
workingPeriod = workingPeriod,
- isButtonValid = true
)
}
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/component/StatusTwoRadioGroup.kt b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/component/StatusTwoRadioGroup.kt
index 72579da5e..7faac5a44 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/component/StatusTwoRadioGroup.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/component/StatusTwoRadioGroup.kt
@@ -7,7 +7,6 @@ import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -33,7 +32,6 @@ fun StatusTwoRadioGroup(
R.string.filtering_status2_description3,
)
- val selectedIndex = remember { mutableIntStateOf(options[0]) }
val selectedButton = remember { mutableStateListOf(false, false, false) }
LazyVerticalGrid(
@@ -48,10 +46,14 @@ fun StatusTwoRadioGroup(
modifier = modifier.fillMaxWidth(),
text = if (selectedButton[index]) selectedOptions[index] else option,
onButtonClick = {
- selectedIndex.intValue = option
- selectedButton.indices.forEach { i -> selectedButton[i] = false }
- selectedButton[index] = true
- onButtonClick(WorkingPeriod.entries[index].stringValue)
+ if (selectedButton[index]) {
+ selectedButton[index] = false
+ onButtonClick("")
+ } else {
+ selectedButton.indices.forEach { i -> selectedButton[i] = false }
+ selectedButton[index] = true
+ onButtonClick(WorkingPeriod.entries[index].stringValue)
+ }
},
cornerRadius = 15.dp,
paddingVertical = 24.dp
diff --git a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/navigation/FilteringTwoNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/navigation/FilteringTwoNavigation.kt
index 205233c12..8f72ac7a9 100644
--- a/feature/src/main/java/com/terning/feature/filtering/filteringtwo/navigation/FilteringTwoNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/filteringtwo/navigation/FilteringTwoNavigation.kt
@@ -1,6 +1,5 @@
package com.terning.feature.filtering.filtering.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
@@ -23,13 +22,11 @@ fun NavController.navigateFilteringTwo(
}
fun NavGraphBuilder.filteringTwoNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController
) {
composable {
val args = it.toRoute()
FilteringTwoRoute(
- paddingValues = paddingValues,
grade = args.grade,
onNextClick = { _, workingPeriod ->
navHostController.navigateFilteringThree(
diff --git a/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringRoute.kt b/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringRoute.kt
index 47c47b9fc..9c3d8c975 100644
--- a/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringRoute.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringRoute.kt
@@ -2,16 +2,16 @@ package com.terning.feature.filtering.startfiltering
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
-import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -19,7 +19,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
-import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
@@ -37,7 +36,6 @@ import kotlinx.coroutines.delay
@Composable
fun StartFilteringRoute(
- paddingValues: PaddingValues = PaddingValues(),
onNextClick: () -> Unit,
viewModel: StartFilteringViewModel = hiltViewModel()
) {
@@ -55,7 +53,6 @@ fun StartFilteringRoute(
onNextClick = onNextClick,
buttonState = state.isButtonVisible,
screenHeight = screenHeight,
- paddingValues = paddingValues
)
}
@@ -65,12 +62,12 @@ fun StartFilteringScreen(
onNextClick: () -> Unit,
buttonState: Boolean,
screenHeight: Float,
- paddingValues: PaddingValues = PaddingValues()
) {
Box(
modifier = Modifier
.fillMaxSize()
- .padding(paddingValues)
+ .statusBarsPadding()
+ .navigationBarsPadding()
.background(White)
) {
Column(
diff --git a/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt
index 38abe0cc2..f217cf39e 100644
--- a/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt
@@ -1,6 +1,5 @@
package com.terning.feature.filtering.startfiltering.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
@@ -23,13 +22,11 @@ fun NavController.navigateStartFiltering(
}
fun NavGraphBuilder.startFilteringNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController
) {
composable {
val args = it.toRoute()
StartFilteringRoute(
- paddingValues = paddingValues,
onNextClick = {
navHostController.navigateFilteringOne(args.name)
}
diff --git a/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeRoute.kt b/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeRoute.kt
index 246cbc8d9..69ec4e7e6 100644
--- a/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeRoute.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeRoute.kt
@@ -5,13 +5,14 @@ import androidx.compose.animation.fadeIn
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -39,7 +40,6 @@ import kotlinx.coroutines.delay
@Composable
fun StartHomeRoute(
navigateToHome: () -> Unit,
- paddingValues: PaddingValues = PaddingValues(),
viewModel: StartHomeViewModel = hiltViewModel()
) {
val state by viewModel.state.collectAsStateWithLifecycle()
@@ -56,7 +56,6 @@ fun StartHomeRoute(
navigateToHome = navigateToHome,
buttonState = state.isButtonVisible,
screenHeight = screenHeight,
- paddingValues = paddingValues
)
}
@@ -65,13 +64,13 @@ fun StartHomeScreen(
navigateToHome: () -> Unit,
buttonState: Boolean,
screenHeight: Float,
- paddingValues: PaddingValues = PaddingValues()
) {
Box(
modifier = Modifier
.fillMaxSize()
- .padding(paddingValues)
.background(White)
+ .statusBarsPadding()
+ .navigationBarsPadding()
) {
Column(
modifier = Modifier.fillMaxSize(),
diff --git a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt
index bc63ae44c..ca1c71795 100644
--- a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt
@@ -1,15 +1,14 @@
package com.terning.feature.filtering.starthome.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
+import androidx.navigation.navOptions
import com.terning.core.navigation.Route
import com.terning.feature.filtering.starthome.StartHomeRoute
import com.terning.feature.home.home.navigation.navigateHome
-import com.terning.feature.onboarding.signin.navigation.SignIn
import kotlinx.serialization.Serializable
fun NavController.navigateStartHome(navOptions: NavOptions? = null) {
@@ -20,18 +19,18 @@ fun NavController.navigateStartHome(navOptions: NavOptions? = null) {
}
fun NavGraphBuilder.startHomeNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController
) {
composable {
+ val navOptions = navOptions {
+ popUpTo(id = navHostController.graph.id) {
+ inclusive = true
+ }
+ }
StartHomeRoute(
- paddingValues = paddingValues,
navigateToHome = {
navHostController.navigateHome(
- navOptions = NavOptions.Builder().setPopUpTo(
- route = SignIn,
- inclusive = true
- ).build()
+ navOptions = navOptions
)
}
)
diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt
index ce270cd8e..f424df75b 100644
--- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt
+++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt
@@ -11,6 +11,7 @@ import androidx.compose.animation.slideIn
import androidx.compose.animation.slideOut
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
@@ -30,6 +31,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.IntOffset
+import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.compose.NavHost
import com.terning.core.designsystem.component.snackbar.TerningBasicSnackBar
@@ -82,11 +84,14 @@ fun MainScreen(
Scaffold(
snackbarHost = {
- SnackbarHost(hostState = snackBarHostState) { snackBarData ->
+ SnackbarHost(
+ hostState = snackBarHostState,
+ modifier = Modifier.padding(bottom = 10.dp)
+ ) { snackBarData ->
TerningBasicSnackBar {
Text(
text = snackBarData.visuals.message,
- color = White,
+ color = White
)
}
}
@@ -119,10 +124,7 @@ fun MainScreen(
navController = navigator.navController,
startDestination = navigator.startDestination
) {
- splashNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
+ splashNavGraph(navHostController = navigator.navController)
homeNavGraph(
paddingValues = paddingValues,
navHostController = navigator.navController
@@ -135,34 +137,13 @@ fun MainScreen(
paddingValues = paddingValues,
navHostController = navigator.navController
)
- signInNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
- signUpNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
- startFilteringNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
- startHomeNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
- filteringOneNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
- filteringTwoNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
- filteringThreeNavGraph(
- paddingValues = paddingValues,
- navHostController = navigator.navController
- )
+ signInNavGraph(navHostController = navigator.navController)
+ signUpNavGraph(navHostController = navigator.navController)
+ startFilteringNavGraph(navHostController = navigator.navController)
+ startHomeNavGraph(navHostController = navigator.navController)
+ filteringOneNavGraph(navHostController = navigator.navController)
+ filteringTwoNavGraph(navHostController = navigator.navController)
+ filteringThreeNavGraph(navHostController = navigator.navController)
searchProcessNavGraph(
paddingValues = paddingValues,
navHostController = navigator.navController
diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt
index e6a88254b..15c76c8a4 100644
--- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt
@@ -1,6 +1,7 @@
package com.terning.feature.mypage.mypage
import android.content.Context
+import android.content.Intent
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
@@ -47,6 +48,7 @@ import com.terning.core.extension.noRippleClickable
import com.terning.core.extension.toast
import com.terning.core.state.UiState
import com.terning.feature.R
+import com.terning.feature.main.MainActivity
import com.terning.feature.mypage.component.MyPageProfile
import com.terning.feature.mypage.mypage.component.MyPageItem
import com.terning.feature.mypage.mypage.util.MyPageDefaults.NOTICE_URL
@@ -58,7 +60,7 @@ import com.terning.feature.mypage.mypage.util.MyPageDefaults.VERSION
@Composable
fun MyPageRoute(
paddingValues: PaddingValues,
- navigateToProfileEdit: (String, String) -> Unit,
+ navigateToProfileEdit: (String, String, String) -> Unit,
viewModel: MyPageViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsStateWithLifecycle()
@@ -91,7 +93,8 @@ fun MyPageRoute(
when (sideEffect) {
is MyPageSideEffect.NavigateToProfileEdit -> navigateToProfileEdit(
state.name,
- state.profileImage
+ state.profileImage,
+ state.authType
)
is MyPageSideEffect.ShowToast -> context.toast(sideEffect.message)
@@ -101,6 +104,8 @@ fun MyPageRoute(
is MyPageSideEffect.NavigateToPersonalWebView -> navigateToPersonalWebView(
context
)
+
+ is MyPageSideEffect.RestartApp -> restartApp(context)
}
}
}
@@ -123,16 +128,6 @@ fun MyPageRoute(
)
}
- when (state.isLogoutAndQuitSuccess) {
- is UiState.Success -> {
- viewModel.restartApp(context)
- }
-
- is UiState.Loading -> {}
- is UiState.Empty -> {}
- is UiState.Failure -> {}
- }
-
when (state.isGetSuccess) {
is UiState.Success -> {
MyPageScreen(
@@ -414,6 +409,14 @@ private fun navigateToPersonalWebView(context: Context) {
CustomTabsIntent.Builder().build().launchUrl(context, PERSONAL_URL.toUri())
}
+private fun restartApp(context: Context) {
+ Intent(context, MainActivity::class.java).apply {
+ addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ context.startActivity(this)
+ }
+}
+
@Preview(showBackground = true)
@Composable
fun MyPageScreenPreview() {
diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt
index fa8f43cf1..ce07e43a5 100644
--- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt
@@ -9,4 +9,5 @@ sealed class MyPageSideEffect {
data object NavigateToServiceWebView : MyPageSideEffect()
data object NavigateToPersonalWebView : MyPageSideEffect()
data class ShowToast(@StringRes val message: Int) : MyPageSideEffect()
+ data object RestartApp : MyPageSideEffect()
}
\ No newline at end of file
diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt
index 921031d8c..e53a43dd3 100644
--- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt
@@ -3,7 +3,6 @@ package com.terning.feature.mypage.mypage
import com.terning.core.state.UiState
data class MyPageState(
- val isLogoutAndQuitSuccess: UiState = UiState.Loading,
val isGetSuccess: UiState = UiState.Loading,
val name: String = "",
val profileImage: String = "",
diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt
index 1bec5979f..d26ec9575 100644
--- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt
@@ -1,18 +1,12 @@
package com.terning.feature.mypage.mypage
-import android.content.Context
-import android.content.Intent
-import android.os.Handler
-import android.os.Looper
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
-import com.jakewharton.processphoenix.ProcessPhoenix
import com.kakao.sdk.user.UserApiClient
import com.terning.core.state.UiState
import com.terning.domain.repository.MyPageRepository
import com.terning.domain.repository.TokenRepository
import com.terning.feature.R
-import com.terning.feature.main.MainActivity
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
@@ -38,33 +32,22 @@ class MyPageViewModel @Inject constructor(
fun logoutKakao() {
UserApiClient.instance.logout { error ->
if (error == null) {
- postLogout()
+ logoutApp()
} else {
- _state.value =
- _state.value.copy(isLogoutAndQuitSuccess = UiState.Failure(error.toString()))
+ viewModelScope.launch {
+ _sideEffects.emit(MyPageSideEffect.ShowToast(R.string.server_failure))
+ }
}
}
}
- private fun postLogout() {
+ private fun logoutApp() {
viewModelScope.launch {
myPageRepository.postLogout().onSuccess {
tokenRepository.clearInfo()
- _state.value = _state.value.copy(isLogoutAndQuitSuccess = UiState.Success(true))
+ _sideEffects.emit(MyPageSideEffect.RestartApp)
}.onFailure {
- _state.value =
- _state.value.copy(isLogoutAndQuitSuccess = UiState.Failure(it.toString()))
- }
- }
- }
-
- fun restartApp(context: Context) {
- Handler(Looper.getMainLooper()).post {
- Handler(Looper.getMainLooper()).post {
- ProcessPhoenix.triggerRebirth(
- context,
- Intent(context, MainActivity::class.java)
- )
+ _sideEffects.emit(MyPageSideEffect.ShowToast(R.string.server_failure))
}
}
}
@@ -72,22 +55,22 @@ class MyPageViewModel @Inject constructor(
fun quitKakao() {
UserApiClient.instance.unlink { error ->
if (error == null) {
- deleteQuit()
+ quitApp()
} else {
- _state.value =
- _state.value.copy(isLogoutAndQuitSuccess = UiState.Failure(error.toString()))
+ viewModelScope.launch {
+ _sideEffects.emit(MyPageSideEffect.ShowToast(R.string.server_failure))
+ }
}
}
}
- private fun deleteQuit() {
+ private fun quitApp() {
viewModelScope.launch {
myPageRepository.deleteQuit().onSuccess {
tokenRepository.clearInfo()
- _state.value = _state.value.copy(isLogoutAndQuitSuccess = UiState.Success(true))
+ _sideEffects.emit(MyPageSideEffect.RestartApp)
}.onFailure {
- _state.value =
- _state.value.copy(isLogoutAndQuitSuccess = UiState.Failure(it.toString()))
+ _sideEffects.emit(MyPageSideEffect.ShowToast(R.string.server_failure))
}
}
}
diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt
index e2543a085..30d7de08b 100644
--- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt
@@ -25,10 +25,11 @@ fun NavGraphBuilder.myPageNavGraph(
composable {
MyPageRoute(
paddingValues = paddingValues,
- navigateToProfileEdit = { name, profileImage ->
+ navigateToProfileEdit = { name, profileImage, authType ->
navHostController.navigateProfileEdit(
name,
- profileImage
+ profileImage,
+ authType
)
}
)
diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt
index 7dba0d325..3c05b18cd 100644
--- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt
@@ -44,6 +44,7 @@ fun ProfileEditRoute(
navigateUp: () -> Unit,
initialName: String,
initialProfile: String,
+ authType: String,
viewModel: ProfileEditViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsStateWithLifecycle()
@@ -62,7 +63,8 @@ fun ProfileEditRoute(
LaunchedEffect(key1 = true) {
viewModel.updateInitialInfo(
initialName = initialName,
- initialProfile = initialProfile
+ initialProfile = initialProfile,
+ authType = authType
)
}
@@ -163,7 +165,8 @@ fun ProfileEditScreen(
onValidationChanged = { isValid ->
onValidationChanged(isValid)
},
- initialView = profileEditState.initialView
+ initialView = profileEditState.initialView,
+ isProfileChangedButNameSame = profileEditState.isProfileChangedButNameSame
)
Spacer(modifier = Modifier.height(48.dp))
Text(
@@ -173,7 +176,8 @@ fun ProfileEditScreen(
)
Spacer(modifier = Modifier.height(11.dp))
Text(
- text = profileEditState.authType,
+ text = if (profileEditState.authType == KAKA0) stringResource(id = R.string.profile_edit_kakao)
+ else "",
style = TerningTheme.typography.detail0
)
}
@@ -189,6 +193,8 @@ fun ProfileEditScreen(
}
}
+private const val KAKA0 = "KAKAO"
+
@Preview(showBackground = true)
@Composable
fun ProfileEditScreenPreview() {
diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt
index 41d811f37..9305ce422 100644
--- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt
@@ -7,6 +7,8 @@ data class ProfileEditState(
val initialProfile: String = "",
val initialView: Boolean = true,
val isModified: Boolean = false,
+ val isNameChangedOnce: Boolean = false,
+ val isProfileChangedButNameSame: Boolean = false,
val isButtonValid: Boolean = false,
val authType: String = "",
val showBottomSheet: Boolean = false
diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt
index a12f19733..118230e2f 100644
--- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt
@@ -32,12 +32,13 @@ class ProfileEditViewModel @Inject constructor(
_state.value = _state.value.copy(showBottomSheet = isVisible)
}
- fun updateInitialInfo(initialName: String, initialProfile: String) {
+ fun updateInitialInfo(initialName: String, initialProfile: String, authType: String) {
_state.value = _state.value.copy(
name = initialName,
initialName = initialName,
profile = initialProfile,
- initialProfile = initialProfile
+ initialProfile = initialProfile,
+ authType = authType
)
}
@@ -45,18 +46,21 @@ class ProfileEditViewModel @Inject constructor(
_state.value = _state.value.copy(
name = name,
initialView = false,
- isModified = true
+ isModified = true,
+ isProfileChangedButNameSame = false,
+ isNameChangedOnce = true
)
}
fun updateProfile(profile: String) {
val isSameAsInitial = profile == _state.value.initialProfile
- val isSameAsPrevious = profile == _state.value.profile
_state.value = _state.value.copy(
profile = profile,
- initialView = !_state.value.isModified && isSameAsInitial,
- isModified = if (isSameAsPrevious) _state.value.isModified else !isSameAsInitial
+ initialView = false,
+ isModified = if (profile == _state.value.profile) _state.value.isModified else !isSameAsInitial,
+ isProfileChangedButNameSame = if (_state.value.isNameChangedOnce) false
+ else state.value.name == _state.value.initialName
)
}
diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt
index 61b250f75..6127b7b50 100644
--- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt
@@ -17,10 +17,15 @@ import kotlinx.serialization.Serializable
fun NavController.navigateProfileEdit(
name: String,
profileImage: String,
+ authType: String,
navOptions: NavOptions? = null
) {
navigate(
- route = ProfileEdit(name = name, profileImage = profileImage),
+ route = ProfileEdit(
+ name = name,
+ profileImage = profileImage,
+ authType = authType
+ ),
navOptions = navOptions
)
}
@@ -46,6 +51,7 @@ fun NavGraphBuilder.profileEditNavGraph(
ProfileEditRoute(
initialName = args.name,
initialProfile = args.profileImage,
+ authType = args.authType,
navigateUp = { navHostController.navigateUp() }
)
}
@@ -54,5 +60,6 @@ fun NavGraphBuilder.profileEditNavGraph(
@Serializable
data class ProfileEdit(
val name: String,
- val profileImage: String
+ val profileImage: String,
+ val authType: String
) : Route
\ No newline at end of file
diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt
index 9b946f9f5..875070c41 100644
--- a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt
+++ b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt
@@ -3,11 +3,12 @@ package com.terning.feature.onboarding.signin
import android.content.Context
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
@@ -32,7 +33,6 @@ import com.terning.feature.onboarding.signin.component.KakaoButton
@Composable
fun SignInRoute(
- paddingValues: PaddingValues,
navigateToHome: () -> Unit,
navigateToSignUp: (String) -> Unit,
viewModel: SignInViewModel = hiltViewModel(),
@@ -81,7 +81,6 @@ fun SignInRoute(
}
SignInScreen(
- paddingValues = paddingValues,
onSignInClick = {
viewModel.startKakaoLogIn(
isKakaoAvailable = UserApiClient.instance.isKakaoTalkLoginAvailable(
@@ -95,13 +94,13 @@ fun SignInRoute(
@Composable
fun SignInScreen(
onSignInClick: () -> Unit,
- paddingValues: PaddingValues = PaddingValues(),
) {
Column(
modifier = Modifier
.fillMaxSize()
.background(color = White)
- .padding(paddingValues)
+ .statusBarsPadding()
+ .navigationBarsPadding()
.padding(horizontal = 20.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt
index 49f367ab3..1f9559611 100644
--- a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt
@@ -1,11 +1,11 @@
package com.terning.feature.onboarding.signin.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
+import androidx.navigation.navOptions
import com.terning.core.navigation.Route
import com.terning.feature.home.home.navigation.navigateHome
import com.terning.feature.onboarding.signin.SignInRoute
@@ -20,14 +20,21 @@ fun NavController.navigateSignIn(navOptions: NavOptions? = null) {
}
fun NavGraphBuilder.signInNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController,
) {
composable {
+ val navOptions = navOptions {
+ popUpTo(id = navHostController.graph.id) {
+ inclusive = true
+ }
+ }
SignInRoute(
- paddingValues = paddingValues,
- navigateToHome = { navHostController.navigateHome() },
- navigateToSignUp = { authId -> navHostController.navigateSignUp(authId) }
+ navigateToHome = {
+ navHostController.navigateHome(navOptions = navOptions)
+ },
+ navigateToSignUp = { authId ->
+ navHostController.navigateSignUp(authId = authId, navOptions = navOptions)
+ }
)
}
}
diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt
index ba7e5c715..c00b5cb96 100644
--- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt
+++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt
@@ -1,11 +1,13 @@
package com.terning.feature.onboarding.signup
+import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -28,6 +30,7 @@ import com.terning.core.designsystem.component.textfield.NameTextField
import com.terning.core.designsystem.theme.Grey500
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.theme.TerningTheme
+import com.terning.core.designsystem.theme.White
import com.terning.core.extension.addFocusCleaner
import com.terning.core.extension.noRippleClickable
import com.terning.core.extension.toast
@@ -35,7 +38,6 @@ import com.terning.feature.R
@Composable
fun SignUpRoute(
- paddingValues: PaddingValues,
authId: String,
navigateToStartFiltering: (String) -> Unit,
viewModel: SignUpViewModel = hiltViewModel(),
@@ -72,7 +74,6 @@ fun SignUpRoute(
}
SignUpScreen(
- paddingValues = paddingValues,
state = state,
onSignUpClick = {
viewModel.postSignUpWithServer()
@@ -96,7 +97,6 @@ fun SignUpScreen(
onInputChange: (String) -> Unit,
onProfileEditClick: (Boolean) -> Unit,
onValidationChanged: (Boolean) -> Unit,
- paddingValues: PaddingValues = PaddingValues(),
) {
val focusManager = LocalFocusManager.current
@@ -104,7 +104,9 @@ fun SignUpScreen(
modifier = Modifier
.fillMaxSize()
.addFocusCleaner(focusManager)
- .padding(paddingValues)
+ .statusBarsPadding()
+ .navigationBarsPadding()
+ .background(White)
) {
Spacer(modifier = Modifier.height(56.dp))
Text(
diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt
index 07a1c7fa2..a85c99f4a 100644
--- a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt
@@ -1,11 +1,11 @@
package com.terning.feature.onboarding.signup.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
+import androidx.navigation.navOptions
import androidx.navigation.toRoute
import com.terning.core.navigation.Route
import com.terning.feature.filtering.startfiltering.navigation.navigateStartFiltering
@@ -23,16 +23,23 @@ fun NavController.navigateSignUp(
}
fun NavGraphBuilder.signUpNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController
) {
composable {
val args = it.toRoute()
+ val navOptions = navOptions {
+ popUpTo(id = navHostController.graph.id) {
+ inclusive = true
+ }
+ }
SignUpRoute(
- paddingValues = paddingValues,
authId = args.authId,
- navigateToStartFiltering = { name -> navHostController.navigateStartFiltering(name) }
-
+ navigateToStartFiltering = { name ->
+ navHostController.navigateStartFiltering(
+ name = name,
+ navOptions = navOptions
+ )
+ }
)
}
}
diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt
index ba79374e2..6026f6787 100644
--- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt
+++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt
@@ -3,9 +3,9 @@ package com.terning.feature.onboarding.splash
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
@@ -22,7 +22,6 @@ import com.terning.feature.R
@Composable
fun SplashRoute(
- paddingValues: PaddingValues,
navigateToHome: () -> Unit,
navigateToSignIn: () -> Unit,
viewModel: SplashViewModel = hiltViewModel(),
@@ -56,16 +55,16 @@ fun SplashRoute(
}
}
- SplashScreen(paddingValues = paddingValues)
+ SplashScreen()
}
@Composable
fun SplashScreen(
- paddingValues: PaddingValues = PaddingValues(),
) {
Column(
modifier = Modifier
- .padding(paddingValues)
+ .statusBarsPadding()
+ .navigationBarsPadding()
.fillMaxSize()
.background(TerningMain),
) {
diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt
index 37dfeca9c..61dc771e7 100644
--- a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt
+++ b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt
@@ -1,6 +1,5 @@
package com.terning.feature.onboarding.splash.navigation
-import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
@@ -20,12 +19,10 @@ fun NavController.navigateSplash(navOptions: NavOptions? = null) {
}
fun NavGraphBuilder.splashNavGraph(
- paddingValues: PaddingValues,
navHostController: NavHostController,
) {
composable {
SplashRoute(
- paddingValues = paddingValues,
navigateToHome = {
navHostController.navigateHome(
navOptions = NavOptions.Builder().setPopUpTo(
diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml
index 89f20b9fd..b555c1064 100644
--- a/feature/src/main/res/values/strings.xml
+++ b/feature/src/main/res/values/strings.xml
@@ -95,12 +95,12 @@
오늘 마감인 공고가 없어요
- 터치 3번으로\n원하는 대학생 인턴 공고를 띄워드릴게요
+ 터닝에서 내 계획에 딱 맞는\n대학생 인턴 찾기를 도와드릴게요
시작화면 이미지
시작하기
- 이제 딱 맞는 공고와 함께\n터닝을 시작해 볼까요?
+ 나에게 딱 맞는 공고가 준비됐어요!\n터닝을 시작해 볼까요?
내 맞춤 공고 바로 보러가기
@@ -159,6 +159,7 @@
프로필 수정
저장하기
연동 계정
+ 카카오 로그인