Updated on 2026-08-14
This commit is contained in:
parent
90e81f1868
commit
4d9d185fc2
16 changed files with 230 additions and 35 deletions
|
|
@ -114,6 +114,10 @@ sealed class WalletScreenAnalyticsEvent {
|
|||
|
||||
data object BackupError : MainScreen(event = "Notice - Backup Error")
|
||||
|
||||
data object NotePromo : MainScreen(event = "Notice - Note Promo")
|
||||
|
||||
data object NotePromoButton : MainScreen(event = "Note Promo Button")
|
||||
|
||||
data object UnlockAllWithBiometrics : MainScreen(event = "Button - Unlock All With Biometrics")
|
||||
|
||||
data object UnlockWithCardScan : MainScreen(event = "Button - Unlock With Card Scan")
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ internal class WalletWarningsAnalyticsSender @Inject constructor(
|
|||
return warnings.mapNotNullTo(mutableSetOf(), ::getEvent)
|
||||
}
|
||||
|
||||
@Suppress("CyclomaticComplexMethod")
|
||||
private fun getEvent(warning: WalletNotification): AnalyticsEvent? {
|
||||
return when (warning) {
|
||||
is WalletNotification.Critical.DevCard -> MainScreen.DevelopmentCard
|
||||
|
|
@ -46,6 +47,7 @@ internal class WalletWarningsAnalyticsSender @Inject constructor(
|
|||
is WalletNotification.Informational.MissingAddresses -> MainScreen.MissingAddresses
|
||||
is WalletNotification.RateApp -> MainScreen.HowDoYouLikeTangem
|
||||
is WalletNotification.Critical.BackupError -> MainScreen.BackupError
|
||||
is WalletNotification.NoteMigration -> MainScreen.NotePromo
|
||||
is WalletNotification.SwapPromo -> TokenSwapPromoAnalyticsEvent.NoticePromotionBanner(
|
||||
source = AnalyticsParam.ScreensSources.Main,
|
||||
programName = TokenSwapPromoAnalyticsEvent.ProgramName.OKX,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ internal class GetSingleWalletWarningsFactory @Inject constructor(
|
|||
buildList {
|
||||
addCriticalNotifications(cardTypesResolver)
|
||||
|
||||
addInformationalNotifications(cardTypesResolver)
|
||||
addInformationalNotifications(cardTypesResolver, clickIntents)
|
||||
|
||||
addWarningNotifications(
|
||||
userWallet,
|
||||
|
|
@ -75,7 +75,17 @@ internal class GetSingleWalletWarningsFactory @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun MutableList<WalletNotification>.addInformationalNotifications(cardTypesResolver: CardTypesResolver) {
|
||||
private fun MutableList<WalletNotification>.addInformationalNotifications(
|
||||
cardTypesResolver: CardTypesResolver,
|
||||
clickIntents: WalletClickIntents,
|
||||
) {
|
||||
addIf(
|
||||
element = WalletNotification.NoteMigration(
|
||||
onClick = { clickIntents.onNoteMigrationButtonClick(NOTE_MIGRATION_URL) },
|
||||
),
|
||||
condition = cardTypesResolver.isTangemNote(),
|
||||
)
|
||||
|
||||
addIf(
|
||||
element = WalletNotification.Informational.DemoCard,
|
||||
condition = isDemoCardUseCase(cardId = cardTypesResolver.getCardId()),
|
||||
|
|
@ -160,13 +170,17 @@ internal class GetSingleWalletWarningsFactory @Inject constructor(
|
|||
private fun MutableList<WalletNotification>.addIf(element: WalletNotification, condition: Boolean) {
|
||||
if (condition) {
|
||||
add(element = element)
|
||||
if (element is WalletNotification.Critical || element is WalletNotification.Warning) {
|
||||
if (element is WalletNotification.Critical ||
|
||||
element is WalletNotification.Warning ||
|
||||
element is WalletNotification.NoteMigration
|
||||
) {
|
||||
readyForRateAppNotification = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val NOTE_MIGRATION_URL = "https://tangem.com/en/?promocode=Note10"
|
||||
const val MAX_REMAINING_SIGNATURES_COUNT = 10
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.model
|
|||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.components.notifications.NotificationConfig
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.pluralReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.wrappedList
|
||||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
import org.joda.time.DateTime
|
||||
|
||||
|
|
@ -143,7 +140,7 @@ sealed class WalletNotification(val config: NotificationConfig) {
|
|||
),
|
||||
)
|
||||
|
||||
object DemoCard : Informational(
|
||||
data object DemoCard : Informational(
|
||||
title = resourceReference(id = R.string.warning_demo_mode_title),
|
||||
subtitle = resourceReference(id = R.string.warning_demo_mode_message),
|
||||
)
|
||||
|
|
@ -204,4 +201,16 @@ sealed class WalletNotification(val config: NotificationConfig) {
|
|||
onCloseClick = onCloseClick,
|
||||
),
|
||||
)
|
||||
|
||||
data class NoteMigration(val onClick: () -> Unit) : WalletNotification(
|
||||
config = NotificationConfig(
|
||||
title = resourceReference(R.string.wallet_promo_banner_title),
|
||||
subtitle = resourceReference(R.string.wallet_promo_banner_description),
|
||||
iconResId = R.drawable.banner_note_migration,
|
||||
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
|
||||
text = resourceReference(R.string.wallet_promo_banner_button_title),
|
||||
onClick = onClick,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.ui.components.common
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.tangem.core.ui.components.notifications.NoteMigrationNotification
|
||||
import com.tangem.core.ui.components.notifications.Notification
|
||||
import com.tangem.core.ui.components.notifications.OkxPromoNotification
|
||||
import com.tangem.core.ui.components.notifications.RingPromoNotification
|
||||
|
|
@ -19,7 +19,6 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
internal fun LazyListScope.notifications(configs: ImmutableList<WalletNotification>, modifier: Modifier = Modifier) {
|
||||
items(
|
||||
items = configs,
|
||||
|
|
@ -31,16 +30,25 @@ internal fun LazyListScope.notifications(configs: ImmutableList<WalletNotificati
|
|||
is WalletNotification.SwapPromo -> {
|
||||
OkxPromoNotification(
|
||||
config = it.config,
|
||||
modifier = modifier.animateItemPlacement(),
|
||||
modifier = modifier.animateItem(),
|
||||
)
|
||||
}
|
||||
is WalletNotification.RingPromo -> {
|
||||
RingPromoNotification(config = it.config, modifier = modifier.animateItemPlacement())
|
||||
RingPromoNotification(
|
||||
config = it.config,
|
||||
modifier = modifier.animateItem(),
|
||||
)
|
||||
}
|
||||
is WalletNotification.NoteMigration -> {
|
||||
NoteMigrationNotification(
|
||||
config = it.config,
|
||||
modifier = modifier.animateItem(),
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
Notification(
|
||||
config = it.config,
|
||||
modifier = modifier.animateItemPlacement(),
|
||||
modifier = modifier.animateItem(),
|
||||
iconTint = when (it) {
|
||||
is WalletNotification.Critical -> TangemTheme.colors.icon.warning
|
||||
is WalletNotification.Informational -> TangemTheme.colors.icon.accent
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ internal interface WalletWarningsClickIntents {
|
|||
fun onCloseTravalaPromoClick()
|
||||
|
||||
fun onSupportClick()
|
||||
|
||||
fun onNoteMigrationButtonClick(url: String)
|
||||
}
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
|
|
@ -296,6 +298,13 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onNoteMigrationButtonClick(url: String) {
|
||||
analyticsEventHandler.send(MainScreen.NotePromoButton)
|
||||
viewModelScope.launch(dispatchers.main) {
|
||||
router.openUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSelectedUserWallet(): UserWallet? {
|
||||
val userWalletId = stateHolder.getSelectedWalletId()
|
||||
return getUserWalletUseCase(userWalletId).getOrElse {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue