Updated on 2026-08-14

This commit is contained in:
Tangem 2023-03-31 13:10:01 +04:00
commit 90fd182e31
2 changed files with 3 additions and 11 deletions

View file

@ -1,6 +1,5 @@
package com.tangem.tap.features.wallet.ui
import android.content.Context
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
@ -10,7 +9,6 @@ import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.transition.TransitionInflater
@ -77,17 +75,10 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
}
}
override fun onAttach(context: Context) {
super.onAttach(context)
lifecycle.addObserver(viewModel)
lifecycleScope.launchWhenCreated {
viewModel.launch()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
activity?.lifecycle?.addObserver(viewModel)
activity?.onBackPressedDispatcher?.addCallback(
this,

View file

@ -57,6 +57,7 @@ internal class WalletViewModel @Inject constructor(
}
override fun onCreate(owner: LifecycleOwner) {
launch()
val scanResponse = store.state.globalState.scanResponse
if (scanResponse != null) {
val currency = ParamCardCurrencyConverter().convert(scanResponse.cardTypesResolver)
@ -77,7 +78,7 @@ internal class WalletViewModel @Inject constructor(
analyticsEventHandler.send(MainScreen.ScreenOpened())
}
fun launch() {
private fun launch() {
val manager = store.state.globalState.userWalletsListManager
if (manager != null) {
bootstrapSelectedWalletStoresChanges(manager)