diff --git a/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt b/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt index b6dc80106..07b4e5cab 100644 --- a/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt +++ b/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt @@ -24,6 +24,7 @@ import com.google.android.gms.auth.api.signin.GoogleSignInClient import com.google.android.gms.auth.api.signin.GoogleSignInOptions import com.google.android.gms.common.api.ApiException import com.google.android.gms.tasks.Task +import com.google.firebase.crashlytics.FirebaseCrashlytics import com.kakao.sdk.auth.model.OAuthToken import com.kakao.sdk.common.model.AuthError import com.kakao.sdk.common.model.AuthErrorCause @@ -155,15 +156,19 @@ fun TutorialPage() { val loginWithKakaoAccountCallback: (OAuthToken?, Throwable?) -> Unit = { token, error -> if (error != null) { if (error is ClientError && error.reason == ClientErrorCause.Cancelled) { + firebaseTest(error) context.toast(context.getString(R.string.sign_in_kakao_failed_cancelled)) } else if (error is AuthError && error.reason == AuthErrorCause.AccessDenied) { + firebaseTest(error) context.toast(context.getString(R.string.sign_in_kakao_failed_cancelled)) } else { + firebaseTest(error) context.toast(context.getString(R.string.sign_in_kakao_failed_unknown)) } } else if (token != null) { loginWithKaKaoAccessToken(token.accessToken) } else { + firebaseTest("KakaoAccount Login Failed Unknown") context.toast(context.getString(R.string.sign_in_kakao_failed_unknown)) } } @@ -173,21 +178,26 @@ fun TutorialPage() { UserApiClient.instance.loginWithKakaoTalk(context) { token, loginError -> if (loginError != null) { if (loginError is ClientError && loginError.reason == ClientErrorCause.Cancelled) { + firebaseTest(loginError) context.toast(context.getString(R.string.sign_in_kakao_failed_cancelled)) } else if (loginError is AuthError && loginError.reason == AuthErrorCause.AccessDenied) { + firebaseTest(loginError) context.toast(context.getString(R.string.sign_in_kakao_failed_cancelled)) } else { // 카카오계정으로 로그인 + firebaseTest(loginError) UserApiClient.instance.loginWithKakaoAccount(context = context, callback = loginWithKakaoAccountCallback) } } else if (token != null) { loginWithKaKaoAccessToken(token.accessToken) } else { + firebaseTest("KakaoTalk Login Unknown") context.toast(context.getString(R.string.sign_in_kakao_failed_unknown)) } } } else { // 카카오계정으로 로그인 + firebaseTest("KakaoTalk Login Failed") UserApiClient.instance.loginWithKakaoAccount(context = context, callback = loginWithKakaoAccountCallback) } } @@ -296,3 +306,22 @@ fun TutorialPage() { fun TutorialPagePreview() { TutorialPage() } + +fun firebaseTest(errorName: String) { + try { + throw Exception("snutt 3.7.1 firebase test Exception - $errorName") + } catch (e: Exception) { + FirebaseCrashlytics.getInstance().recordException( + Throwable(cause = e, message = errorName), + ) + } +} + +fun firebaseTest(error: Throwable?) { + if (error != null) { + FirebaseCrashlytics.getInstance().recordException( + error, + ) + } +} + diff --git a/version.properties b/version.properties index f009a6d8c..8c54eadd1 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -snuttVersionName=3.6.0 +snuttVersionName=3.7.1