From ad0e6b67e7ee9c4f4bb7cab0beaf1744f2ea8244 Mon Sep 17 00:00:00 2001 From: HaeTi Date: Wed, 6 Dec 2023 17:09:19 +0900 Subject: [PATCH] =?UTF-8?q?#137=20/=20=EA=B5=AC=EB=8F=85=ED=95=B4=EC=84=9C?= =?UTF-8?q?=20=EC=A0=81=EC=A0=88=ED=95=9C=20=EC=95=A1=EC=85=98=20=EC=B7=A8?= =?UTF-8?q?=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/uni/presentation/home/HomeActivity.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/main/java/sopt/uni/presentation/home/HomeActivity.kt b/app/src/main/java/sopt/uni/presentation/home/HomeActivity.kt index a4085446..4f98f867 100644 --- a/app/src/main/java/sopt/uni/presentation/home/HomeActivity.kt +++ b/app/src/main/java/sopt/uni/presentation/home/HomeActivity.kt @@ -8,6 +8,7 @@ import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch import sopt.uni.R import sopt.uni.databinding.ActivityHomeBinding +import sopt.uni.presentation.common.content.ErrorCodeState import sopt.uni.presentation.common.content.UNDECIDED import sopt.uni.presentation.history.HistoryActivity import sopt.uni.presentation.mypage.MypageSettingActivity @@ -33,6 +34,7 @@ class HomeActivity : BindingActivity(R.layout.activity_home binding.viewModel = homeViewModel + collectErrorCode() moveToHistory() getRoundResult() moveToShortGame() @@ -122,4 +124,20 @@ class HomeActivity : BindingActivity(R.layout.activity_home showSnackbar(binding.root, getString(R.string.prepare_heart_function)) } } + + private fun collectErrorCode() { + lifecycleScope.launch { + homeViewModel.errorState.collect { + when (it) { + is ErrorCodeState.NoToken -> { + showToast("존재하지 않는 사용자입니다. 다시 로그인해주세요") + } + + else -> { + Timber.e("error: $it") + } + } + } + } + } }