From a419e86c676a40fc4daaa1fd4f7434dba553f693 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 18 Jul 2024 08:53:05 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#121]=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EC=A7=81=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onboarding/splash/NetworkChecker.kt | 20 ------------------- .../feature/onboarding/splash/SplashScreen.kt | 14 ------------- .../feature/onboarding/splash/SplashState.kt | 2 -- .../onboarding/splash/SplashViewModel.kt | 6 +----- 4 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/onboarding/splash/NetworkChecker.kt diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/NetworkChecker.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/NetworkChecker.kt deleted file mode 100644 index d8ef4937d..000000000 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/NetworkChecker.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.terning.feature.onboarding.splash - -import android.content.Context -import android.net.ConnectivityManager -import android.net.NetworkCapabilities - -object NetworkManager { - fun checkNetworkState(context: Context): Boolean { - val connectivityManager: ConnectivityManager = - context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - - val network = connectivityManager.activeNetwork ?: return false - val actNetwork = connectivityManager.getNetworkCapabilities(network) ?: return false - return when { - actNetwork.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true - actNetwork.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true - else -> false - } - } -} diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashScreen.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashScreen.kt index efd8c81fb..b839abaf5 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashScreen.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashScreen.kt @@ -39,8 +39,6 @@ fun SplashScreen( val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current - var showDialog = remember { mutableStateOf(false) } - LaunchedEffect(key1 = true) { viewModel.checkConnectedNetwork(context, lifecycleOwner) } @@ -55,7 +53,6 @@ fun SplashScreen( } is SplashState.AlertDialog -> { - showDialog.value = true } } } @@ -63,15 +60,4 @@ fun SplashScreen( TerningImage(painter = R.drawable.ic_splash, modifier = Modifier.fillMaxSize()) - if (showDialog.value) { - SplashDialog( - onDismissRequest = { - showDialog.value = false - }, - content = { - Text(text = "인터넷 연결 확인 바람") - - }, - ) - } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashState.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashState.kt index e1547ffcb..6f099a76a 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashState.kt @@ -1,7 +1,5 @@ package com.terning.feature.onboarding.splash -import androidx.appcompat.app.AlertDialog - sealed class SplashState { data object AlertDialog : SplashState() data class GetHasAccessToken(val hasAccessToken: Boolean) : SplashState() diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashViewModel.kt index 36546e2b4..8bf26c50a 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashViewModel.kt @@ -26,11 +26,7 @@ class SplashViewModel @Inject constructor( fun checkConnectedNetwork(context: Context, lifecycleOwner: LifecycleOwner) { viewModelScope.launch { - if (NetworkManager.checkNetworkState(context)) { - initSplash(lifecycleOwner) - } else { - _sideEffects.emit(SplashState.AlertDialog) - } + initSplash(lifecycleOwner) } }