Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 5e8334d

Browse files
committed
Clean code
1 parent 5a785ed commit 5e8334d

3 files changed

Lines changed: 6 additions & 54 deletions

File tree

features/assets/viewmodels/src/main/kotlin/com/gemwallet/features/assets/viewmodels/AssetsViewModel.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import com.gemwallet.android.cases.transactions.SyncTransactions
1010
import com.gemwallet.android.data.repositoreis.assets.AssetsRepository
1111
import com.gemwallet.android.data.repositoreis.config.UserConfig
1212
import com.gemwallet.android.data.repositoreis.session.SessionRepository
13+
import com.gemwallet.android.domains.percentage.formatAsPercentage
1314
import com.gemwallet.android.domains.price.PriceState
15+
import com.gemwallet.android.domains.price.getPriceState
1416
import com.gemwallet.android.ext.asset
1517
import com.gemwallet.android.ext.getAccount
1618
import com.gemwallet.android.ext.isSwapSupport
@@ -19,7 +21,7 @@ import com.gemwallet.android.model.Session
1921
import com.gemwallet.android.model.SyncState
2022
import com.gemwallet.android.model.format
2123
import com.gemwallet.android.ui.R
22-
import com.gemwallet.features.assets.viewmodels.model.PriceUIState
24+
//import com.gemwallet.features.assets.viewmodels.model.PriceUIState
2325
import com.gemwallet.features.assets.viewmodels.model.WalletInfoUIState
2426
import com.wallet.core.primitives.AssetId
2527
import com.wallet.core.primitives.Chain
@@ -227,8 +229,8 @@ class AssetsViewModel @Inject constructor(
227229
cryptoTotalValue = cryptoTotal,
228230
totalValueFormatted = currency.format(totalValue, dynamicPlace = true),
229231
changedValue = currency.format(changedValue, dynamicPlace = true, maxDecimals = 2),
230-
changedPercentages = PriceUIState.formatPercentage(changedPercentages, showSign = false),
231-
priceState = PriceUIState.getState(changedPercentages),
232+
changedPercentages = changedPercentages.formatAsPercentage(isShowSign = false),
233+
priceState = changedPercentages.getPriceState(),
232234
type = wallet.type,
233235
operationsEnabled = operationsEnabled,
234236
isSwapEnabled = isSwapEnabled,

features/assets/viewmodels/src/main/kotlin/com/gemwallet/features/assets/viewmodels/model/AssetUIState.kt

Lines changed: 0 additions & 50 deletions
This file was deleted.

gemcore/src/main/kotlin/com/gemwallet/android/domains/price/PriceState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enum class PriceState {
77
}
88

99
fun Double.getPriceState() = when {
10-
this >= 0.0 -> PriceState.Up
10+
this >= 0.0 -> PriceState.Up // TODO: Check it.
1111
this < 0.0 -> PriceState.Down
1212
else -> PriceState.None
1313
}

0 commit comments

Comments
 (0)