Updated on 2026-08-14
This commit is contained in:
parent
5f95ba532e
commit
4942718cc9
22 changed files with 322 additions and 344 deletions
|
|
@ -14,7 +14,6 @@ import com.tangem.tap.common.extensions.dispatchOnMain
|
|||
import com.tangem.tap.common.extensions.dispatchWithMain
|
||||
import com.tangem.tap.common.redux.AppDialog
|
||||
import com.tangem.tap.common.redux.AppState
|
||||
import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager
|
||||
import com.tangem.tap.features.send.redux.SendAction
|
||||
import com.tangem.tap.features.wallet.redux.WalletAction
|
||||
import com.tangem.tap.network.exchangeServices.BuyExchangeService
|
||||
|
|
@ -84,10 +83,10 @@ private fun handleAction(action: Action, appState: () -> AppState?, dispatch: Di
|
|||
is GlobalAction.HideWarningMessage -> {
|
||||
store.state.globalState.warningManager?.let {
|
||||
if (it.hideWarning(action.warning)) {
|
||||
if (WarningMessagesManager.isAlreadySignedHashesWarning(action.warning)) {
|
||||
// TODO: No appropriate warningMessage identification. Make it better later
|
||||
store.dispatch(WalletAction.Warnings.CheckHashesCount.SaveCardId)
|
||||
}
|
||||
// if (WarningMessagesManager.isAlreadySignedHashesWarning()) {
|
||||
// // TODO: No appropriate warningMessage identification. Make it better later
|
||||
// store.dispatch(WalletAction.Warnings.CheckHashesCount.SaveCardId)
|
||||
// }
|
||||
|
||||
store.dispatch(WalletAction.Warnings.Update)
|
||||
store.dispatch(SendAction.Warnings.Update)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import java.util.concurrent.CopyOnWriteArrayList
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
class WarningMessagesManager {
|
||||
|
||||
private val warningsList = CopyOnWriteArrayList<WarningMessage>()
|
||||
|
|
@ -73,7 +75,7 @@ class WarningMessagesManager {
|
|||
location = listOf(WarningMessage.Location.MainScreen),
|
||||
blockchains = null,
|
||||
titleResId = R.string.common_warning,
|
||||
messageResId = R.string.alert_developer_card,
|
||||
// messageResId = R.string.alert_developer_card,
|
||||
origin = WarningMessage.Origin.Local,
|
||||
)
|
||||
|
||||
|
|
@ -85,7 +87,7 @@ class WarningMessagesManager {
|
|||
location = listOf(WarningMessage.Location.MainScreen),
|
||||
blockchains = null,
|
||||
titleResId = R.string.common_warning,
|
||||
messageResId = R.string.alert_card_signed_transactions,
|
||||
// messageResId = R.string.alert_card_signed_transactions,
|
||||
origin = WarningMessage.Origin.Local,
|
||||
)
|
||||
|
||||
|
|
@ -96,8 +98,8 @@ class WarningMessagesManager {
|
|||
priority = WarningMessage.Priority.Info,
|
||||
location = listOf(WarningMessage.Location.MainScreen),
|
||||
blockchains = null,
|
||||
titleResId = R.string.warning_important_security_info,
|
||||
messageResId = R.string.warning_signed_tx_previously,
|
||||
// titleResId = R.string.warning_important_security_info,
|
||||
// messageResId = R.string.warning_signed_tx_previously,
|
||||
origin = WarningMessage.Origin.Local,
|
||||
buttonTextId = R.string.warning_button_learn_more,
|
||||
titleFormatArg = "\u26A0",
|
||||
|
|
@ -147,7 +149,7 @@ class WarningMessagesManager {
|
|||
location = listOf(WarningMessage.Location.MainScreen),
|
||||
blockchains = null,
|
||||
titleResId = R.string.common_warning,
|
||||
messageResId = R.string.alert_demo_message,
|
||||
// messageResId = R.string.alert_demo_message,
|
||||
origin = WarningMessage.Origin.Local,
|
||||
)
|
||||
|
||||
|
|
@ -160,14 +162,14 @@ class WarningMessagesManager {
|
|||
location = listOf(WarningMessage.Location.MainScreen),
|
||||
blockchains = null,
|
||||
titleResId = R.string.common_warning,
|
||||
messageResId = R.string.warning_low_signatures_format,
|
||||
// messageResId = R.string.warning_low_signatures_format,
|
||||
origin = WarningMessage.Origin.Local,
|
||||
messageFormatArg = remainingSignatures.toString(),
|
||||
)
|
||||
}
|
||||
|
||||
fun isAlreadySignedHashesWarning(warning: WarningMessage): Boolean {
|
||||
return warning.messageResId == R.string.alert_card_signed_transactions
|
||||
}
|
||||
// fun isAlreadySignedHashesWarning(warning: WarningMessage): Boolean {
|
||||
// return warning.messageResId == R.string.alert_card_signed_transactions
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ private fun DifferentAddressesWarning() {
|
|||
),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
val text = stringResource(id = R.string.alert_manage_tokens_addresses_message)
|
||||
val text = stringResource(id = R.string.warning_manage_tokens_legacy_derivation_message)
|
||||
Text(
|
||||
text = text,
|
||||
modifier = Modifier.padding(
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@ import com.tangem.tap.preferencesStorage
|
|||
import com.tangem.tap.proxy.redux.DaggerGraphState
|
||||
import com.tangem.tap.scope
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
class WarningsMiddleware {
|
||||
fun handle(action: WalletAction.Warnings, globalState: GlobalState?) {
|
||||
when (action) {
|
||||
|
|
@ -49,7 +50,7 @@ class WarningsMiddleware {
|
|||
if (action.remainingSignatures != null &&
|
||||
action.remainingSignatures <= WarningMessagesManager.REMAINING_SIGNATURES_WARNING
|
||||
) {
|
||||
store.state.globalState.warningManager?.removeWarnings(R.string.warning_low_signatures_format)
|
||||
// store.state.globalState.warningManager?.removeWarnings(R.string.warning_low_signatures_format)
|
||||
addWarningMessage(
|
||||
warning = WarningMessagesManager.remainingSignaturesNotEnough(action.remainingSignatures),
|
||||
autoUpdate = true,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.tangem.tap.store
|
|||
import com.tangem.wallet.R
|
||||
import com.tangem.wallet.databinding.CardBalanceBinding
|
||||
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
class BalanceWidget(
|
||||
private val binding: CardBalanceBinding,
|
||||
private val fragment: WalletFragment,
|
||||
|
|
@ -46,12 +48,11 @@ class BalanceWidget(
|
|||
val statusView = if (blockchainWalletData.status is WalletDataModel.VerifiedOnline) {
|
||||
R.id.tv_status_verified
|
||||
} else {
|
||||
tvStatusError.text =
|
||||
fragment.getText(R.string.wallet_balance_tx_in_progress)
|
||||
// tvStatusError.text = fragment.getText(R.string.wallet_balance_tx_in_progress)
|
||||
R.id.group_error
|
||||
}
|
||||
showStatus(statusView)
|
||||
tvStatusErrorMessage.hide()
|
||||
// tvStatusErrorMessage.hide()
|
||||
|
||||
if (tokenWalletData != null) {
|
||||
showBalanceWithToken(blockchainWalletData, true)
|
||||
|
|
@ -70,12 +71,12 @@ class BalanceWidget(
|
|||
tvCurrency.text = currency
|
||||
tvAmount.text = ""
|
||||
|
||||
tvStatusErrorMessage.text = blockchainWalletData.status.errorMessage
|
||||
tvStatusError.text =
|
||||
fragment.getString(R.string.wallet_balance_blockchain_unreachable)
|
||||
// tvStatusErrorMessage.text = blockchainWalletData.status.errorMessage
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
// tvStatusError.text = fragment.getString(R.string.wallet_balance_blockchain_unreachable)
|
||||
|
||||
showStatus(R.id.group_error)
|
||||
tvStatusErrorMessage.show(!blockchainWalletData.status.errorMessage.isNullOrBlank())
|
||||
// tvStatusErrorMessage.show(!blockchainWalletData.status.errorMessage.isNullOrBlank())
|
||||
}
|
||||
is WalletDataModel.NoAccount -> with(binding.lBalanceError) {
|
||||
binding.lBalance.root.hide()
|
||||
|
|
@ -93,7 +94,7 @@ class BalanceWidget(
|
|||
}
|
||||
|
||||
private fun showStatus(@IdRes viewRes: Int) = with(binding.lBalance) {
|
||||
groupError.show(viewRes == R.id.group_error)
|
||||
// groupError.show(viewRes == R.id.group_error)
|
||||
tvStatusLoading.show(viewRes == R.id.tv_status_loading)
|
||||
tvStatusVerified.show(viewRes == R.id.tv_status_verified)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ import javax.inject.Inject
|
|||
/**
|
||||
* Wallet details fragment - use only for MultiWallet
|
||||
*/
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Suppress("LargeClass", "MagicNumber")
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
@AndroidEntryPoint
|
||||
class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), SafeStoreSubscriber<WalletState> {
|
||||
|
||||
|
|
@ -436,10 +438,11 @@ class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), SafeSt
|
|||
lBalance.root.show()
|
||||
lBalance.groupBalance.hide()
|
||||
lBalance.tvError.show()
|
||||
lBalance.tvError.setWarningStatus(
|
||||
R.string.wallet_balance_blockchain_unreachable,
|
||||
status.errorMessage,
|
||||
)
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
// lBalance.tvError.setWarningStatus(
|
||||
// R.string.wallet_balance_blockchain_unreachable,
|
||||
// status.errorMessage,
|
||||
// )
|
||||
}
|
||||
is WalletDataModel.NoAccount -> {
|
||||
lBalance.root.hide()
|
||||
|
|
|
|||
|
|
@ -9,43 +9,45 @@ import com.tangem.wallet.R
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
class WalletWarningConverter(
|
||||
private val context: Context,
|
||||
) : ModuleMessageConverter<WalletWarning, WalletWarningDescription> {
|
||||
|
||||
override fun convert(message: WalletWarning): WalletWarningDescription {
|
||||
val warningMessage = when (message) {
|
||||
is WalletWarning.ExistentialDeposit -> {
|
||||
context.getString(
|
||||
R.string.warning_existential_deposit_message,
|
||||
message.currencyName,
|
||||
message.edStringValueWithSymbol,
|
||||
)
|
||||
}
|
||||
is WalletWarning.BalanceNotEnoughForFee -> {
|
||||
context.getString(
|
||||
R.string.token_details_send_blocked_fee_format,
|
||||
message.currencyName,
|
||||
message.blockchainFullName,
|
||||
message.currencyName,
|
||||
message.blockchainFullName,
|
||||
message.blockchainSymbol,
|
||||
)
|
||||
}
|
||||
is WalletWarning.TransactionInProgress -> {
|
||||
context.getString(
|
||||
R.string.token_details_send_blocked_tx_format,
|
||||
message.currencyName,
|
||||
)
|
||||
}
|
||||
is WalletWarning.Rent -> {
|
||||
context.getString(
|
||||
R.string.solana_rent_warning,
|
||||
message.walletRent.rent,
|
||||
message.walletRent.exemptionAmount,
|
||||
)
|
||||
}
|
||||
}
|
||||
return WalletWarningDescription(context.getString(R.string.common_warning), warningMessage)
|
||||
// val warningMessage = when (message) {
|
||||
// is WalletWarning.ExistentialDeposit -> {
|
||||
// context.getString(
|
||||
// R.string.warning_existential_deposit_message,
|
||||
// message.currencyName,
|
||||
// message.edStringValueWithSymbol,
|
||||
// )
|
||||
// }
|
||||
// is WalletWarning.BalanceNotEnoughForFee -> {
|
||||
// context.getString(
|
||||
// R.string.token_details_send_blocked_fee_format,
|
||||
// message.currencyName,
|
||||
// message.blockchainFullName,
|
||||
// message.currencyName,
|
||||
// message.blockchainFullName,
|
||||
// message.blockchainSymbol,
|
||||
// )
|
||||
// }
|
||||
// is WalletWarning.TransactionInProgress -> {
|
||||
// context.getString(
|
||||
// R.string.token_details_send_blocked_tx_format,
|
||||
// message.currencyName,
|
||||
// )
|
||||
// }
|
||||
// is WalletWarning.Rent -> {
|
||||
// context.getString(
|
||||
// R.string.solana_rent_warning,
|
||||
// message.walletRent.rent,
|
||||
// message.walletRent.exemptionAmount,
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
return WalletWarningDescription(context.getString(R.string.common_warning), "")
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,8 @@ import com.tangem.tap.store
|
|||
import com.tangem.wallet.R
|
||||
import com.tangem.wallet.databinding.ItemCurrencyWalletBinding
|
||||
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
class WalletAdapter : ListAdapter<WalletDataModel, WalletAdapter.WalletsViewHolder>(DiffUtilCallback) {
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
|
|
@ -59,7 +61,8 @@ class WalletAdapter : ListAdapter<WalletDataModel, WalletAdapter.WalletsViewHold
|
|||
root.getString(R.string.wallet_balance_tx_in_progress)
|
||||
}
|
||||
is WalletDataModel.Unreachable -> {
|
||||
root.getString(R.string.wallet_balance_blockchain_unreachable)
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
// root.getString(R.string.wallet_balance_blockchain_unreachable)
|
||||
}
|
||||
is WalletDataModel.MissedDerivation -> {
|
||||
root.getString(R.string.wallet_balance_missing_derivation)
|
||||
|
|
@ -86,7 +89,7 @@ class WalletAdapter : ListAdapter<WalletDataModel, WalletAdapter.WalletsViewHold
|
|||
lContent.tvAmount.text = wallet.getFormattedCryptoAmount()
|
||||
|
||||
lContent.tvStatus.isVisible = statusMessage != null
|
||||
lContent.tvStatus.text = statusMessage
|
||||
// lContent.tvStatus.text = statusMessage
|
||||
|
||||
lContent.tvExchangeRate.isVisible = statusMessage == null
|
||||
lContent.tvExchangeRate.text = wallet.getFormattedFiatRate(
|
||||
|
|
|
|||
|
|
@ -10,12 +10,7 @@ import com.google.android.play.core.review.ReviewManagerFactory
|
|||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.tap.common.analytics.events.AnalyticsParam
|
||||
import com.tangem.tap.common.analytics.events.MainScreen
|
||||
import com.tangem.tap.common.extensions.getActivity
|
||||
import com.tangem.tap.common.extensions.getColor
|
||||
import com.tangem.tap.common.extensions.getString
|
||||
import com.tangem.tap.common.extensions.hide
|
||||
import com.tangem.tap.common.extensions.show
|
||||
import com.tangem.tap.common.feedback.RateCanBeBetterEmail
|
||||
import com.tangem.tap.common.extensions.*
|
||||
import com.tangem.tap.common.redux.global.GlobalAction
|
||||
import com.tangem.tap.domain.configurable.warningMessage.WarningMessage
|
||||
import com.tangem.tap.features.wallet.redux.WalletAction
|
||||
|
|
@ -24,6 +19,8 @@ import com.tangem.wallet.R
|
|||
import com.tangem.wallet.databinding.LayoutWarningCardActionBinding
|
||||
import timber.log.Timber
|
||||
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
class WarningMessagesAdapter : ListAdapter<WarningMessage, WarningMessageVH>(DiffUtilCallback) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WarningMessageVH {
|
||||
|
|
@ -94,11 +91,11 @@ class WarningMessageVH(val binding: LayoutWarningCardActionBinding) : RecyclerVi
|
|||
|
||||
val buttonAction =
|
||||
when (warning.titleResId) {
|
||||
R.string.warning_important_security_info -> {
|
||||
View.OnClickListener {
|
||||
store.dispatch(WalletAction.DialogAction.SignedHashesMultiWalletDialog)
|
||||
}
|
||||
}
|
||||
// R.string.warning_important_security_info -> {
|
||||
// View.OnClickListener {
|
||||
// store.dispatch(WalletAction.DialogAction.SignedHashesMultiWalletDialog)
|
||||
// }
|
||||
// }
|
||||
else -> {
|
||||
View.OnClickListener {
|
||||
store.dispatch(GlobalAction.HideWarningMessage(warning))
|
||||
|
|
@ -120,12 +117,12 @@ class WarningMessageVH(val binding: LayoutWarningCardActionBinding) : RecyclerVi
|
|||
store.dispatch(GlobalAction.HideWarningMessage(warning))
|
||||
store.dispatch(WalletAction.Warnings.AppRating.RemindLater)
|
||||
}
|
||||
binding.btnCanBeBetter.setOnClickListener {
|
||||
Analytics.send(MainScreen.NoticeRateAppButton(AnalyticsParam.RateApp.Disliked))
|
||||
store.dispatch(WalletAction.Warnings.AppRating.SetNeverToShow)
|
||||
store.dispatch(GlobalAction.HideWarningMessage(warning))
|
||||
store.dispatch(GlobalAction.SendEmail(RateCanBeBetterEmail()))
|
||||
}
|
||||
// binding.btnCanBeBetter.setOnClickListener {
|
||||
// Analytics.send(MainScreen.NoticeRateAppButton(AnalyticsParam.RateApp.Disliked))
|
||||
// store.dispatch(WalletAction.Warnings.AppRating.SetNeverToShow)
|
||||
// store.dispatch(GlobalAction.HideWarningMessage(warning))
|
||||
// store.dispatch(GlobalAction.SendEmail(RateCanBeBetterEmail()))
|
||||
// }
|
||||
binding.btnReallyCool.setOnClickListener {
|
||||
val activity = binding.root.context.getActivity() ?: return@setOnClickListener
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,13 @@ import com.tangem.tap.features.wallet.redux.WalletAction
|
|||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
|
||||
// TODO: Delete with WalletFeatureToggles
|
||||
@Deprecated(message = "Used only in old wallet screen")
|
||||
object SignedHashesWarningDialog {
|
||||
fun create(context: Context): AlertDialog {
|
||||
return MaterialAlertDialogBuilder(context, R.style.CustomMaterialDialog).apply {
|
||||
setTitle(context.getString(R.string.warning_important_security_info, "\u26A0"))
|
||||
setMessage(R.string.alert_signed_hashes_message)
|
||||
// setTitle(context.getString(R.string.warning_important_security_info, "\u26A0"))
|
||||
// setMessage(R.string.alert_signed_hashes_message)
|
||||
setPositiveButton(R.string.common_understand) { _, _ ->
|
||||
store.dispatch(WalletAction.Warnings.CheckHashesCount.SaveCardId)
|
||||
store.dispatch(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue