From 5cc018e6d2f95de0b1e59318278fe94eced6ab41 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Wed, 28 Aug 2024 22:08:37 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[chore]=20=EC=95=8C=EB=A6=BC=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=88=A8=EA=B9=80=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokitmons/pokit/settings/setting/SettingsScreen.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt index a5db85da..74f30ece 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt @@ -45,9 +45,10 @@ fun SettingsScreen( SettingItem(title = stringResource(StringResource.nickname_settings)) { onNavigateToEditNickname() } - SettingItem(title = stringResource(StringResource.notification_settings)) { - // TODO 커스텀 토스트 메세지 - } + +// SettingItem(title = stringResource(StringResource.notification_settings)) { +// // TODO 커스텀 토스트 메세지 +// } DividerItem() From 58dd79ba666eb4c63cbcdf0724afee672fb5a47d Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Wed, 28 Aug 2024 22:22:43 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[chore]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=88=A8=EA=B9=80=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pokitmons/pokit/success/SignUpSuccessScreen.kt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt b/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt index 8fbd5d79..37aff9fb 100644 --- a/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt @@ -34,12 +34,6 @@ fun SignUpSuccessScreen( .background(color = Color.White) .padding(start = 20.dp, end = 20.dp, top = 20.dp, bottom = 28.dp) ) { - Icon( - modifier = Modifier.padding(start = 4.dp), - painter = painterResource(id = coreDrawable.icon_24_arrow_left), - contentDescription = null - ) - Column( modifier = Modifier .fillMaxWidth() From 7a1596094bcb5cb7b935b5817a8e65bbf3e2e8c7 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Wed, 28 Aug 2024 22:31:38 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[chore]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EA=B2=80=EC=82=AC=20=EB=94=9C=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=20=EA=B0=90=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../login/src/main/java/pokitmons/pokit/LoginViewModel.kt | 6 +++++- .../main/java/pokitmons/pokit/settings/SettingViewModel.kt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt index f19f7ec0..7786edf6 100644 --- a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt +++ b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt @@ -134,7 +134,7 @@ class LoginViewModel @Inject constructor( fun checkDuplicateNickname(nickname: String) { duplicateNicknameJob?.cancel() duplicateNicknameJob = viewModelScope.launch { - delay(1.second()) + delay(0.5.second()) when (val duplicateNicknameResult = nicknameUseCase.checkDuplicateNickname(nickname)) { is PokitResult.Success -> { _inputNicknameState.update { duplicateNicknameState -> @@ -195,6 +195,10 @@ class LoginViewModel @Inject constructor( return (this * 1000L) } + private fun Double.second(): Long { + return (this * 1000L).toLong() + } + private const val LIMIT_SELECTED_COUNT = 3 } } diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt index bf37d3eb..95697815 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt @@ -61,7 +61,7 @@ class SettingViewModel @Inject constructor( fun checkDuplicateNickname(nickname: String) { duplicateNicknameJob?.cancel() duplicateNicknameJob = viewModelScope.launch { - delay(1.second()) + delay(0.5.second()) when (val duplicateNicknameResult = nicknameUseCase.checkDuplicateNickname(nickname)) { is PokitResult.Success -> { _inputNicknameState.update { duplicateNicknameState -> @@ -115,6 +115,10 @@ class SettingViewModel @Inject constructor( private fun Int.second(): Long { return (this * 1000L) } + + private fun Double.second(): Long { + return (this * 1000L).toLong() + } } } From 5c78e73e846aea6b08f9701dc0794cca534c2aea Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Wed, 28 Aug 2024 23:22:20 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[chore]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EC=A7=84=ED=95=B4=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pokitmons/pokit/LoginViewModel.kt | 11 ++++++++++ .../pokit/model/DuplicateNicknameState.kt | 3 ++- .../pokit/nickname/InputNicknameScreen.kt | 20 +++++++++++++------ feature/login/src/main/res/values/strings.xml | 2 +- .../settings/src/main/res/values/strings.xml | 2 +- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt index 7786edf6..80becb4b 100644 --- a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt +++ b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt @@ -1,6 +1,7 @@ package pokitmons.pokit import android.content.Context +import android.util.Log import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateListOf @@ -43,6 +44,9 @@ class LoginViewModel @Inject constructor( } } } + + val nicknameRegex = Regex("^[a-zA-Z0-9가-힣]+$") + private var duplicateNicknameJob: Job? = null private val _isBottomSheetVisible: MutableState = mutableStateOf(false) @@ -147,6 +151,13 @@ class LoginViewModel @Inject constructor( } } + fun checkNicknameRegex(nickname: String): Boolean { + _inputNicknameState.update { duplicateNicknameState -> + duplicateNicknameState.copy(isRegex = nicknameRegex.matches(nickname)) + } + return nicknameRegex.matches(nickname) + } + fun setCategories() { val categoryNames: List = listOf( context.getString(R.string.sports_and_leisure), diff --git a/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt b/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt index 62086325..e14a75c9 100644 --- a/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt +++ b/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt @@ -2,5 +2,6 @@ package pokitmons.pokit.model data class DuplicateNicknameState( val nickname: String = "", - val isDuplicate: Boolean = true, + val isDuplicate: Boolean = false, + val isRegex: Boolean = false ) diff --git a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt index 89c40626..65fddeba 100644 --- a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt @@ -1,5 +1,6 @@ package pokitmons.pokit.nickname +import android.util.Log import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -65,17 +66,24 @@ fun InputNicknameScreen( inputText = inputNicknameState.nickname, maxLength = NICKNAME_MAX_LENGTH, sub = when { - inputNicknameState.nickname.length < NICKNAME_MAX_LENGTH -> stringResource(id = Login.string.input_restriction_message) - !inputNicknameState.isDuplicate -> stringResource(id = Login.string.nickname_already_in_use) - else -> stringResource(id = Login.string.input_max_length) + inputNicknameState.isDuplicate -> stringResource(id = Login.string.nickname_already_in_use) + inputNicknameState.isRegex -> stringResource(id = Login.string.input_restriction_message) + inputNicknameState.nickname.length < NICKNAME_MAX_LENGTH -> stringResource(id = Login.string.input_max_length) + else -> "" }, - isError = inputNicknameState.nickname.length > NICKNAME_MAX_LENGTH || !inputNicknameState.isDuplicate, + isError = inputNicknameState.nickname.length > NICKNAME_MAX_LENGTH || inputNicknameState.isDuplicate || inputNicknameState.isRegex, hintText = stringResource(id = Login.string.input_nickname_hint), onChangeText = { text -> + Log.d("!! : ", text) if (text.length <= NICKNAME_MAX_LENGTH) { viewModel.apply { inputText(text) - checkDuplicateNickname(text) + if (checkNicknameRegex(text)) { + Log.d("!! : ", "else call") + checkDuplicateNickname(text) + } else { + + } } } } @@ -89,7 +97,7 @@ fun InputNicknameScreen( text = stringResource(id = pokitmons.pokit.login.R.string.next), icon = null, size = PokitButtonSize.LARGE, - enable = !inputNicknameState.isDuplicate, + enable = !inputNicknameState.isDuplicate && inputNicknameState.isRegex && inputNicknameState.nickname.length < NICKNAME_MAX_LENGTH, onClick = { onNavigateToKeywordScreen() } ) } diff --git a/feature/login/src/main/res/values/strings.xml b/feature/login/src/main/res/values/strings.xml index 0012ad0b..a6459201 100644 --- a/feature/login/src/main/res/values/strings.xml +++ b/feature/login/src/main/res/values/strings.xml @@ -10,7 +10,7 @@ 내용을 입력해주세요. 한글, 영어, 숫자로만 입력이 가능합니다. 사용 중인 닉네임입니다. - 최대 20자까지 입력 가능합니다. + 최대 10자까지 입력 가능합니다. 어떤 분야에 관심이 있으세요? 최대 3개를 골라주시면,\n관련 콘텐츠를 추천해드릴게요! 스포츠/레저 diff --git a/feature/settings/src/main/res/values/strings.xml b/feature/settings/src/main/res/values/strings.xml index fd7fc692..af92a543 100644 --- a/feature/settings/src/main/res/values/strings.xml +++ b/feature/settings/src/main/res/values/strings.xml @@ -16,6 +16,6 @@ 저장 한글, 영어, 숫자로만 입력이 가능합니다. 사용 중인 닉네임입니다. - 최대 20자까지 입력 가능합니다. + 최대 10자까지 입력 가능합니다. 닉네임을 입력해주세요 \ No newline at end of file From 2ab2318ed042f4e53e382004b97bf83a5ad3a04c Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Wed, 28 Aug 2024 23:23:49 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[chore]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EC=A7=84=ED=95=B4=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt | 1 - .../main/java/pokitmons/pokit/model/DuplicateNicknameState.kt | 2 +- .../main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt | 1 - .../main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt index 80becb4b..e4168cde 100644 --- a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt +++ b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt @@ -1,7 +1,6 @@ package pokitmons.pokit import android.content.Context -import android.util.Log import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateListOf diff --git a/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt b/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt index e14a75c9..75029ff8 100644 --- a/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt +++ b/feature/login/src/main/java/pokitmons/pokit/model/DuplicateNicknameState.kt @@ -3,5 +3,5 @@ package pokitmons.pokit.model data class DuplicateNicknameState( val nickname: String = "", val isDuplicate: Boolean = false, - val isRegex: Boolean = false + val isRegex: Boolean = false, ) diff --git a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt index 65fddeba..ce096374 100644 --- a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt @@ -82,7 +82,6 @@ fun InputNicknameScreen( Log.d("!! : ", "else call") checkDuplicateNickname(text) } else { - } } } diff --git a/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt b/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt index 37aff9fb..99412fce 100644 --- a/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/success/SignUpSuccessScreen.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment