From 1fbcccd83ae51df9883dc9a4f2fb7474e2a422f0 Mon Sep 17 00:00:00 2001 From: hyeumm <20221159@sungshin.ac.kr> Date: Thu, 18 Apr 2024 23:37:16 +0900 Subject: [PATCH] =?UTF-8?q?chore/#6:=20=ED=95=A8=EC=88=98=20=EC=95=84?= =?UTF-8?q?=EB=9E=98=EB=A1=9C=20=EB=B3=B4=EB=82=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sopt/now/compose/LoginActivity.kt | 41 +++++++++---------- .../com/sopt/now/compose/SignUpActivity.kt | 33 ++++++++------- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/com/sopt/now/compose/LoginActivity.kt b/app/src/main/java/com/sopt/now/compose/LoginActivity.kt index f53a443..8518beb 100644 --- a/app/src/main/java/com/sopt/now/compose/LoginActivity.kt +++ b/app/src/main/java/com/sopt/now/compose/LoginActivity.kt @@ -55,27 +55,6 @@ class LoginActivity : ComponentActivity() { } } -fun isLoginAvailable( - context: Context, - userId: String?, - userPw: String?, - userNick: String?, - id: String?, - pw: String? -) { - val message = when { - userId != id || userPw != pw -> R.string.login_error - else -> { - val intent = Intent(context, MainActivity::class.java) - intent.putExtra("userId", userId).putExtra("userPw", userPw) - .putExtra("userNick", userNick) - context.startActivity(intent) - R.string.login_success - } - } - Toast.makeText(context, message, Toast.LENGTH_SHORT).show() -} - @Composable fun LoginUI(userId: String?, userPw: String?, userNick: String?) { val context = LocalContext.current @@ -143,6 +122,26 @@ fun LoginUI(userId: String?, userPw: String?, userNick: String?) { } } +fun isLoginAvailable( + context: Context, + userId: String?, + userPw: String?, + userNick: String?, + id: String?, + pw: String? +) { + val message = when { + userId != id || userPw != pw -> R.string.login_error + else -> { + val intent = Intent(context, MainActivity::class.java) + intent.putExtra("userId", userId).putExtra("userPw", userPw) + .putExtra("userNick", userNick) + context.startActivity(intent) + R.string.login_success + } + } + Toast.makeText(context, message, Toast.LENGTH_SHORT).show() +} @Preview(showBackground = true) @Composable fun GreetingPreview2() { diff --git a/app/src/main/java/com/sopt/now/compose/SignUpActivity.kt b/app/src/main/java/com/sopt/now/compose/SignUpActivity.kt index 66ab74b..5aa839e 100644 --- a/app/src/main/java/com/sopt/now/compose/SignUpActivity.kt +++ b/app/src/main/java/com/sopt/now/compose/SignUpActivity.kt @@ -48,23 +48,6 @@ class SignUpActivity : ComponentActivity() { } } -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 - 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 -> { - val intent = Intent(context, LoginActivity::class.java) - intent.putExtra("userId", id).putExtra("userPw", pw).putExtra("userNick", nick) - context.startActivity(intent) - R.string.sign_up_success - } - } - Toast.makeText(context, message, Toast.LENGTH_SHORT).show() -} - @Composable fun SignUpUI() { val context = LocalContext.current @@ -142,6 +125,22 @@ 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 + 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 -> { + val intent = Intent(context, LoginActivity::class.java) + intent.putExtra("userId", id).putExtra("userPw", pw).putExtra("userNick", nick) + context.startActivity(intent) + R.string.sign_up_success + } + } + Toast.makeText(context, message, Toast.LENGTH_SHORT).show() +} @Preview(showBackground = true) @Composable