@@ -5,19 +5,14 @@ import androidx.activity.ComponentActivity
55import androidx.activity.compose.setContent
66import androidx.activity.enableEdgeToEdge
77import androidx.compose.runtime.CompositionLocalProvider
8+ import androidx.navigation.compose.rememberNavController
89import com.lanpet.core.auth.AuthManager
910import com.lanpet.core.auth.LocalAuthManager
1011import com.lanpet.core.designsystem.theme.LanPetAppTheme
1112import com.lanpet.core.manager.CoilManager
1213import com.lanpet.core.manager.LocalCoilManager
1314import com.lanpet.core.navigation.AppNavigation
14- import com.lanpet.domain.model.SocialAuthToken
15- import com.lanpet.domain.repository.AuthRepository
16- import com.lanpet.domain.repository.LandingRepository
17- import com.lanpet.feature.auth.navigation.Login
18- import com.lanpet.feature.landing.navigation.Landing
1915import dagger.hilt.android.AndroidEntryPoint
20- import kotlinx.coroutines.runBlocking
2116import timber.log.Timber
2217import javax.inject.Inject
2318
@@ -29,55 +24,30 @@ class MainActivity : ComponentActivity() {
2924 @Inject
3025 lateinit var coilManager: CoilManager
3126
32- @Inject
33- lateinit var landingRepository: LandingRepository
34-
35- @Inject
36- lateinit var authRepository: AuthRepository
37-
3827 override fun onCreate (savedInstanceState : Bundle ? ) {
28+ Timber .e(" MainActivity onCreate" )
29+ // 사용자가 설정한 SplashScreen 스타일을 기본으로 사용
30+ // val splashScreen = installSplashScreen()
31+
3932 super .onCreate(savedInstanceState)
4033
4134 enableEdgeToEdge()
4235 setContent {
43- // Start destination
44- val startDestination =
45- runBlocking {
46- return @runBlocking if (landingRepository.getShouldShowLanding()) {
47- Landing
48- } else {
49- Login
50- }
51- }
52-
53- // Auto login
54- runBlocking {
55- val token = authRepository.getAuthTokenFromDataStore()
56-
57- Timber .i(" token: $token " )
58-
59- if (token != null ) {
60- authManager.handleAuthentication(
61- SocialAuthToken (
62- socialAuthType = token.socialAuthType,
63- accessToken = token.accessToken,
64- refreshToken = token.refreshToken,
65- expiresIn = token.expiresIn,
66- expireDateTime = token.expireDateTime,
67- ),
68- )
69- }
70- }
71-
36+ val navController = rememberNavController()
7237 CompositionLocalProvider (LocalAuthManager provides authManager) {
7338 CompositionLocalProvider (LocalCoilManager provides coilManager) {
7439 LanPetAppTheme {
7540 AppNavigation (
76- startDestination = startDestination ,
41+ navController = navController ,
7742 )
7843 }
7944 }
8045 }
8146 }
8247 }
48+
49+ override fun onDestroy () {
50+ Timber .e(" MainActivity onDestroy" )
51+ super .onDestroy()
52+ }
8353}
0 commit comments