Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-12 17:06:45 +08:00
parent 6bb5782d71
commit 5a42f1de5f
3 changed files with 15 additions and 4 deletions

View file

@ -156,11 +156,14 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
private val onActivityResultCallbacks = mutableListOf<OnActivityResultCallback>()
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
val splashScreen = installSplashScreen()
installAppTheme() // We need to call it before onCreate to prevent unnecessary activity recreation
super.onCreate(savedInstanceState)
splashScreen.setKeepOnScreenCondition { viewModel.isSplashScreenShown }
installActivityDependencies()
observeAppThemeModeUpdates()

View file

@ -65,7 +65,7 @@ import com.tangem.tap.proxy.redux.DaggerGraphState
import com.tangem.utils.coroutines.AppCoroutineDispatcherProvider
import com.tangem.wallet.BuildConfig
import dagger.hilt.EntryPoints
import kotlinx.coroutines.*
import kotlinx.coroutines.runBlocking
import org.rekotlin.Store
import timber.log.Timber
import com.tangem.tap.domain.walletconnect2.domain.WalletConnectRepository as WalletConnect2Repository
@ -198,8 +198,6 @@ abstract class TangemApplication : Application(), ImageLoaderFactory {
featureTogglesManager.init()
store.dispatch(GlobalAction.UpdateUserWalletsListManager(generalUserWalletsListManager))
blockchainSDKFactory.init()
}
val configLoader = FeaturesLocalLoader(assetReader, MoshiConverter.sdkMoshi, BuildConfig.ENVIRONMENT)

View file

@ -2,6 +2,7 @@ package com.tangem.tap.features.main
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.tangem.blockchainsdk.BlockchainSDKFactory
import com.tangem.core.navigation.AppScreen
import com.tangem.core.navigation.NavigationAction
import com.tangem.core.navigation.ReduxNavController
@ -28,6 +29,7 @@ internal class MainViewModel @Inject constructor(
private val fetchAppCurrenciesUseCase: FetchAppCurrenciesUseCase,
private val deleteDeprecatedLogsUseCase: DeleteDeprecatedLogsUseCase,
private val incrementAppLaunchCounterUseCase: IncrementAppLaunchCounterUseCase,
private val blockchainSDKFactory: BlockchainSDKFactory,
private val dispatchers: CoroutineDispatcherProvider,
getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase,
) : ViewModel(), MainIntents {
@ -41,7 +43,15 @@ internal class MainViewModel @Inject constructor(
val state: StateFlow<MainScreenState> = stateHolder.stateFlow
var isSplashScreenShown: Boolean = true
private set
init {
viewModelScope.launch(dispatchers.main) {
blockchainSDKFactory.init()
isSplashScreenShown = false
}
viewModelScope.launch(dispatchers.main) { incrementAppLaunchCounterUseCase() }
updateAppCurrencies()