diff --git a/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginEvent.kt b/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginEvent.kt
index 32786b1e..4e269a99 100644
--- a/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginEvent.kt
+++ b/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginEvent.kt
@@ -5,4 +5,5 @@ sealed interface LoginEvent {
data object RequireSignUp : LoginEvent
data object SignOutCancelled : LoginEvent
data object Invalid : LoginEvent
+ data object SignupFailed : LoginEvent
}
diff --git a/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginScreen.kt b/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginScreen.kt
index b3de9caa..77645681 100644
--- a/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginScreen.kt
+++ b/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginScreen.kt
@@ -39,6 +39,7 @@ import com.nexters.boolti.presentation.component.BTDialog
import com.nexters.boolti.presentation.component.BtCloseableAppBar
import com.nexters.boolti.presentation.component.KakaoLoginButton
import com.nexters.boolti.presentation.component.MainButton
+import com.nexters.boolti.presentation.screen.LocalSnackbarController
import com.nexters.boolti.presentation.theme.Grey30
import com.nexters.boolti.presentation.theme.marginHorizontal
@@ -49,10 +50,13 @@ fun LoginScreen(
modifier: Modifier = Modifier,
viewModel: LoginViewModel = hiltViewModel(),
) {
- val context = LocalContext.current
+ val snackbarController = LocalSnackbarController.current
+
val sheetState = rememberModalBottomSheetState()
var showSignOutCancelledDialog by remember { mutableStateOf(false) }
var isSheetOpen by rememberSaveable { mutableStateOf(false) }
+ val loginFailedMessage = stringResource(id = R.string.login_failed)
+ val signupFailedMessage = stringResource(id = R.string.signup_failed)
LaunchedEffect(Unit) {
viewModel.event.collect {
@@ -60,7 +64,8 @@ fun LoginScreen(
LoginEvent.Success -> onBackPressed()
LoginEvent.RequireSignUp -> isSheetOpen = true
LoginEvent.SignOutCancelled -> showSignOutCancelledDialog = true
- LoginEvent.Invalid -> Toast.makeText(context, "로그인 실패", Toast.LENGTH_SHORT).show()
+ LoginEvent.Invalid -> snackbarController.showMessage(loginFailedMessage)
+ LoginEvent.SignupFailed -> snackbarController.showMessage(signupFailedMessage)
}
}
}
diff --git a/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginViewModel.kt b/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginViewModel.kt
index da0ea68c..2ca42909 100644
--- a/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginViewModel.kt
+++ b/presentation/src/main/java/com/nexters/boolti/presentation/screen/login/LoginViewModel.kt
@@ -2,6 +2,7 @@ package com.nexters.boolti.presentation.screen.login
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
+import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.nexters.boolti.domain.repository.AuthRepository
import com.nexters.boolti.domain.request.LoginRequest
import com.nexters.boolti.domain.request.OauthType
@@ -39,7 +40,7 @@ class LoginViewModel @Inject constructor(
else -> event(LoginEvent.Success)
}
}.onFailure {
- Timber.d("login failed: $it")
+ FirebaseCrashlytics.getInstance().setCustomKey("LOGIN", "FAILED")
event(LoginEvent.Invalid)
}
}
@@ -78,7 +79,8 @@ class LoginViewModel @Inject constructor(
).onSuccess {
event(LoginEvent.Success)
}.onFailure {
- // TODO 예외 처리
+ FirebaseCrashlytics.getInstance().setCustomKey("SIGNUP", "FAILED")
+ event(LoginEvent.SignupFailed)
}
}
}
diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml
index e51397a8..024c02be 100644
--- a/presentation/src/main/res/values/strings.xml
+++ b/presentation/src/main/res/values/strings.xml
@@ -76,6 +76,8 @@
불티 유저
30일 내에 로그인하여\n계정 삭제가 취소되었어요.\n불티를 다시 찾아주셔서 감사해요!
식별 코드
+ 로그인 실패
+ 회원가입 실패
계정 삭제