Updated on 2026-08-14

This commit is contained in:
Tangem 2022-12-28 15:37:05 +03:00
parent e86de005bf
commit 74cf5ec26c
5 changed files with 19 additions and 4 deletions

View file

@ -84,6 +84,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
context = applicationContext,
tangemSdkManager = tangemSdkManager,
)
appStateHolder.userWalletsListManager = userWalletsListManager
userWalletsListManagerSafe = userWalletsListManager
lockUserWalletsTimer = LockUserWalletsTimer(owner = this)

View file

@ -128,7 +128,6 @@ class TapApplication : Application(), ImageLoaderFactory {
middleware = AppState.getMiddleware(),
state = AppState(),
)
appStateHolder.mainStore = store
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
@ -155,7 +154,9 @@ class TapApplication : Application(), ImageLoaderFactory {
context = this,
tangemTechService = store.state.domainNetworks.tangemTechService,
)
appStateHolder.mainStore = store
appStateHolder.userTokensRepository = userTokensRepository
appStateHolder.walletStoresManager = walletStoresManager
}
//todo refactor: move to datasource and provide via DI

View file

@ -5,6 +5,8 @@ import com.tangem.domain.common.ScanResponse
import com.tangem.tap.common.redux.AppState
import com.tangem.tap.domain.TangemSdkManager
import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.features.wallet.redux.WalletState
import org.rekotlin.Store
@ -19,6 +21,8 @@ class AppStateHolder {
var userTokensRepository: UserTokensRepository? = null
var mainStore: Store<AppState>? = null
var tangemSdkManager: TangemSdkManager? = null
var walletStoresManager: WalletStoresManager? = null
var userWalletsListManager: UserWalletsListManager? = null
fun getActualCard(): CardDTO? {
return scanResponse?.card

View file

@ -89,6 +89,8 @@ class DerivationManagerImpl(
}
scope.launch {
val selectedWallet = appStateHolder.userWalletsListManager?.selectedUserWalletSync
val result = appStateHolder.tangemSdkManager?.derivePublicKeys(
scanResponse.card.cardId,
derivations,
@ -108,6 +110,14 @@ class DerivationManagerImpl(
val updatedScanResponse = scanResponse.copy(
derivedKeys = updatedDerivedKeys,
)
if (selectedWallet != null) {
val userWallet = selectedWallet.copy(
scanResponse = updatedScanResponse,
)
appStateHolder.userWalletsListManager?.save(userWallet, canOverride = true)
appStateHolder.walletStoresManager?.fetch(userWallet, true)
}
appStateHolder.mainStore?.dispatchOnMain(GlobalAction.SaveScanResponse(updatedScanResponse))
delay(DELAY_SDK_DIALOG_CLOSE)
onSuccess(updatedScanResponse)
@ -115,8 +125,7 @@ class DerivationManagerImpl(
is CompletionResult.Failure -> {
appStateHolder.mainStore?.dispatchDebugErrorNotification(
TapError.CustomError(
"Error adding " +
"tokens",
"Error derivation",
),
)
}

View file

@ -60,7 +60,7 @@ class NetworkModule {
.build(),
),
)
.baseUrl(DEV_TANGEM_TECH_BASE_URL)
.baseUrl(PROD_TANGEM_TECH_BASE_URL)
.client(okHttpClient)
.build()
.create(ReferralApi::class.java)