Skip to content

Commit

Permalink
mod/#6: PR 적용 - companion object
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeeum committed Apr 26, 2024
1 parent 04e32f5 commit 13839c3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/src/main/java/com/sopt/now/compose/SignUpActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.sopt.now.compose.SignUpActivity.Companion.MAX_ID_LENGTH
import com.sopt.now.compose.SignUpActivity.Companion.MAX_PW_LENGTH
import com.sopt.now.compose.SignUpActivity.Companion.MIN_ID_LENGTH
import com.sopt.now.compose.SignUpActivity.Companion.MIN_PW_LENGTH
import com.sopt.now.compose.ui.theme.NOWSOPTAndroidTheme

class SignUpActivity : ComponentActivity() {
Expand All @@ -46,6 +50,12 @@ class SignUpActivity : ComponentActivity() {
}
}
}
companion object {
const val MIN_ID_LENGTH = 6
const val MAX_ID_LENGTH = 10
const val MIN_PW_LENGTH = 8
const val MAX_PW_LENGTH = 12
}
}

@Composable
Expand Down Expand Up @@ -128,8 +138,8 @@ fun SignUpUI() {
fun isSignUpAvailable(context: Context,id: String,pw: String,nick: String,etc: String) {
val message = when {
id.isEmpty() || pw.isEmpty() || nick.isEmpty() || etc.isEmpty() -> R.string.sign_up_blank_error
id.length !in 6..10 -> R.string.sign_up_id_error
pw.length !in 8..12 -> R.string.sign_up_pw_error
id.length !in MIN_ID_LENGTH..MAX_ID_LENGTH -> R.string.sign_up_id_error
pw.length !in MIN_PW_LENGTH..MAX_PW_LENGTH -> R.string.sign_up_pw_error
nick.isBlank() || nick.length != nick.trim().length -> R.string.sign_up_nick_error
etc.length !in 1..Int.MAX_VALUE -> R.string.sign_up_etc_error
else -> {
Expand Down

0 comments on commit 13839c3

Please sign in to comment.