Updated on 2026-08-14
This commit is contained in:
commit
b59ca3f8b8
22 changed files with 107 additions and 170 deletions
|
|
@ -84,6 +84,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
|
|||
context = applicationContext,
|
||||
tangemSdkManager = tangemSdkManager,
|
||||
)
|
||||
appStateHolder.userWalletsListManager = userWalletsListManager
|
||||
userWalletsListManagerSafe = userWalletsListManager
|
||||
lockUserWalletsTimer = LockUserWalletsTimer(owner = this)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@ val CardDTO.isMultiwalletAllowed: Boolean
|
|||
val CardDTO.isHdWalletAllowedByApp: Boolean
|
||||
get() = settings.isHDWalletAllowed && !isSaltPay
|
||||
|
||||
val CardDTO.isTangemWallet: Boolean
|
||||
get() = settings.isBackupAllowed
|
||||
&& settings.isHDWalletAllowed
|
||||
&& firmwareVersion >= FirmwareVersion.MultiWalletAvailable
|
||||
&& !isSaltPay
|
||||
|
||||
fun CardDTO.hasSignedHashes(): Boolean {
|
||||
return wallets.any { (it.totalSignedHashes ?: 0) > 0 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.tangem.tap.common.redux.global.GlobalAction
|
|||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
import com.tangem.tap.domain.extensions.isMultiwalletAllowed
|
||||
import com.tangem.tap.domain.extensions.isTangemWallet
|
||||
import com.tangem.tap.features.details.redux.DetailsAction
|
||||
import com.tangem.tap.features.details.redux.DetailsState
|
||||
import com.tangem.tap.features.disclaimer.redux.DisclaimerAction
|
||||
|
|
@ -39,6 +40,7 @@ class DetailsViewModel(private val store: Store<AppState>) {
|
|||
SettingsElement.AppSettings -> if (state.isBiometricsAvailable) it else null
|
||||
SettingsElement.AppCurrency -> if (state.scanResponse?.card?.isMultiwalletAllowed != true) it else null
|
||||
SettingsElement.TermsOfUse -> if (state.scanResponse?.card?.isStart2Coin == true) it else null
|
||||
// SettingsElement.ReferralProgram -> if (state.scanResponse?.card?.isTangemWallet == true) it else null
|
||||
else -> it
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue