Updated on 2026-08-14
This commit is contained in:
commit
ac0cf05b88
7 changed files with 36 additions and 20 deletions
|
|
@ -78,8 +78,8 @@ dependencies {
|
|||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
|
||||
implementation 'com.tangem:blockchain:develop-60'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-127'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-127'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-129'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-129'
|
||||
|
||||
// WebView
|
||||
implementation "androidx.browser:browser:1.3.0"
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ class CurrenciesRepository(val context: Application) {
|
|||
saveBlockchains(cardId, blockchains)
|
||||
}
|
||||
|
||||
fun removeCurrencies(cardId: String) {
|
||||
saveTokens(cardId, emptyList())
|
||||
saveBlockchains(cardId, emptyList())
|
||||
}
|
||||
|
||||
private fun loadSavedTokens(cardId: String): List<Token> {
|
||||
val json = try {
|
||||
context.readFileText(getFileNameForTokens(cardId))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.tangem.common.card.FirmwareVersion
|
|||
import com.tangem.common.core.TangemSdkError
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.operations.pins.CheckUserCodesResponse
|
||||
import com.tangem.tap.*
|
||||
import com.tangem.tap.common.analytics.Analytics
|
||||
import com.tangem.tap.common.analytics.AnalyticsParam
|
||||
import com.tangem.tap.common.extensions.dispatchNotification
|
||||
|
|
@ -19,10 +20,6 @@ import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsAction
|
|||
import com.tangem.tap.features.wallet.models.hasSendableAmountsOrPendingTransactions
|
||||
import com.tangem.tap.features.wallet.redux.WalletAction
|
||||
import com.tangem.tap.network.coinmarketcap.CoinMarketCapService
|
||||
import com.tangem.tap.preferencesStorage
|
||||
import com.tangem.tap.scope
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.tap.tangemSdkManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
|
@ -115,6 +112,7 @@ class DetailsMiddleware {
|
|||
withContext(Dispatchers.Main) {
|
||||
when (result) {
|
||||
is CompletionResult.Success -> {
|
||||
currenciesRepository.removeCurrencies(card.cardId)
|
||||
store.dispatch(NavigationAction.PopBackTo(AppScreen.Home))
|
||||
}
|
||||
is CompletionResult.Failure -> {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
BackupStep.ReenterAccessCode -> showReenterAccessCode(state)
|
||||
is BackupStep.WritePrimaryCard -> showWritePrimaryCard(state)
|
||||
is BackupStep.WriteBackupCard -> showWriteBackupCard(state)
|
||||
BackupStep.Finished -> showSuccess(state)
|
||||
BackupStep.Finished -> showSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,11 +194,10 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
|
||||
layout_buttons_add_cards.show()
|
||||
layout_buttons_common.hide()
|
||||
btn_add_card.text = getText(R.string.onboarding_button_add_backup_card)
|
||||
if (state.backupCardsNumber < state.maxBackupCards) {
|
||||
btn_add_card.text = getText(R.string.onboarding_button_add_backup_card)
|
||||
btn_add_card.setOnClickListener { store.dispatch(BackupAction.AddBackupCard) }
|
||||
} else {
|
||||
btn_add_card.text = "You hit the maximum"
|
||||
btn_add_card.isEnabled = false
|
||||
}
|
||||
|
||||
|
|
@ -331,20 +330,15 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
btn_main_action.setOnClickListener { store.dispatch(BackupAction.WriteBackupCard(cardNumber)) }
|
||||
}
|
||||
|
||||
private fun showSuccess(state: BackupState) {
|
||||
private fun showSuccess() {
|
||||
tv_header.text = getText(R.string.onboarding_done_header)
|
||||
val text = when (state.backupCardsNumber) {
|
||||
1 -> getText(R.string.onboarding_subtitle_success_backup_one_card)
|
||||
2 -> getText(R.string.onboarding_subtitle_success_backup)
|
||||
else -> getText(R.string.onboarding_subtitle_success_tangem_wallet_onboarding)
|
||||
}
|
||||
|
||||
tv_header.show()
|
||||
tv_body.show()
|
||||
view_pager_backup_info.hide()
|
||||
tab_layout_backup_info.hide()
|
||||
|
||||
tv_body.text = text
|
||||
tv_body.text = getText(R.string.onboarding_subtitle_success_tangem_wallet_onboarding)
|
||||
btn_main_action.text = getText(R.string.onboarding_button_continue_wallet)
|
||||
btn_alternative_action.hide()
|
||||
btn_main_action.setOnClickListener {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ sealed class TokensAction : Action {
|
|||
data class SetAddedCurrencies(val wallets: List<WalletData>) : TokensAction()
|
||||
|
||||
data class ToggleShowTokensForBlockchain(val isShown: Boolean, val blockchain: Blockchain) : TokensAction()
|
||||
object OpenAllTokens : TokensAction()
|
||||
|
||||
data class SaveChanges(val addedItems: List<CurrencyListItem>) : TokensAction()
|
||||
}
|
||||
|
|
@ -37,6 +37,11 @@ private fun internalReduce(action: Action, state: AppState): TokensState {
|
|||
tokensState.copy(shownCurrencies = shownCurrencies)
|
||||
}
|
||||
}
|
||||
is TokensAction.OpenAllTokens -> {
|
||||
val shownCurrencies = tokensState.currencies
|
||||
shownCurrencies.forEach { if (it is CurrencyListItem.TitleListItem) it.isContentShown = true}
|
||||
tokensState.copy(shownCurrencies = tokensState.currencies)
|
||||
}
|
||||
else -> tokensState
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ class CurrenciesAdapter : ListAdapter<CurrencyListItem, RecyclerView.ViewHolder>
|
|||
val list = mutableListOf<CurrencyListItem>()
|
||||
|
||||
if (!query.isNullOrEmpty()) {
|
||||
store.dispatch(TokensAction.OpenAllTokens)
|
||||
val queryNormalized = query.toString().toLowerCase(Locale.US)
|
||||
list.addAll(
|
||||
unfilteredList.filter { element ->
|
||||
|
|
@ -214,18 +215,30 @@ class CurrenciesAdapter : ListAdapter<CurrencyListItem, RecyclerView.ViewHolder>
|
|||
|
||||
if (title.blockchain != null) {
|
||||
view.cl_subtitle_container.setOnClickListener {
|
||||
val rotation = if (title.isContentShown) -90f else 0f
|
||||
val rotation = if (title.isContentShown) -90f else 90f
|
||||
store.dispatch(TokensAction.ToggleShowTokensForBlockchain(
|
||||
title.isContentShown, title.blockchain
|
||||
))
|
||||
view.iv_toggle_sublist_visibility.animate().rotation(rotation)
|
||||
view.iv_toggle_sublist_visibility.animate().rotation(rotation).withEndAction {
|
||||
showArrow(view, title.isContentShown)
|
||||
}
|
||||
}
|
||||
view.iv_toggle_sublist_visibility.show()
|
||||
view.iv_toggle_sublist_visibility.setImageResource(R.drawable.ic_arrow_angle_down)
|
||||
showArrow(view, title.isContentShown)
|
||||
} else {
|
||||
view.iv_toggle_sublist_visibility.hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showArrow(view: View, isContentShown: Boolean) {
|
||||
view.iv_toggle_sublist_visibility.show()
|
||||
val drawable = if (isContentShown) {
|
||||
R.drawable.ic_arrow_angle_down
|
||||
} else {
|
||||
R.drawable.ic_arrow_angle_right
|
||||
}
|
||||
view.iv_toggle_sublist_visibility.setImageResource(drawable)
|
||||
view.iv_toggle_sublist_visibility.rotation = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue