diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/BuySubscriptionModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/BuySubscriptionModel.kt index 8cd683dc1c..ee9a2a8861 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/BuySubscriptionModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/BuySubscriptionModel.kt @@ -51,6 +51,22 @@ object BuySubscriptionModel { else -> throw IllegalArgumentException("Unknown IPaidAction") } + val IPaidAction.bigDescriptionStringRes: Int + get() = when (this) { + TokenInsights -> R.string.Premium_UpgradeFeature_TokenInsights_BigDescription + AdvancedSearch -> R.string.Premium_UpgradeFeature_AdvancedSearch_BigDescription + TradeSignals -> R.string.Premium_UpgradeFeature_TradeSignals_BigDescription + FavorableSwaps -> R.string.Premium_UpgradeFeature_FavorableSwaps_BigDescription + TransactionSpeedTools -> R.string.Premium_UpgradeFeature_TxSpeedTools_BigDescription + DuressMode -> R.string.Premium_UpgradeFeature_DuressMode_BigDescription + AddressVerification -> R.string.Premium_UpgradeFeature_AddressVerification_BigDescription + Tor -> R.string.Premium_UpgradeFeature_Tor_BigDescription + PrivacyMode -> R.string.Premium_UpgradeFeature_PrivacyMode_BigDescription + VIPSupport -> R.string.Premium_UpgradeFeature_VipSupport_BigDescription + VIPClub -> R.string.Premium_UpgradeFeature_VipClub_BigDescription + else -> throw IllegalArgumentException("Unknown IPaidAction") + } + val IPaidAction.iconRes: Int get() = when (this) { TokenInsights -> R.drawable.prem_portfolio_24 diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/SelectSubscriptionScreen.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/SelectSubscriptionScreen.kt index ef15af0657..8600d3aa08 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/SelectSubscriptionScreen.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/SelectSubscriptionScreen.kt @@ -37,6 +37,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource @@ -47,11 +48,17 @@ import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.modules.evmfee.ButtonsGroupWithShade +import io.horizontalsystems.bankwallet.modules.usersubscription.BuySubscriptionModel.bigDescriptionStringRes +import io.horizontalsystems.bankwallet.modules.usersubscription.BuySubscriptionModel.iconRes +import io.horizontalsystems.bankwallet.modules.usersubscription.BuySubscriptionModel.titleStringRes import io.horizontalsystems.bankwallet.modules.usersubscription.BuySubscriptionViewModel import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.components.RadialBackground import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer +import io.horizontalsystems.bankwallet.ui.compose.components.body_bran import io.horizontalsystems.bankwallet.ui.compose.components.body_grey +import io.horizontalsystems.bankwallet.ui.extensions.BottomSheetHeader +import io.horizontalsystems.subscriptions.core.IPaidAction import io.horizontalsystems.subscriptions.core.Subscription import kotlinx.coroutines.launch @@ -70,11 +77,15 @@ fun SelectSubscriptionScreen( val coroutineScope = rememberCoroutineScope() val selectedTabIndex = remember { mutableStateOf(0) } - val modalBottomSheetState = + val plansModalBottomSheetState = androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true) - var isBottomSheetVisible by remember { mutableStateOf(false) } + val infoModalBottomSheetState = + androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true) + var isPlanSelectBottomSheetVisible by remember { mutableStateOf(false) } + var isInfoBottomSheetVisible by remember { mutableStateOf(false) } val scrollScope = rememberCoroutineScope() val pagerState = rememberPagerState(initialPage = selectedTabIndex.value) { 2 } + var infoBottomSheetAction: IPaidAction? = null Scaffold( backgroundColor = ComposeAppTheme.colors.tyler, @@ -125,7 +136,16 @@ fun SelectSubscriptionScreen( state = pagerState, userScrollEnabled = false ) { page -> - PlanItems(subscriptions[page].actions) + PlanItems( + items = subscriptions[page].actions, + onItemClick = { action -> + infoBottomSheetAction = action + coroutineScope.launch { + isInfoBottomSheetVisible = true + infoModalBottomSheetState.show() + } + } + ) } VSpacer(32.dp) } @@ -142,8 +162,8 @@ fun SelectSubscriptionScreen( brush = yellowGradient, onClick = { coroutineScope.launch { - isBottomSheetVisible = true - modalBottomSheetState.show() + isPlanSelectBottomSheetVisible = true + plansModalBottomSheetState.show() } }, ) @@ -159,26 +179,78 @@ fun SelectSubscriptionScreen( } } } - if (isBottomSheetVisible) { + if (isPlanSelectBottomSheetVisible) { SubscriptionBottomSheet( - modalBottomSheetState = modalBottomSheetState, + modalBottomSheetState = plansModalBottomSheetState, subscriptions = subscriptions, selectedTabIndex = selectedTabIndex, navController = navController, hideBottomSheet = { coroutineScope.launch { - modalBottomSheetState.hide() + plansModalBottomSheetState.hide() } - isBottomSheetVisible = false + isPlanSelectBottomSheetVisible = false } ) } + if (isInfoBottomSheetVisible) { + infoBottomSheetAction?.let { + InfoBottomSheet( + icon = it.iconRes, + title = stringResource(it.titleStringRes), + description = stringResource(it.bigDescriptionStringRes), + hideBottomSheet = { + coroutineScope.launch { + infoModalBottomSheetState.hide() + } + infoBottomSheetAction = null + isInfoBottomSheetVisible = false + } + ) + } + } } } } +@OptIn(ExperimentalMaterial3Api::class) @Composable +private fun InfoBottomSheet( + icon: Int, + title: String, + description: String, + hideBottomSheet: () -> Unit +) { + ModalBottomSheet( + onDismissRequest = hideBottomSheet, + sheetState = androidx.compose.material3.rememberModalBottomSheetState(skipPartiallyExpanded = true), + containerColor = ComposeAppTheme.colors.transparent + ) { + BottomSheetHeader( + iconPainter = painterResource(icon), + title = title, + titleColor = ComposeAppTheme.colors.jacob, + iconTint = ColorFilter.tint(ComposeAppTheme.colors.jacob), + onCloseClick = hideBottomSheet + ) { + Column( + modifier = Modifier + .padding(vertical = 12.dp, horizontal = 32.dp) + .fillMaxWidth() + ) { + body_bran( + text = description, + modifier = Modifier.fillMaxWidth(), + ) + VSpacer(52.dp) + } + } + } + +} + @OptIn(ExperimentalMaterial3Api::class) +@Composable private fun SubscriptionBottomSheet( modalBottomSheetState: SheetState, subscriptions: List, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/UiElements.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/UiElements.kt index 35cef5ea63..70c2a66427 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/UiElements.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/usersubscription/ui/UiElements.kt @@ -218,14 +218,18 @@ fun SubscriptionOption( } @Composable -fun PlanItems(items: List) { +fun PlanItems( + items: List, + onItemClick: (IPaidAction) -> Unit +) { Column { items.forEachIndexed { index, item -> PremiumFeatureItem( icon = item.iconRes, title = item.titleStringRes, subtitle = item.descriptionStringRes, - tint = if (item is VIPClub || item is VIPSupport) ComposeAppTheme.colors.jacob else ComposeAppTheme.colors.leah + tint = if (item is VIPClub || item is VIPSupport) ComposeAppTheme.colors.jacob else ComposeAppTheme.colors.leah, + click = { onItemClick(item) } ) if (index < items.size - 1) { Divider(color = ComposeAppTheme.colors.steel20) @@ -246,6 +250,7 @@ fun PremiumFeatureItem( verticalAlignment = Alignment.CenterVertically, modifier = Modifier .fillMaxWidth() + .clickable { click() } .background(ComposeAppTheme.colors.steel10) .padding(vertical = 12.dp, horizontal = 16.dp) ) { diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/ui/extensions/BaseComposableBottomSheetFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/ui/extensions/BaseComposableBottomSheetFragment.kt index 1cba161d0f..c82a3756aa 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/ui/extensions/BaseComposableBottomSheetFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/ui/extensions/BaseComposableBottomSheetFragment.kt @@ -5,15 +5,25 @@ import android.view.View import android.widget.FrameLayout import androidx.compose.foundation.Image import androidx.compose.foundation.background -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material.Icon +import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.res.painterResource @@ -25,7 +35,10 @@ import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme -import io.horizontalsystems.bankwallet.ui.compose.components.* +import io.horizontalsystems.bankwallet.ui.compose.components.HsIconButton +import io.horizontalsystems.bankwallet.ui.compose.components.body_grey +import io.horizontalsystems.bankwallet.ui.compose.components.body_leah +import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey open class BaseComposableBottomSheetFragment : BottomSheetDialogFragment() { @@ -58,19 +71,22 @@ fun BottomSheetHeader( iconPainter: Painter, title: String, onCloseClick: () -> Unit, + titleColor: Color = ComposeAppTheme.colors.leah, iconTint: ColorFilter? = null, content: @Composable() (ColumnScope.() -> Unit), ) { BottomSheetHeader( iconPainter = iconPainter, titleContent = { - headline2_leah( + Text( + text = title, modifier = Modifier .padding(horizontal = 16.dp) .weight(1f) .align(Alignment.CenterVertically), - text = title, maxLines = 1, + style = ComposeAppTheme.typography.headline2, + color = titleColor, ) }, onCloseClick = onCloseClick, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 05e4100156..b0a8484647 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -913,6 +913,18 @@ Secure connection. Full disconnection from data collection. + Fast response support. + Private chat with exclusive information. + Token Insights provides a comprehensive view of a token’s activity and performance metrics. This includes trading volume, liquidity levels, holder behavior, total value locked (TVL), and transaction activity. By offering detailed analytics, the feature enables users to evaluate token potential, monitor market trends, and make data-driven investment decisions. It’s a powerful tool for those who seek to understand token ecosystems and market dynamics in-depth. + Custom filters for token searches. + Signals for confident trading. + Swaps with no extra fees. + Speed up and cancel transactions. + Hides main wallets in case of coercion. + Additional address check for fraud prevention. + Secure connection. + Full disconnection from data collection. + month year