diff --git a/v4/build.gradle b/v4/build.gradle index bc78ba41..42ddaa4d 100644 --- a/v4/build.gradle +++ b/v4/build.gradle @@ -88,7 +88,7 @@ ext { compileSdkVersion = 34 // App dependencies - abacusVersion = '1.8.14' + abacusVersion = '1.8.19' carteraVersion = '0.1.15' kollectionsVersion = '2.0.16' diff --git a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt index 52ad3ad9..406ff3d5 100644 --- a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt +++ b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt @@ -100,6 +100,7 @@ object DydxPortfolioPositionItemView { ComposeAssetPosition( position, ) + Spacer(modifier = Modifier.weight(1f)) } Spacer(modifier = Modifier.height(8.dp)) @@ -169,11 +170,9 @@ object DydxPortfolioPositionItemView { fontType = ThemeFont.FontType.plus, ), ) - } - Row( - verticalAlignment = Alignment.CenterVertically, - ) { + Spacer(modifier = Modifier.weight(1f)) + SideTextView.Content( modifier = Modifier, state = position.side?.copy( @@ -199,6 +198,13 @@ object DydxPortfolioPositionItemView { .themeColor(ThemeColor.SemanticColor.text_primary), ) } + + Text( + text = position.notionalTotal ?: "-", + style = TextStyle.dydxDefault + .themeFont(fontSize = ThemeFont.FontSize.small) + .themeColor(ThemeColor.SemanticColor.text_tertiary), + ) } } @@ -212,20 +218,20 @@ object DydxPortfolioPositionItemView { horizontalAlignment = Alignment.Start, ) { Text( - text = localizer.localize("APP.GENERAL.INDEX_ENTRY"), + text = localizer.localize("APP.GENERAL.LIQ_ORACLE"), style = TextStyle.dydxDefault .themeFont(fontSize = ThemeFont.FontSize.small) .themeColor(ThemeColor.SemanticColor.text_tertiary), ) Text( - text = position.oraclePrice ?: "", + text = position.liquidationPrice ?: localizer.localize("APP.GENERAL.NONE"), style = TextStyle.dydxDefault .themeFont(fontSize = ThemeFont.FontSize.small) .themeColor(ThemeColor.SemanticColor.text_primary), ) Text( - text = position.entryPrice ?: "", + text = position.oraclePrice ?: "", style = TextStyle.dydxDefault .themeFont(fontSize = ThemeFont.FontSize.mini) .themeColor(ThemeColor.SemanticColor.text_tertiary), @@ -286,11 +292,7 @@ object DydxPortfolioPositionItemView { ) Text( - /* - TODO: Still need to verify what the margin means here - text = position.margin ?: "", - */ - text = position.margin ?: "", + text = position.margin ?: "-", style = TextStyle.dydxDefault .themeFont(fontSize = ThemeFont.FontSize.small) .themeColor(ThemeColor.SemanticColor.text_primary), diff --git a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt index 799547fd..a94e5077 100644 --- a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt +++ b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt @@ -1,20 +1,15 @@ package exchange.dydx.trading.feature.portfolio.components.positions import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row 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.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items -import androidx.compose.material.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.text.TextStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -22,11 +17,8 @@ import exchange.dydx.abacus.protocols.LocalizerProtocol import exchange.dydx.platformui.components.dividers.PlatformDivider import exchange.dydx.platformui.compose.collectAsStateWithLifecycle import exchange.dydx.platformui.designSystem.theme.ThemeColor -import exchange.dydx.platformui.designSystem.theme.ThemeFont import exchange.dydx.platformui.designSystem.theme.ThemeShapes -import exchange.dydx.platformui.designSystem.theme.dydxDefault import exchange.dydx.platformui.designSystem.theme.themeColor -import exchange.dydx.platformui.designSystem.theme.themeFont import exchange.dydx.platformui.theme.DydxThemedPreviewSurface import exchange.dydx.platformui.theme.MockLocalizer import exchange.dydx.trading.common.component.DydxComponent @@ -132,42 +124,4 @@ object DydxPortfolioPositionsView : DydxComponent { } } } - - @Composable - private fun CreateHeader(modifier: Modifier, state: ViewState) { - Row( - modifier = modifier - .fillMaxWidth() - .padding(horizontal = ThemeShapes.HorizontalPadding * 2), - verticalAlignment = Alignment.CenterVertically, - ) { - Text( - text = state.localizer.localize("APP.GENERAL.DETAILS"), - style = TextStyle.dydxDefault - .themeFont(fontSize = ThemeFont.FontSize.small) - .themeColor(ThemeColor.SemanticColor.text_tertiary), - ) - - Spacer(modifier = Modifier.weight(1f)) - - Text( - text = state.localizer.localize("APP.GENERAL.INDEX_ENTRY"), - style = TextStyle.dydxDefault - .themeFont(fontSize = ThemeFont.FontSize.small) - .themeColor(ThemeColor.SemanticColor.text_tertiary), - ) - - Row( - modifier = Modifier.width(80.dp), - ) { - Spacer(modifier = Modifier.weight(1f)) - Text( - text = state.localizer.localize("APP.GENERAL.PROFIT_AND_LOSS"), - style = TextStyle.dydxDefault - .themeFont(fontSize = ThemeFont.FontSize.small) - .themeColor(ThemeColor.SemanticColor.text_tertiary), - ) - } - } - } } diff --git a/v4/feature/profile/src/main/java/exchange/dydx/trading/feature/profile/theme/DydxThemeViewModel.kt b/v4/feature/profile/src/main/java/exchange/dydx/trading/feature/profile/theme/DydxThemeViewModel.kt index 9eb6c5f4..ab0670f0 100644 --- a/v4/feature/profile/src/main/java/exchange/dydx/trading/feature/profile/theme/DydxThemeViewModel.kt +++ b/v4/feature/profile/src/main/java/exchange/dydx/trading/feature/profile/theme/DydxThemeViewModel.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import javax.inject.Inject private val settingsFile = "settings_theme.json" -private val defaultTheme = "dark" +private val defaultTheme = "classic_dark" @HiltViewModel class DydxThemeViewModel @Inject constructor( diff --git a/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/views/TokenTextView.kt b/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/views/TokenTextView.kt index 41516a1b..b3adf674 100644 --- a/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/views/TokenTextView.kt +++ b/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/views/TokenTextView.kt @@ -4,12 +4,12 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.text.TextStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import exchange.dydx.platformui.components.textgroups.PlatformAutoSizingText import exchange.dydx.platformui.designSystem.theme.ThemeColor import exchange.dydx.platformui.designSystem.theme.color import exchange.dydx.platformui.designSystem.theme.dydxDefault @@ -54,9 +54,9 @@ object TokenTextView { .padding(horizontal = 4.dp) .padding(vertical = 2.dp), ) { - Text( + PlatformAutoSizingText( text = state.symbol, - style = textStyle, + textStyle = textStyle, ) } } diff --git a/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedAccountViewState.kt b/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedAccountViewState.kt index 7e8d7662..7fa810e8 100644 --- a/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedAccountViewState.kt +++ b/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedAccountViewState.kt @@ -44,20 +44,20 @@ data class SharedAccountViewState( return SharedAccountViewState( freeCollateral = formatter.dollar( number = subaccount.freeCollateral?.current, - size = null, + digits = 2, ), buyingPower = formatter.dollar( number = subaccount.buyingPower?.current?.filter( NumericFilter.NotNegative, ), - size = null, + digits = 2, ), marginUsage = formatter.percent( number = subaccount.marginUsage?.current, digits = 2, ), leverage = formatter.leverage(number = subaccount.leverage?.current), - equity = formatter.dollar(number = subaccount.equity?.current, size = null), + equity = formatter.dollar(number = subaccount.equity?.current, digits = 2), openInterest = formatter.dollarVolume( number = subaccount.notionalTotal?.current, digits = 2, diff --git a/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedMarketPositionViewState.kt b/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedMarketPositionViewState.kt index 5cfd225c..da66946d 100644 --- a/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedMarketPositionViewState.kt +++ b/v4/feature/shared/src/main/java/exchange/dydx/trading/feature/shared/viewstate/SharedMarketPositionViewState.kt @@ -27,6 +27,7 @@ data class SharedMarketPositionViewState( val liquidationPrice: String? = null, val side: SideTextView.ViewState? = null, val size: String? = null, + val notionalTotal: String? = null, val margin: String? = null, val token: TokenTextView.ViewState? = null, val logoUrl: String? = null, @@ -68,6 +69,7 @@ data class SharedMarketPositionViewState( ): SharedMarketPositionViewState? { val configs = market.configs ?: return null val positionSize = position.size.current ?: 0.0 + val notionalTotal = position.notionalTotal.current ?: 0.0 if (positionSize == 0.0) return null val unrealizedPnlPercent = position.unrealizedPnlPercent.current ?: 0.0 @@ -109,6 +111,7 @@ data class SharedMarketPositionViewState( positionSize.absoluteValue, configs.displayStepSizeDecimals ?: 1, ), + notionalTotal = formatter.dollar(notionalTotal, 2), token = TokenTextView.ViewState( symbol = asset?.id ?: market.assetId, ),