diff --git a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt index ad15758549..1efd190304 100644 --- a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt +++ b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt @@ -15,8 +15,8 @@ import com.tangem.features.onboarding.v2.entry.OnboardingEntryComponent import com.tangem.features.onramp.component.* import com.tangem.features.pushnotifications.api.navigation.PushNotificationsRouter import com.tangem.features.send.api.navigation.SendRouter -import com.tangem.features.swap.SwapComponent import com.tangem.features.staking.api.StakingComponent +import com.tangem.features.swap.SwapComponent import com.tangem.features.tester.api.TesterRouter import com.tangem.features.tokendetails.navigation.TokenDetailsRouter import com.tangem.features.wallet.navigation.WalletRouter @@ -208,6 +208,7 @@ internal class ChildFactory @Inject constructor( params = StoriesComponent.Params( storyId = route.storyId, nextScreen = route.nextScreen, + screenSource = route.screenSource, ), componentFactory = storiesComponentFactory, ) @@ -231,6 +232,7 @@ internal class ChildFactory @Inject constructor( currencyTo = route.currencyTo, userWalletId = route.userWalletId, isInitialReverseOrder = route.isInitialReverseOrder, + screenSource = route.screenSource, ), componentFactory = swapComponentFactory, ) @@ -348,6 +350,7 @@ internal class ChildFactory @Inject constructor( currencyTo = route.currencyTo, userWalletId = route.userWalletId, isInitialReverseOrder = route.isInitialReverseOrder, + screenSource = route.screenSource, ), componentFactory = swapComponentFactory, ) @@ -464,6 +467,7 @@ internal class ChildFactory @Inject constructor( params = StoriesComponent.Params( storyId = route.storyId, nextScreen = route.nextScreen, + screenSource = route.screenSource, ), componentFactory = storiesComponentFactory, ) diff --git a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt index f2c6c70148..6028d6a876 100644 --- a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt +++ b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt @@ -224,6 +224,7 @@ sealed class AppRoute(val path: String) : Route { val currencyTo: CryptoCurrency? = null, val userWalletId: UserWalletId, val isInitialReverseOrder: Boolean = false, + val screenSource: String, ) : AppRoute( path = "/swap" + "/${currencyFrom.id.value}" + @@ -336,6 +337,7 @@ sealed class AppRoute(val path: String) : Route { data class Stories( val storyId: String, val nextScreen: AppRoute, + val screenSource: String, ) : AppRoute(path = "/stories$storyId"), RouteBundleParams { override fun getBundle(): Bundle = bundle(serializer()) } diff --git a/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesFactory.kt b/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesFactory.kt index c9672cb67a..13dcdaf97d 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesFactory.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesFactory.kt @@ -10,7 +10,7 @@ object SwapStoriesFactory { // WARNING! Be careful with indices. Temporary solution. // Use all data from v1/stories api (image url, title, subtitle) @Suppress("MagicNumber") - fun createStoriesState(swapStory: StoryContent, onStoriesClose: () -> Unit): SwapStoriesUM { + fun createStoriesState(swapStory: StoryContent, onStoriesClose: (Int) -> Unit): SwapStoriesUM { val storyOrderedImageUrls = swapStory.getImageUrls() if (storyOrderedImageUrls.size != 5) return SwapStoriesUM.Empty diff --git a/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesScreen.kt b/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesScreen.kt index f69585d2eb..94b925980a 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesScreen.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesScreen.kt @@ -1,7 +1,6 @@ package com.tangem.common.ui.swapStoriesScreen import android.content.res.Configuration -import androidx.activity.compose.BackHandler import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.material3.Text @@ -39,7 +38,6 @@ private const val STORIES_RELATIVE_PADDING = 0.7 fun SwapStoriesScreen(config: SwapStoriesUM) { if (config !is SwapStoriesUM.Content) return - BackHandler(onBack = config.onClose) SystemBarsIconsDisposable(darkIcons = false) StoriesContainer( diff --git a/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesUM.kt b/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesUM.kt index 9de949dfb9..447d2b0ebe 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesUM.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/swapStoriesScreen/SwapStoriesUM.kt @@ -12,7 +12,7 @@ sealed class SwapStoriesUM { data class Content( override val stories: ImmutableList, - override val onClose: () -> Unit, + override val onClose: (Int) -> Unit, ) : SwapStoriesUM(), StoriesContentConfig { override val isRestartable: Boolean = false diff --git a/core/analytics/models/src/main/java/com/tangem/core/analytics/models/AnalyticsParam.kt b/core/analytics/models/src/main/java/com/tangem/core/analytics/models/AnalyticsParam.kt index 6e4b6e4a13..38afb4a40f 100644 --- a/core/analytics/models/src/main/java/com/tangem/core/analytics/models/AnalyticsParam.kt +++ b/core/analytics/models/src/main/java/com/tangem/core/analytics/models/AnalyticsParam.kt @@ -81,6 +81,8 @@ sealed class AnalyticsParam { data object Sell : ScreensSources("Sell") data object Backup : ScreensSources("Backup") data object Onboarding : ScreensSources("Onboarding") + data object LongTap : ScreensSources("Long Tap") + data object Markets : ScreensSources("Markets") } sealed class TxSentFrom(val value: String) { @@ -207,5 +209,6 @@ sealed class AnalyticsParam { const val PLACE = "Place" const val RESIDENCE = "Residence" const val PAYMENT_METHOD = "Payment Method" + const val WATCHED = "Watched" } } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/stories/StoriesContainer.kt b/core/ui/src/main/java/com/tangem/core/ui/components/stories/StoriesContainer.kt index a5c3571994..629f9d10cc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/stories/StoriesContainer.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/stories/StoriesContainer.kt @@ -1,6 +1,7 @@ package com.tangem.core.ui.components.stories import android.content.res.Configuration +import androidx.activity.compose.BackHandler import androidx.compose.foundation.LocalIndication import androidx.compose.foundation.background import androidx.compose.foundation.clickable @@ -46,6 +47,7 @@ inline fun StoriesContainer( isPauseStories: Boolean = false, crossinline currentStoryContent: @Composable BoxScope.(T, Boolean) -> Unit, ) { + var watchedCounter by remember { mutableIntStateOf(1) } var isPressed by remember { mutableStateOf(value = false) } val storyState by remember(config) { mutableStateOf( @@ -55,18 +57,23 @@ inline fun StoriesContainer( ), ) } + BackHandler(onBack = { config.onClose(watchedCounter) }) val isPaused = isPressed || isPauseStories + val onNextClick = { + storyState.nextStory() + watchedCounter = (watchedCounter + 1).coerceAtMost(config.stories.size) + + if (!storyState.hasNext()) { // Finish stories if nothing left to show + config.onClose(watchedCounter) + } + } Box(modifier = modifier) { StoriesClickableArea( onPress = { isPressed = it }, onPreviousStory = storyState::prevStory, - onNextStory = { - if (storyState.nextStory()) { - config.onClose() - } - }, + onNextStory = onNextClick, ) currentStoryContent(storyState.currentStory, isPaused) @@ -79,11 +86,7 @@ inline fun StoriesContainer( currentStep = storyState.currentIndex.intValue, stepDuration = storyState.currentStory.duration, paused = isPaused, - onStepFinish = { - if (storyState.nextStory()) { - config.onClose() - } - }, + onStepFinish = onNextClick, ) Icon( painter = rememberVectorPainter( @@ -97,7 +100,7 @@ inline fun StoriesContainer( .clickable( interactionSource = remember { MutableInteractionSource() }, indication = LocalIndication.current, - onClick = config.onClose, + onClick = { config.onClose(watchedCounter) }, ), ) } @@ -133,7 +136,7 @@ private data class StoryContainerPreviewProviderData( StoryConfigPreviewProviderData(title = "Wallet"), ), override val isRestartable: Boolean = true, - override val onClose: () -> Unit = {}, + override val onClose: (Int) -> Unit = {}, ) : StoriesContentConfig private data class StoryConfigPreviewProviderData( diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt b/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt index 37c26dd443..e4b1688630 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt @@ -19,20 +19,22 @@ class StoriesStepStateMachine( val currentStory get() = stories[currentIndex.intValue.coerceIn(FIRST_INDEX, steps)] - fun nextStory(): Boolean { + fun nextStory() { _currentIndex.intValue = if (currentIndex.intValue == steps && isRepeatable) { FIRST_INDEX } else { currentIndex.intValue.inc().coerceAtMost(stories.size) } - - return currentIndex.intValue > steps } fun prevStory() { _currentIndex.intValue = currentIndex.intValue.dec().coerceAtLeast(FIRST_INDEX) } + fun hasNext(): Boolean { + return currentIndex.intValue <= steps + } + private companion object { const val FIRST_INDEX = 0 } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/stories/model/StoriesContentConfig.kt b/core/ui/src/main/java/com/tangem/core/ui/components/stories/model/StoriesContentConfig.kt index f5e569292a..07e03327ab 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/stories/model/StoriesContentConfig.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/stories/model/StoriesContentConfig.kt @@ -11,7 +11,7 @@ import kotlinx.collections.immutable.ImmutableList interface StoriesContentConfig { val stories: ImmutableList val isRestartable: Boolean - val onClose: () -> Unit + val onClose: (Int) -> Unit } interface StoryConfig { diff --git a/domain/promo/models/src/main/java/com/tangem/domain/promo/models/StoryContent.kt b/domain/promo/models/src/main/java/com/tangem/domain/promo/models/StoryContent.kt index c25f570eea..9cc06cdb94 100644 --- a/domain/promo/models/src/main/java/com/tangem/domain/promo/models/StoryContent.kt +++ b/domain/promo/models/src/main/java/com/tangem/domain/promo/models/StoryContent.kt @@ -23,6 +23,6 @@ data class StoryContent( } } -enum class StoryContentIds(val id: String) { - STORY_FIRST_TIME_SWAP("first-time-swap"), +enum class StoryContentIds(val id: String, val analyticType: String) { + STORY_FIRST_TIME_SWAP(id = "first-time-swap", analyticType = "Swap"), } \ No newline at end of file diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt index 2ca208e28b..471770d6a4 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt @@ -1,6 +1,7 @@ package com.tangem.features.markets.portfolio.impl.model import com.tangem.common.routing.AppRoute +import com.tangem.core.analytics.models.AnalyticsParam import com.tangem.core.decompose.di.ComponentScoped import com.tangem.core.decompose.navigation.Router import com.tangem.core.decompose.ui.UiMessageSender @@ -155,6 +156,7 @@ internal class TokenActionsHandler @AssistedInject constructor( currencyFrom = cryptoCurrencyData.status.currency, userWalletId = cryptoCurrencyData.userWallet.walletId, isInitialReverseOrder = true, + screenSource = AnalyticsParam.ScreensSources.Markets.value, ), ) } diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/model/SwapSelectTokensModel.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/model/SwapSelectTokensModel.kt index 9a7eda16ad..52a717c63e 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/model/SwapSelectTokensModel.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/model/SwapSelectTokensModel.kt @@ -94,6 +94,7 @@ internal class SwapSelectTokensModel @Inject constructor( currencyFrom = requireNotNull(fromCurrencyStatus.value).currency, currencyTo = status.currency, userWalletId = params.userWalletId, + screenSource = AnalyticsParam.ScreensSources.Main.value, ), onComplete = { modelScope.launch { diff --git a/features/stories/api/src/main/java/com/tangem/feature/stories/api/StoriesComponent.kt b/features/stories/api/src/main/java/com/tangem/feature/stories/api/StoriesComponent.kt index 5311ebc07c..371a5e9183 100644 --- a/features/stories/api/src/main/java/com/tangem/feature/stories/api/StoriesComponent.kt +++ b/features/stories/api/src/main/java/com/tangem/feature/stories/api/StoriesComponent.kt @@ -9,6 +9,7 @@ interface StoriesComponent : ComposableContentComponent { data class Params( val storyId: String, val nextScreen: AppRoute, + val screenSource: String, ) interface Factory : ComponentFactory diff --git a/features/stories/impl/build.gradle.kts b/features/stories/impl/build.gradle.kts index edc8449987..5fe385a7ad 100644 --- a/features/stories/impl/build.gradle.kts +++ b/features/stories/impl/build.gradle.kts @@ -28,6 +28,7 @@ dependencies { implementation(projects.core.decompose) implementation(projects.core.navigation) implementation(projects.core.ui) + implementation(projects.core.analytics) /** AndroidX */ implementation(deps.androidx.activity.compose) diff --git a/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/analytics/StoriesEvents.kt b/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/analytics/StoriesEvents.kt new file mode 100644 index 0000000000..bfab83d626 --- /dev/null +++ b/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/analytics/StoriesEvents.kt @@ -0,0 +1,33 @@ +package com.tangem.feature.stories.impl.analytics + +import com.tangem.core.analytics.models.AnalyticsEvent +import com.tangem.core.analytics.models.AnalyticsParam +import com.tangem.core.analytics.models.AnalyticsParam.Key.WATCHED + +sealed class StoriesEvents( + event: String, + params: Map = mapOf(), +) : AnalyticsEvent("Stories", event, params) { + + data class SwapStories( + val source: String, + val watchCount: String, + ) : StoriesEvents( + event = "Swap Stories", + params = mapOf( + AnalyticsParam.SOURCE to source, + WATCHED to watchCount, + ), + ) + + data class Error( + val source: String, + val type: String, + ) : StoriesEvents( + event = "Error", + params = mapOf( + AnalyticsParam.SOURCE to source, + AnalyticsParam.TYPE to type, + ), + ) +} \ No newline at end of file diff --git a/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/model/StoriesModel.kt b/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/model/StoriesModel.kt index 814997e992..c47bd9c1b6 100644 --- a/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/model/StoriesModel.kt +++ b/features/stories/impl/src/main/java/com/tangem/feature/stories/impl/model/StoriesModel.kt @@ -2,6 +2,7 @@ package com.tangem.feature.stories.impl.model import com.tangem.common.ui.swapStoriesScreen.SwapStoriesFactory import com.tangem.common.ui.swapStoriesScreen.SwapStoriesUM +import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.decompose.navigation.Router @@ -9,6 +10,7 @@ import com.tangem.domain.promo.GetStoryContentUseCase import com.tangem.domain.promo.ShouldShowStoriesUseCase import com.tangem.domain.promo.models.StoryContentIds import com.tangem.feature.stories.api.StoriesComponent +import com.tangem.feature.stories.impl.analytics.StoriesEvents import com.tangem.utils.coroutines.CoroutineDispatcherProvider import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -23,6 +25,7 @@ internal class StoriesModel @Inject constructor( override val dispatchers: CoroutineDispatcherProvider, private val getStoryContentUseCase: GetStoryContentUseCase, private val shouldShowStoriesUseCase: ShouldShowStoriesUseCase, + private val analyticsEventHandler: AnalyticsEventHandler, ) : Model() { val state: StateFlow get() = _state @@ -50,16 +53,36 @@ internal class StoriesModel @Inject constructor( getStoryContentUseCase.invokeSync(params.storyId).fold( ifLeft = { Timber.e("Unable to load stories for ${StoryContentIds.STORY_FIRST_TIME_SWAP.id}") + analyticsEventHandler.send( + StoriesEvents.Error( + source = params.screenSource, + type = StoryContentIds.STORY_FIRST_TIME_SWAP.analyticType, + ), + ) openScreen(hideStories = false) // Fallback to target screen }, ifRight = { swapStory -> if (swapStory == null) { + analyticsEventHandler.send( + StoriesEvents.Error( + source = params.screenSource, + type = StoryContentIds.STORY_FIRST_TIME_SWAP.analyticType, + ), + ) openScreen(hideStories = false) // Fallback to target screen } else { _state.update { SwapStoriesFactory.createStoriesState( swapStory = swapStory, - onStoriesClose = ::openScreen, + onStoriesClose = { watchCount -> + analyticsEventHandler.send( + StoriesEvents.SwapStories( + source = params.screenSource, + watchCount = watchCount.toString(), + ), + ) + openScreen() + }, ) } } diff --git a/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapComponent.kt b/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapComponent.kt index 75ec9732ce..f3bbc6ea48 100644 --- a/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapComponent.kt +++ b/features/swap/api/src/main/kotlin/com/tangem/features/swap/SwapComponent.kt @@ -12,6 +12,7 @@ interface SwapComponent : ComposableContentComponent { val currencyTo: CryptoCurrency? = null, val userWalletId: UserWalletId, val isInitialReverseOrder: Boolean = false, + val screenSource: String, ) interface Factory : ComponentFactory diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/StoriesEvents.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/StoriesEvents.kt new file mode 100644 index 0000000000..6123fa2876 --- /dev/null +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/analytics/StoriesEvents.kt @@ -0,0 +1,33 @@ +package com.tangem.feature.swap.analytics + +import com.tangem.core.analytics.models.AnalyticsEvent +import com.tangem.core.analytics.models.AnalyticsParam +import com.tangem.core.analytics.models.AnalyticsParam.Key.WATCHED + +sealed class StoriesEvents( + event: String, + params: Map = mapOf(), +) : AnalyticsEvent("Stories", event, params) { + + data class SwapStories( + val source: String, + val watchCount: String, + ) : StoriesEvents( + event = "Swap Stories", + params = mapOf( + AnalyticsParam.SOURCE to source, + WATCHED to watchCount, + ), + ) + + data class Error( + val source: String, + val type: String, + ) : StoriesEvents( + event = "Error", + params = mapOf( + AnalyticsParam.SOURCE to source, + AnalyticsParam.TYPE to type, + ), + ) +} \ No newline at end of file diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt index 7da70ff432..1207f32248 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt @@ -37,6 +37,7 @@ import com.tangem.domain.tokens.model.Network import com.tangem.domain.wallets.models.UserWallet import com.tangem.domain.wallets.models.UserWalletId import com.tangem.domain.wallets.usecase.GetUserWalletUseCase +import com.tangem.feature.swap.analytics.StoriesEvents import com.tangem.feature.swap.analytics.SwapEvents import com.tangem.feature.swap.domain.BlockchainInteractor import com.tangem.feature.swap.domain.SwapInteractor @@ -277,10 +278,23 @@ internal class SwapModel @Inject constructor( getStoryContentUseCase.invokeSync(StoryContentIds.STORY_FIRST_TIME_SWAP.id).fold( ifLeft = { Timber.e("Unable to load stories for ${StoryContentIds.STORY_FIRST_TIME_SWAP.id}") + analyticsEventHandler.send( + StoriesEvents.Error( + source = params.screenSource, + type = StoryContentIds.STORY_FIRST_TIME_SWAP.analyticType, + ), + ) }, ifRight = { story -> - story?.let { + if (story != null) { uiState = stateBuilder.createStoriesState(uiState, story) + } else { + analyticsEventHandler.send( + StoriesEvents.Error( + source = params.screenSource, + type = StoryContentIds.STORY_FIRST_TIME_SWAP.analyticType, + ), + ) } }, ) @@ -1131,7 +1145,13 @@ internal class SwapModel @Inject constructor( onSuccess = { swapRouter.openScreen(SwapNavScreen.Success) }, - onStoriesClose = { + onStoriesClose = { watchCount -> + analyticsEventHandler.send( + StoriesEvents.SwapStories( + source = params.screenSource, + watchCount = watchCount.toString(), + ), + ) modelScope.launch { shouldShowStoriesUseCase.neverToShow(StoryContentIds.STORY_FIRST_TIME_SWAP.id) } swapRouter.openScreen(SwapNavScreen.Main) }, diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/models/UiActions.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/models/UiActions.kt index 4c7a41a979..e3a4831dbc 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/models/UiActions.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/models/UiActions.kt @@ -21,7 +21,7 @@ data class UiActions( val openPermissionBottomSheet: () -> Unit, val onChangeApproveType: (ApproveType) -> Unit, // region new actions - val onStoriesClose: () -> Unit, + val onStoriesClose: (Int) -> Unit, val onRetryClick: () -> Unit, val onClickFee: () -> Unit, val onSelectFeeType: (TxFee) -> Unit, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt index 744218305e..13f4eba101 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt @@ -36,6 +36,7 @@ import com.tangem.domain.card.NetworkHasDerivationUseCase import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.onramp.model.OnrampSource +import com.tangem.domain.promo.ShouldShowSwapPromoTokenUseCase import com.tangem.domain.redux.ReduxStateHolder import com.tangem.domain.staking.GetStakingAvailabilityUseCase import com.tangem.domain.staking.GetStakingEntryInfoUseCase @@ -73,7 +74,6 @@ import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenBala import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState import com.tangem.feature.tokendetails.presentation.tokendetails.state.factory.TokenDetailsStateFactory import com.tangem.feature.tokendetails.presentation.tokendetails.state.factory.express.ExpressStatusFactory -import com.tangem.domain.promo.ShouldShowSwapPromoTokenUseCase import com.tangem.features.onramp.OnrampFeatureToggles import com.tangem.features.tokendetails.impl.R import com.tangem.utils.Provider @@ -645,7 +645,13 @@ internal class TokenDetailsViewModel @Inject constructor( return } - appRouter.push(AppRoute.Swap(currencyFrom = cryptoCurrency, userWalletId = userWalletId)) + appRouter.push( + AppRoute.Swap( + currencyFrom = cryptoCurrency, + userWalletId = userWalletId, + screenSource = AnalyticsParam.ScreensSources.Token.value, + ), + ) } override fun onDismissDialog() { diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt index e8e8c519b8..47b8fc42ec 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt @@ -358,6 +358,7 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor( AppRoute.Swap( currencyFrom = cryptoCurrencyStatus.currency, userWalletId = userWalletId, + screenSource = AnalyticsParam.ScreensSources.LongTap.value, ), ) } @@ -617,6 +618,7 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor( AppRoute.Stories( storyId = StoryContentIds.STORY_FIRST_TIME_SWAP.id, nextScreen = targetRoute, + screenSource = AnalyticsParam.ScreensSources.Main.value, ) } else { targetRoute diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index d49f7f2f1d..2b6ab573a0 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -1,5 +1,5 @@ [versions] -tangemBlockchainSdk = "release-app_5.21-955" +tangemBlockchainSdk = "release-app_5.21-958" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "release-app_5.21-435" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^