Updated on 2026-08-14
This commit is contained in:
commit
fce19374d4
185 changed files with 7959 additions and 1134 deletions
|
|
@ -1,4 +1,9 @@
|
|||
plugins {
|
||||
alias(deps.plugins.kotlin.jvm)
|
||||
alias(deps.plugins.kotlin.serialization)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(deps.kotlin.serialization)
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.tangem.core.analytics.models
|
|||
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.REFERRAL
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.REFERRAL_ID
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
const val IS_NOT_HTTP_ERROR = "Is not http error"
|
||||
|
||||
|
|
@ -67,39 +68,40 @@ sealed class AnalyticsParam {
|
|||
data object BlockchainSdk : Error("Blockchain Sdk Error")
|
||||
}
|
||||
|
||||
sealed class ScreensSources(val value: String) {
|
||||
data object Settings : ScreensSources("Settings")
|
||||
data object Main : ScreensSources("Main")
|
||||
data object SignIn : ScreensSources("Sign In")
|
||||
data object Send : ScreensSources("Send")
|
||||
data object Intro : ScreensSources("Introduction")
|
||||
data object MyWallets : ScreensSources("My Wallets")
|
||||
data object Token : ScreensSources("Token")
|
||||
data object Stories : ScreensSources("Stories")
|
||||
data object Buy : ScreensSources("Buy")
|
||||
data object Swap : ScreensSources("Swap")
|
||||
data object Sell : ScreensSources("Sell")
|
||||
data object Backup : ScreensSources("Backup")
|
||||
data object Onboarding : ScreensSources("Onboarding")
|
||||
data object LongTap : ScreensSources("Long Tap")
|
||||
data object Market : ScreensSources("Market")
|
||||
data object Markets : ScreensSources("Markets")
|
||||
data object MarketPulse : ScreensSources("Market Pulse")
|
||||
data object TangemPay : ScreensSources("Tangem Pay")
|
||||
data object WalletSettings : ScreensSources("Wallet Settings")
|
||||
data object Upgrade : ScreensSources("Upgrade")
|
||||
data object HardwareWallet : ScreensSources("Hardware Wallet")
|
||||
data object ImportWallet : ScreensSources("Import Wallet")
|
||||
data object CreateWalletIntro : ScreensSources("Create Wallet Intro")
|
||||
data object AddNewWallet : ScreensSources("Add New Wallet")
|
||||
data object AddNew : ScreensSources("Add New")
|
||||
data object CreateWallet : ScreensSources("Create Wallet")
|
||||
data object NewsList : ScreensSources("News List")
|
||||
data object NewsLink : ScreensSources("News Link")
|
||||
data object NewsPage : ScreensSources("News Page")
|
||||
data object Portfolio : ScreensSources("Portfolio")
|
||||
data object Staking : ScreensSources("Staking")
|
||||
data object Earn : ScreensSources("Earn")
|
||||
@Serializable
|
||||
enum class ScreensSources(val value: String) {
|
||||
Settings("Settings"),
|
||||
Main("Main"),
|
||||
SignIn("Sign In"),
|
||||
Send("Send"),
|
||||
Intro("Introduction"),
|
||||
MyWallets("My Wallets"),
|
||||
Token("Token"),
|
||||
Stories("Stories"),
|
||||
Buy("Buy"),
|
||||
Swap("Swap"),
|
||||
Sell("Sell"),
|
||||
Backup("Backup"),
|
||||
Onboarding("Onboarding"),
|
||||
LongTap("Long Tap"),
|
||||
Market("Market"),
|
||||
Markets("Markets"),
|
||||
MarketPulse("Market Pulse"),
|
||||
TangemPay("Tangem Pay"),
|
||||
WalletSettings("Wallet Settings"),
|
||||
Upgrade("Upgrade"),
|
||||
HardwareWallet("Hardware Wallet"),
|
||||
ImportWallet("Import Wallet"),
|
||||
CreateWalletIntro("Create Wallet Intro"),
|
||||
AddNewWallet("Add New Wallet"),
|
||||
AddNew("Add New"),
|
||||
CreateWallet("Create Wallet"),
|
||||
NewsList("News List"),
|
||||
NewsLink("News Link"),
|
||||
NewsPage("News Page"),
|
||||
Portfolio("Portfolio"),
|
||||
Staking("Staking"),
|
||||
Earn("Earn"),
|
||||
}
|
||||
|
||||
sealed class TxSentFrom(val value: String) {
|
||||
|
|
@ -191,9 +193,9 @@ sealed class AnalyticsParam {
|
|||
}
|
||||
|
||||
sealed class WalletCreationType(val value: String) {
|
||||
data object PrivateKey : WalletCreationType("Private key")
|
||||
data object NewSeed : WalletCreationType("New seed")
|
||||
data object SeedImport : WalletCreationType("Seed import")
|
||||
data object PrivateKey : WalletCreationType(value = "Private Key")
|
||||
data object NewSeed : WalletCreationType(value = "New Seed")
|
||||
data object SeedImport : WalletCreationType(value = "Seed Import")
|
||||
}
|
||||
|
||||
sealed class WalletType(val value: String) {
|
||||
|
|
@ -239,6 +241,13 @@ sealed class AnalyticsParam {
|
|||
MobileWallet("Mobile Wallet"),
|
||||
}
|
||||
|
||||
enum class SignInType(val value: String) {
|
||||
Card("Card"),
|
||||
Biometric("Biometric"),
|
||||
NoSecurity("No Security"),
|
||||
AccessCode("Access Code"),
|
||||
}
|
||||
|
||||
companion object Key {
|
||||
const val BLOCKCHAIN = "Blockchain"
|
||||
const val TOKEN_PARAM = "Token"
|
||||
|
|
@ -297,6 +306,11 @@ sealed class AnalyticsParam {
|
|||
const val REFERRAL_ID = "Referral_ID"
|
||||
const val SEARCHED = "Searched"
|
||||
const val RATE_TYPE = "Rate Type"
|
||||
const val SIGN_IN_TYPE = "Sign in type"
|
||||
const val WALLETS_COUNT = "Wallets Count"
|
||||
const val WALLET_TYPE = "Wallet Type"
|
||||
const val BACKUPED = "Backuped"
|
||||
const val MEMO = "Memo"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,65 +2,41 @@ package com.tangem.core.analytics.models
|
|||
|
||||
sealed class Basic(
|
||||
event: String,
|
||||
params: Map<String, String> = mapOf(),
|
||||
) : AnalyticsEvent("Basic", event, params) {
|
||||
params: Map<String, String> = emptyMap(),
|
||||
) : AnalyticsEvent(category = "Basic", event = event, params = params) {
|
||||
|
||||
/**
|
||||
* Tracks card scanning from specific entry points (Introduction, Main, My Wallets, Sign In).
|
||||
* The originating screen is reported via the [AnalyticsParam.SOURCE] parameter.
|
||||
*/
|
||||
class CardWasScanned(
|
||||
source: AnalyticsParam.ScreensSources,
|
||||
) : Basic(
|
||||
event = "Card Was Scanned",
|
||||
params = mapOf(
|
||||
AnalyticsParam.Key.SOURCE to source.value,
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
)
|
||||
|
||||
class SignedInLegacy(
|
||||
currency: AnalyticsParam.WalletType,
|
||||
batch: String,
|
||||
signInType: SignInType,
|
||||
walletsCount: String,
|
||||
isImported: Boolean,
|
||||
hasBackup: Boolean?,
|
||||
) : Basic(
|
||||
event = "Signed in",
|
||||
params = buildMap {
|
||||
put(AnalyticsParam.Key.CURRENCY, currency.value)
|
||||
put(AnalyticsParam.Key.BATCH, batch)
|
||||
put("Wallet Type", if (isImported) "Seed Phrase" else "Seedless")
|
||||
put("Sign in type", signInType.name)
|
||||
put("Wallets Count", walletsCount)
|
||||
if (hasBackup != null) {
|
||||
put("Backuped", if (hasBackup) "Yes" else "No")
|
||||
}
|
||||
},
|
||||
) {
|
||||
enum class SignInType {
|
||||
Card, Biometric
|
||||
}
|
||||
}
|
||||
), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks any sign-in into a wallet (card scan, FaceID, or wallet switch).
|
||||
* Counted as a single sign-in per session — subsequent card scans within the same session are ignored.
|
||||
*/
|
||||
class SignedIn(
|
||||
signInType: SignInType,
|
||||
signInType: AnalyticsParam.SignInType,
|
||||
walletsCount: Int,
|
||||
isImported: Boolean,
|
||||
hasBackup: Boolean?,
|
||||
isBackedUp: Boolean,
|
||||
) : Basic(
|
||||
event = "Signed in",
|
||||
params = buildMap {
|
||||
put("Sign in type", signInType.value)
|
||||
put("Wallets Count", walletsCount.toString())
|
||||
put("Wallet Type", if (isImported) "Seed Phrase" else "Seedless")
|
||||
if (hasBackup != null) {
|
||||
put("Backuped", if (hasBackup) "Yes" else "No")
|
||||
}
|
||||
put(AnalyticsParam.SIGN_IN_TYPE, signInType.value)
|
||||
put(AnalyticsParam.WALLETS_COUNT, walletsCount.toString())
|
||||
put(AnalyticsParam.WALLET_TYPE, if (isImported) "Seed Phrase" else "Seedless")
|
||||
put(AnalyticsParam.BACKUPED, if (isBackedUp) "Yes" else "No")
|
||||
},
|
||||
) {
|
||||
enum class SignInType(val value: String) {
|
||||
Card("Card"),
|
||||
Biometric("Biometric"),
|
||||
NoSecurity("No Security"),
|
||||
AccessCode("Access Code"),
|
||||
}
|
||||
), CriticalEvent, OneTimePerSessionEvent {
|
||||
override val oneTimeEventId: String = id
|
||||
}
|
||||
|
||||
class ButtonBuy(
|
||||
|
|
@ -68,39 +44,46 @@ sealed class Basic(
|
|||
) : Basic(
|
||||
event = "Button - Buy",
|
||||
params = buildMap {
|
||||
put(AnalyticsParam.Key.SOURCE, source.value)
|
||||
put(AnalyticsParam.SOURCE, source.value)
|
||||
},
|
||||
)
|
||||
|
||||
class ToppedUp(userWalletId: String, currency: AnalyticsParam.WalletType) :
|
||||
/**
|
||||
* Tracks the first time a user wallet is topped up. Sent once per wallet, when the balance
|
||||
* transitions from zero to positive (Total Balance for multi-currency wallets, or Balance for Note).
|
||||
* A wallet scanned with a non-zero balance does not count as a top-up — the event must be sent
|
||||
* only after all tokens have finished loading.
|
||||
*/
|
||||
class ToppedUp(userWalletId: String, walletType: AnalyticsParam.WalletType) :
|
||||
Basic(
|
||||
event = "Topped up",
|
||||
params = mapOf(AnalyticsParam.Key.CURRENCY to currency.value),
|
||||
params = mapOf(AnalyticsParam.CURRENCY to walletType.value),
|
||||
),
|
||||
OneTimeAnalyticsEvent {
|
||||
OneTimeAnalyticsEvent, AppsFlyerIncludedEvent, CriticalEvent {
|
||||
|
||||
override val oneTimeEventId: String = id + userWalletId
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks transaction submission from various screens (Send, Swap, WalletConnect, Sell, Approve, Staking).
|
||||
*/
|
||||
class TransactionSent(sentFrom: AnalyticsParam.TxSentFrom, memoType: MemoType) :
|
||||
Basic(
|
||||
event = "Transaction sent",
|
||||
params = buildMap {
|
||||
this[AnalyticsParam.Key.SOURCE] = sentFrom.value
|
||||
put(AnalyticsParam.SOURCE, sentFrom.value)
|
||||
if (sentFrom is AnalyticsParam.TxData) {
|
||||
this[AnalyticsParam.Key.BLOCKCHAIN] = sentFrom.blockchain
|
||||
this[AnalyticsParam.Key.TOKEN_PARAM] = sentFrom.token
|
||||
sentFrom.feeType?.value?.let {
|
||||
this[AnalyticsParam.Key.FEE_TYPE] = it
|
||||
}
|
||||
this[AnalyticsParam.Key.FEE_TOKEN] = sentFrom.feeToken
|
||||
put(AnalyticsParam.BLOCKCHAIN, sentFrom.blockchain)
|
||||
put(AnalyticsParam.TOKEN_PARAM, sentFrom.token)
|
||||
sentFrom.feeType?.value?.let { put(AnalyticsParam.FEE_TYPE, it) }
|
||||
put(AnalyticsParam.FEE_TOKEN, sentFrom.feeToken)
|
||||
}
|
||||
if (sentFrom is AnalyticsParam.TxSentFrom.Approve) {
|
||||
this[AnalyticsParam.Key.PERMISSION_TYPE] = sentFrom.permissionType
|
||||
put(AnalyticsParam.PERMISSION_TYPE, sentFrom.permissionType)
|
||||
}
|
||||
this["Memo"] = memoType.name
|
||||
put(AnalyticsParam.MEMO, memoType.name)
|
||||
},
|
||||
), AppsFlyerIncludedEvent {
|
||||
), AppsFlyerIncludedEvent, CriticalEvent {
|
||||
enum class MemoType {
|
||||
Empty, Full, Null
|
||||
}
|
||||
|
|
@ -110,31 +93,33 @@ sealed class Basic(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks the user invoking the "Request Support" email flow from various screens of the app.
|
||||
*/
|
||||
class ButtonSupport(source: AnalyticsParam.ScreensSources) : Basic(
|
||||
event = "Request Support",
|
||||
params = mapOf(
|
||||
AnalyticsParam.Key.SOURCE to source.value,
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks loading of the user's total balance after sign-in. Reports whether the balance is
|
||||
* empty, has funds, failed to load, or could not be returned because of a custom token.
|
||||
*/
|
||||
class BalanceLoaded(balance: AnalyticsParam.CardBalanceState, tokensCount: Int?) : Basic(
|
||||
event = "Balance Loaded",
|
||||
params = buildMap {
|
||||
put(AnalyticsParam.BALANCE, balance.value)
|
||||
tokensCount?.let { put(AnalyticsParam.TOKENS_COUNT, it.toString()) }
|
||||
},
|
||||
), AppsFlyerIncludedEvent, CriticalEvent
|
||||
|
||||
class TokenBalance(balance: AnalyticsParam.EmptyFull, token: String) : Basic(
|
||||
event = "Token Balance",
|
||||
params = mapOf(
|
||||
AnalyticsParam.STATE to balance.value,
|
||||
AnalyticsParam.TOKEN_PARAM to token,
|
||||
),
|
||||
)
|
||||
|
||||
class BiometryFailed(
|
||||
source: AnalyticsParam.ScreensSources,
|
||||
reason: BiometricFailReason,
|
||||
) : Basic(
|
||||
event = "Biometry Failed",
|
||||
params = mapOf(
|
||||
AnalyticsParam.Key.SOURCE to source.value,
|
||||
"Reason" to reason.value,
|
||||
),
|
||||
) {
|
||||
sealed class BiometricFailReason(val value: String) {
|
||||
data object AuthenticationLockout : BiometricFailReason("BiometricsAuthenticationLockout")
|
||||
data object AuthenticationLockoutPermanent : BiometricFailReason("BiometricsAuthenticationLockoutPermanent")
|
||||
data object BiometricsAuthenticationDisabled : BiometricFailReason("BiometricsAuthenticationDisabled")
|
||||
data object AllKeysInvalidated : BiometricFailReason("AllKeysInvalidated")
|
||||
data object AuthenticationCancelled : BiometricFailReason("AuthenticationCancelled")
|
||||
data object AuthenticationAlreadyInProgress : BiometricFailReason("AuthenticationAlreadyInProgress")
|
||||
data class Other(val reason: String) : BiometricFailReason(reason)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.tangem.core.analytics.models
|
||||
|
||||
/**
|
||||
* Marker interface for analytics events that require special attention.
|
||||
*
|
||||
* Implemented by events listed in the analytics specification (events.csv).
|
||||
*/
|
||||
interface CriticalEvent
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
package com.tangem.core.analytics.models.event
|
||||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
import com.tangem.core.analytics.models.AppsFlyerIncludedEvent
|
||||
import com.tangem.core.analytics.models.getReferralParams
|
||||
import com.tangem.core.analytics.models.*
|
||||
|
||||
sealed class OnboardingAnalyticsEvent(
|
||||
category: String,
|
||||
|
|
@ -16,23 +13,29 @@ sealed class OnboardingAnalyticsEvent(
|
|||
params: Map<String, String> = mapOf(),
|
||||
) : OnboardingAnalyticsEvent(category = "Onboarding", event = event, params = params) {
|
||||
|
||||
/**
|
||||
* Tracks the start of the onboarding process.
|
||||
*/
|
||||
class Started(
|
||||
source: String,
|
||||
source: AnalyticsParam.ScreensSources? = null,
|
||||
) : Onboarding(
|
||||
event = "Onboarding Started",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source,
|
||||
),
|
||||
)
|
||||
params = buildMap {
|
||||
source?.value?.let { put(AnalyticsParam.SOURCE, it) }
|
||||
},
|
||||
), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks the completion of the onboarding process.
|
||||
*/
|
||||
class Finished(
|
||||
source: String,
|
||||
source: AnalyticsParam.ScreensSources? = null,
|
||||
) : Onboarding(
|
||||
event = "Onboarding Finished",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source,
|
||||
),
|
||||
)
|
||||
params = buildMap {
|
||||
source?.value?.let { put(AnalyticsParam.SOURCE, it) }
|
||||
},
|
||||
), CriticalEvent
|
||||
|
||||
class ButtonMobileWallet(
|
||||
source: String,
|
||||
|
|
@ -49,31 +52,42 @@ sealed class OnboardingAnalyticsEvent(
|
|||
params: Map<String, String> = mapOf(),
|
||||
) : OnboardingAnalyticsEvent(category = "Onboarding / Create Wallet", event = event, params = params) {
|
||||
|
||||
class ButtonCreateWallet : CreateWallet("Button - Create Wallet")
|
||||
/**
|
||||
* Tracks opening of the create wallet screen.
|
||||
*/
|
||||
class ScreenOpened : CreateWallet("Create Wallet Screen Opened"), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks the user clicking the "Create Wallet" button.
|
||||
*/
|
||||
class ButtonCreateWallet : CreateWallet("Button - Create Wallet"), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks the user clicking the "Other Options" button on the create wallet screen.
|
||||
*/
|
||||
class ButtonOtherOptions : CreateWallet("Button - Other Options"), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks successful wallet creation, either on a Tangem card or as a mobile wallet.
|
||||
*/
|
||||
class WalletCreatedSuccessfully(
|
||||
source: String,
|
||||
creationType: WalletCreationType = WalletCreationType.NewSeed,
|
||||
creationType: AnalyticsParam.WalletCreationType = AnalyticsParam.WalletCreationType.PrivateKey,
|
||||
seedPhraseLength: Int? = null,
|
||||
passPhraseState: AnalyticsParam.EmptyFull,
|
||||
referralId: String?,
|
||||
source: AnalyticsParam.ScreensSources? = null,
|
||||
) : CreateWallet(
|
||||
event = "Wallet Created Successfully",
|
||||
params = buildMap {
|
||||
put(AnalyticsParam.SOURCE, source)
|
||||
put("Creation Type", creationType.value)
|
||||
put("Passphrase", passPhraseState.value)
|
||||
if (seedPhraseLength != null) {
|
||||
put("Seed Phrase Length", seedPhraseLength.toString())
|
||||
}
|
||||
source?.value?.let { put(AnalyticsParam.SOURCE, it) }
|
||||
putAll(getReferralParams(referralId))
|
||||
},
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
sealed class WalletCreationType(val value: String) {
|
||||
data object NewSeed : WalletCreationType(value = "New Seed")
|
||||
data object SeedImport : WalletCreationType(value = "Seed Import")
|
||||
}
|
||||
), AppsFlyerIncludedEvent, CriticalEvent
|
||||
}
|
||||
|
||||
sealed class SeedPhrase(
|
||||
|
|
@ -82,16 +96,19 @@ sealed class OnboardingAnalyticsEvent(
|
|||
) : OnboardingAnalyticsEvent(category = "Onboarding / Seed Phrase", event = event, params = params) {
|
||||
|
||||
class CreateMobileScreenOpened(
|
||||
source: String,
|
||||
source: AnalyticsParam.ScreensSources,
|
||||
) : SeedPhrase(
|
||||
event = "Create Mobile Screen Opened",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source,
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
class ButtonImportWallet : SeedPhrase("Button - Import Wallet")
|
||||
class ImportSeedPhraseScreenOpened : SeedPhrase("Import Seed Phrase Screen Opened")
|
||||
/**
|
||||
* Tracks opening of the seed phrase import screen.
|
||||
*/
|
||||
class ImportSeedPhraseScreenOpened : SeedPhrase("Import Seed Phrase Screen Opened"), CriticalEvent
|
||||
class ButtonImport : SeedPhrase("Button - Import")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,22 @@ package com.tangem.core.analytics.models.event
|
|||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
import com.tangem.core.analytics.models.CriticalEvent
|
||||
|
||||
sealed class SignIn(
|
||||
event: String,
|
||||
params: Map<String, String> = emptyMap(),
|
||||
) : AnalyticsEvent("Sign In", event, params) {
|
||||
) : AnalyticsEvent(category = "Sign In", event = event, params = params) {
|
||||
|
||||
data class ScreenOpened(
|
||||
val walletsCount: Int,
|
||||
) : SignIn(
|
||||
/**
|
||||
* Tracks the user landing on the app's sign-in screen when a saved card exists.
|
||||
*/
|
||||
class ScreenOpened(walletsCount: Int) : SignIn(
|
||||
event = "Sign In Screen Opened",
|
||||
params = mapOf(
|
||||
"Wallets Count" to walletsCount.toString(),
|
||||
AnalyticsParam.WALLETS_COUNT to walletsCount.toString(),
|
||||
),
|
||||
)
|
||||
), CriticalEvent
|
||||
|
||||
class ButtonBiometricSignIn : SignIn(event = "Button - Biometric Sign In")
|
||||
|
||||
|
|
@ -26,24 +28,17 @@ sealed class SignIn(
|
|||
) : SignIn(event = "Error - Biometric Updated")
|
||||
|
||||
class ButtonWallet(
|
||||
signInType: SignInType,
|
||||
signInType: AnalyticsParam.SignInType,
|
||||
walletsCount: Int,
|
||||
) : SignIn(
|
||||
event = "Button - Wallet",
|
||||
params = buildMap {
|
||||
put("Wallets Count", walletsCount.toString())
|
||||
put("Sign in type", signInType.value)
|
||||
put(AnalyticsParam.WALLETS_COUNT, walletsCount.toString())
|
||||
put(AnalyticsParam.SIGN_IN_TYPE, signInType.value)
|
||||
},
|
||||
) {
|
||||
enum class SignInType(val value: String) {
|
||||
Card("Card"),
|
||||
Biometric("Biometric"),
|
||||
NoSecurity("No Security"),
|
||||
AccessCode("Access Code"),
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
data class ButtonAddWallet(
|
||||
class ButtonAddWallet(
|
||||
val sources: AnalyticsParam.ScreensSources,
|
||||
) : SignIn(
|
||||
event = "Button - Add Wallet",
|
||||
|
|
|
|||
|
|
@ -66,5 +66,9 @@
|
|||
{
|
||||
"name": "ADDRESS_SYNC_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "SWAP_SWITCH_TO_TRANSFER_ENABLED",
|
||||
"version": "undefined"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ data class YieldDTO(
|
|||
data class PeriodDTO(
|
||||
@Json(name = "days")
|
||||
val days: Int?,
|
||||
@Json(name = "seconds")
|
||||
val seconds: Int?,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ sealed interface PaymentAccountStatusValueDM {
|
|||
data class DeactivatedAccount(
|
||||
@Json(name = "deactivated_account") val marker: Boolean = true,
|
||||
@Json(name = "fiat_balance") val fiatBalance: FiatBalanceDM,
|
||||
@Json(name = "crypto_balance") val cryptoBalance: CryptoBalanceDM,
|
||||
) : PaymentAccountStatusValueDM
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@
|
|||
<string name="dynamic_addresses_notification_funds_found_description">Foram encontrados fundos em endereços adicionais. Ative os Endereços Dinâmicos para acessá-los.</string>
|
||||
<string name="dynamic_addresses_notification_funds_found_title">Fundos encontrados em endereços adicionais</string>
|
||||
<string name="dynamic_addresses_receive_badge">Endereço dinâmico</string>
|
||||
<string name="dynamic_addresses_unavailability_reason_pending_transaction_send">O gerenciamento de endereços dinâmicos estará disponível assim que as transações pendentes estiverem na rede. %@ está completo</string>
|
||||
<string name="earn_best_opportunities">Melhores oportunidades</string>
|
||||
<string name="earn_clear_filter">Limpar filtro</string>
|
||||
<string name="earn_empty">A lista está temporariamente vazia, pois está sendo atualizada. Volte daqui a pouco.</string>
|
||||
|
|
@ -595,6 +596,7 @@
|
|||
<string name="express_provider_min_amount">Disponível em %s</string>
|
||||
<string name="express_provider_not_available">Indisponível para este par</string>
|
||||
<string name="express_provider_permission_needed">Permissão necessária</string>
|
||||
<string name="express_provider_permission_needed_v2">É necessária permissão.</string>
|
||||
<string name="express_provider_recommended">Recomendado</string>
|
||||
<string name="express_status_bought">Comprado %s</string>
|
||||
<string name="express_status_buying">Comprando %s</string>
|
||||
|
|
@ -641,6 +643,7 @@
|
|||
<string name="give_permission_staking_footer">A função Aprovar é necessária para conceder permissão a outro endereço para usar uma quantidade específica de seus tokens. Por definição, os contratos inteligentes não podem acessar seus tokens a menos que você aprove. Ao \"desbloquear\" seus tokens, você autoriza o contrato inteligente StakeKit a usá-los. Os mineradores da rede recebem uma taxa de gás (paga por você) para registrar essa ação no blockchain. Você pode fazer staking de seus tokens após conceder a aprovação.</string>
|
||||
<string name="give_permission_staking_subtitle">Para continuar, você precisa permitir que o contrato inteligente da Polygon use seus dados. %s</string>
|
||||
<string name="give_permission_swap_subtitle" formatted="false">Para continuar, conceda %1s permissão de contratos inteligentes para usar seu %2s</string>
|
||||
<string name="give_permission_swap_subtitle_v2">As corretoras descentralizadas exigem permissão para interagir com sua carteira. %1s</string>
|
||||
<string name="give_permission_title">Conceder permissão</string>
|
||||
<string name="give_permission_unlimited">Ilimitado</string>
|
||||
<string name="hardware_wallet_backup_feature_description">Os endereços são gerados diretamente na sua carteira de hardware Tangem — prontos para usar e totalmente protegidos.</string>
|
||||
|
|
@ -1115,6 +1118,14 @@
|
|||
<string name="onramp_error_transaction_already_processed">Esta transação já foi processada. Nenhuma ação adicional é necessária.</string>
|
||||
<string name="onramp_fetching_best_rates">Obtendo as melhores taxas...</string>
|
||||
<string name="onramp_instant_status">Instantâneo</string>
|
||||
<string name="onramp_kyc_verification_bullet_free">A verificação é gratuita e geralmente leva de 1 a 2 minutos.</string>
|
||||
<string name="onramp_kyc_verification_bullet_privacy">A Tangem não terá acesso às suas informações de identidade; você compartilha os dados diretamente com o provedor regulamentado.</string>
|
||||
<string name="onramp_kyc_verification_bullet_unlocks">A verificação desbloqueia o acesso total a transações futuras com este fornecedor.</string>
|
||||
<string name="onramp_kyc_verification_choose_another">Escolha outro método</string>
|
||||
<string name="onramp_kyc_verification_subtitle">Para cumprir os requisitos regulamentares locais %@ Requer verificação de identidade.</string>
|
||||
<string name="onramp_kyc_verification_title">Verificação de identidade exigida pelo provedor de pagamento</string>
|
||||
<string name="onramp_kyc_verification_verify_button">Verificar</string>
|
||||
<string name="onramp_kyc_verification_whats_important">O que é importante</string>
|
||||
<string name="onramp_legal">Ao utilizar a funcionalidade de acesso prioritário, você concorda com os termos do provedor. %1$s e %2$s</string>
|
||||
<string name="onramp_legal_text">O serviço é fornecido por um provedor externo. A Tangem não se responsabiliza por ele.</string>
|
||||
<string name="onramp_max_amount_restriction">O valor da compra não deve ser superior a %s</string>
|
||||
|
|
@ -1181,6 +1192,8 @@
|
|||
<string name="quick_action_buy_description">Cartão de crédito ou conta bancária</string>
|
||||
<string name="quick_action_receive_description">Compartilhe seu endereço ou código QR.</string>
|
||||
<string name="quick_action_swap_description">Entre seus portfólios</string>
|
||||
<string name="quick_top_up_chip_other">Outro</string>
|
||||
<string name="quick_top_up_title">Recarga rápida</string>
|
||||
<string name="receive_bottom_sheet_no_memo_required_message">Não é necessário memorando</string>
|
||||
<string name="receive_bottom_sheet_warning_message">%1$s (%2$s) sobre %3$s rede</string>
|
||||
<string name="receive_bottom_sheet_warning_message_compact">%1$s sobre %2$s rede</string>
|
||||
|
|
|
|||
|
|
@ -293,11 +293,13 @@
|
|||
<string name="common_delete">Удалить</string>
|
||||
<string name="common_disable">Отключить</string>
|
||||
<string name="common_disabled">Отключено</string>
|
||||
<string name="common_disabling">Выключение</string>
|
||||
<string name="common_disconnect">Отключить</string>
|
||||
<string name="common_done">Готово</string>
|
||||
<string name="common_edit">Изменить</string>
|
||||
<string name="common_enable">Включить</string>
|
||||
<string name="common_enabled">Включено</string>
|
||||
<string name="common_enabling">Включение</string>
|
||||
<string name="common_error">Ошибка</string>
|
||||
<string name="common_estimated_fee">Комиссия сети</string>
|
||||
<string name="common_exchange">Обменять</string>
|
||||
|
|
@ -324,6 +326,12 @@
|
|||
<string name="common_hide">Скрыть</string>
|
||||
<string name="common_hold_to">Удерживайте, чтобы %s</string>
|
||||
<string name="common_hour">час</string>
|
||||
<plurals name="common_hours">
|
||||
<item quantity="one">%d час</item>
|
||||
<item quantity="few">%d часa</item>
|
||||
<item quantity="many">%d часов</item>
|
||||
<item quantity="other">%d часа</item>
|
||||
</plurals>
|
||||
<plurals name="common_hours_time_ago">
|
||||
<item quantity="one">%dч назад</item>
|
||||
<item quantity="few">%dч назад</item>
|
||||
|
|
@ -347,6 +355,7 @@
|
|||
<item quantity="other">%dмин назад</item>
|
||||
</plurals>
|
||||
<string name="common_month">месяц</string>
|
||||
<string name="common_more">Еще</string>
|
||||
<string name="common_network_fee_title">Комиссия сети</string>
|
||||
<string name="common_network_fee_warning_content">Сумма отправки будет уменьшена на %1$s (%2$s) для покрытия выбранного уровня комиссии</string>
|
||||
<plurals name="common_networks_count">
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@
|
|||
<string name="common_access_denied">Access denied</string>
|
||||
<string name="common_account">Account</string>
|
||||
<string name="common_accounts">Accounts</string>
|
||||
<string name="common_action_failed">%s failed</string>
|
||||
<string name="common_activate">Activate</string>
|
||||
<string name="common_add">Add</string>
|
||||
<string name="common_add_funds">Add funds</string>
|
||||
|
|
@ -233,6 +234,8 @@
|
|||
<string name="common_apply">Apply</string>
|
||||
<string name="common_approval">Approval</string>
|
||||
<string name="common_approve">Approve</string>
|
||||
<string name="common_approved">Approved</string>
|
||||
<string name="common_approving">Approving</string>
|
||||
<string name="common_attention">Attention</string>
|
||||
<string name="common_available_networks">Available networks</string>
|
||||
<string name="common_backup">Backup</string>
|
||||
|
|
@ -315,6 +318,10 @@
|
|||
<string name="common_hide">Hide</string>
|
||||
<string name="common_hold_to">Hold to %s</string>
|
||||
<string name="common_hour">hour</string>
|
||||
<plurals name="common_hours">
|
||||
<item quantity="one">%d hour</item>
|
||||
<item quantity="other">%d hours</item>
|
||||
</plurals>
|
||||
<plurals name="common_hours_time_ago">
|
||||
<item quantity="one">%dh ago</item>
|
||||
<item quantity="other">%dh ago</item>
|
||||
|
|
@ -364,6 +371,8 @@
|
|||
<string name="common_range_with_space">%1$s — %2$s</string>
|
||||
<string name="common_read_more">Read more</string>
|
||||
<string name="common_receive">Receive</string>
|
||||
<string name="common_received">Received</string>
|
||||
<string name="common_receiving">Receiving</string>
|
||||
<string name="common_recommended">Recommended</string>
|
||||
<string name="common_reject">Reject</string>
|
||||
<string name="common_reload">Reload</string>
|
||||
|
|
@ -382,6 +391,8 @@
|
|||
<string name="common_send">Send</string>
|
||||
<string name="common_send_colon">Send:</string>
|
||||
<string name="common_send_tx_error">Failed to send transaction</string>
|
||||
<string name="common_sending">Sending</string>
|
||||
<string name="common_sent">Sent</string>
|
||||
<string name="common_server_unavailable">The server is not available, please try again later</string>
|
||||
<string name="common_share">Share</string>
|
||||
<string name="common_share_link">Share Link</string>
|
||||
|
|
@ -392,6 +403,7 @@
|
|||
<string name="common_skip">Skip</string>
|
||||
<string name="common_something_went_wrong">Something went wrong</string>
|
||||
<string name="common_stake">Stake</string>
|
||||
<string name="common_staked">Staked</string>
|
||||
<string name="common_staking">Staking</string>
|
||||
<string name="common_start">Start</string>
|
||||
<string name="common_submit">Submit</string>
|
||||
|
|
@ -399,6 +411,8 @@
|
|||
<string name="common_support">Support</string>
|
||||
<string name="common_supported_networks">Supported networks</string>
|
||||
<string name="common_swap">Swap</string>
|
||||
<string name="common_swapped">Swapped</string>
|
||||
<string name="common_swapping">Swapping</string>
|
||||
<string name="common_tangem">Tangem</string>
|
||||
<string name="common_tangem_wallet">Tangem Wallet</string>
|
||||
<string name="common_tap_and_hold_hint">Tap and hold</string>
|
||||
|
|
@ -416,6 +430,7 @@
|
|||
<string name="common_transaction_status">Transaction status</string>
|
||||
<string name="common_transactions">Transactions</string>
|
||||
<string name="common_transfer">Transfer</string>
|
||||
<string name="common_transferred">Transferred</string>
|
||||
<string name="common_unable_to_load">Unable to load data…</string>
|
||||
<string name="common_understand">I understand</string>
|
||||
<string name="common_understand_continue">I understand, continue</string>
|
||||
|
|
@ -425,10 +440,12 @@
|
|||
<string name="common_unstake">Unstake</string>
|
||||
<string name="common_utxo_validate_withdrawal_message_warning">Due to %1$s limitations only %2$d UTXOs can fit in a single transaction. This means you can only send %3$s or less. You need to reduce the amount.</string>
|
||||
<string name="common_value_copied">Value copied</string>
|
||||
<string name="common_voting">Voting</string>
|
||||
<string name="common_wallets">Wallets</string>
|
||||
<string name="common_warning">Warning</string>
|
||||
<string name="common_week">week</string>
|
||||
<string name="common_with">with</string>
|
||||
<string name="common_withdrawing">Withdrawing</string>
|
||||
<string name="common_yes">Yes</string>
|
||||
<string name="common_yield_mode">Yield Mode</string>
|
||||
<string name="contract_address_copied_message">Contract address copied!</string>
|
||||
|
|
@ -590,12 +607,14 @@
|
|||
<string name="express_provider_best_rate">Best rate</string>
|
||||
<string name="express_provider_fca_warning_list">FCA Warning List</string>
|
||||
<string name="express_provider_fixed_rate_is_unavailable">Fixed rate is unavailable</string>
|
||||
<string name="express_provider_for_swap">Provider for swap</string>
|
||||
<string name="express_provider_great_rate">Competitive rate</string>
|
||||
<string name="express_provider_in_fca_warning_list">Provider in FCA warning list</string>
|
||||
<string name="express_provider_max_amount">Available up to %s</string>
|
||||
<string name="express_provider_min_amount">Available from %s</string>
|
||||
<string name="express_provider_not_available">Unavailable for this pair</string>
|
||||
<string name="express_provider_permission_needed">Permission Required</string>
|
||||
<string name="express_provider_permission_needed_v2">Permission needed</string>
|
||||
<string name="express_provider_recommended">Recommended</string>
|
||||
<string name="express_status_bought">Bought %s</string>
|
||||
<string name="express_status_buying">Buying %s</string>
|
||||
|
|
@ -643,6 +662,7 @@
|
|||
<string name="give_permission_staking_footer">The Approve function is needed to grant permission to another address to use a specific amount of your tokens. By design, smart contracts can\'t access your tokens unless you approve. By \"unlocking\" your tokens, you authorize the StakeKit smart contract to use them. The network\'s miners receive a gas fee (paid by you) to record this action on the blockchain. You can stake your token after giving approval.</string>
|
||||
<string name="give_permission_staking_subtitle">To continue you need to allow Polygon smart contract to use your %s</string>
|
||||
<string name="give_permission_swap_subtitle" formatted="false">To continue, grant %1s smart contracts permission to use your %2s</string>
|
||||
<string name="give_permission_swap_subtitle_v2">Decentralized exchanges require permission to interact with your wallet. %1s</string>
|
||||
<string name="give_permission_title">Give Permission</string>
|
||||
<string name="give_permission_unlimited">Unlimited</string>
|
||||
<string name="hardware_wallet_backup_feature_description">Addresses are generated directly on your Tangem hardware wallet — ready to use and fully protected.</string>
|
||||
|
|
@ -670,6 +690,8 @@
|
|||
<string name="hw_backup_banner_description">Keeps your crypto safe and offline. Slim as a credit card, safer than a bank vault.</string>
|
||||
<string name="hw_backup_close_description">If you do, you\'ll need to start over.</string>
|
||||
<string name="hw_backup_google_drive_description">Recover existing wallet via Google Drive backup</string>
|
||||
<string name="hw_backup_google_drive_dialog_message">We\'re working on Google Drive backup to make wallet recovery even easier.</string>
|
||||
<string name="hw_backup_google_drive_dialog_title">Google Drive backup is coming soon</string>
|
||||
<string name="hw_backup_google_drive_title">Google Drive backup</string>
|
||||
<string name="hw_backup_hardware_create_description">Create a secure wallet and transfer your funds for extra protection.</string>
|
||||
<string name="hw_backup_hardware_create_title">Create new wallet</string>
|
||||
|
|
@ -1330,6 +1352,8 @@
|
|||
<string name="send_notification_invalid_reserve_amount_text">Target account is not created. Please change the amount to send.</string>
|
||||
<string name="send_notification_invalid_reserve_amount_title">The amount to send must be at least %s</string>
|
||||
<string name="send_notification_leave_button">Leave %s</string>
|
||||
<string name="send_notification_no_trustline_text">A trustline for %s is required first.</string>
|
||||
<string name="send_notification_no_trustline_title">Can\'t receive token</string>
|
||||
<string name="send_notification_reduce_by">Reduce by %s</string>
|
||||
<string name="send_notification_reduce_to">Reduce to %s</string>
|
||||
<string name="send_notification_transaction_delay_text">Kindly be aware that your transaction may experience delays under specific fee settings</string>
|
||||
|
|
@ -1817,12 +1841,21 @@
|
|||
<string name="tokens_list_unavailable_to_sell_header">Unavailable to sell</string>
|
||||
<string name="tokens_list_unavailable_to_swap_header">Unavailable for swap from %s</string>
|
||||
<string name="tokens_list_unavailable_to_swap_source_header">Unavailable for swap</string>
|
||||
<string name="transaction_history_claiming_reward">Claiming reward</string>
|
||||
<string name="transaction_history_contract_address">contract: %s</string>
|
||||
<string name="transaction_history_disabling_yield_mode">Disabling Yield mode</string>
|
||||
<string name="transaction_history_earned_from_stake">Earned from stake</string>
|
||||
<string name="transaction_history_empty_transactions">You don\'t have any transactions yet</string>
|
||||
<string name="transaction_history_error_failed_to_load">Failed to load transaction history.\nClick on reload button to update the information.</string>
|
||||
<string name="transaction_history_from_inline_address">from: %%image%% %s</string>
|
||||
<string name="transaction_history_multiple_addresses">Multiple addresses</string>
|
||||
<string name="transaction_history_not_supported_description">Transaction history is currently not supported for this blockchain. But don\'t worry, we\'re working on it! In the meantime you can check it in the explorer.</string>
|
||||
<string name="transaction_history_operation">Operation</string>
|
||||
<string name="transaction_history_pending">Pending</string>
|
||||
<string name="transaction_history_rewards_restaked">Rewards restaked</string>
|
||||
<string name="transaction_history_rewards_restaking">Rewards restaking</string>
|
||||
<string name="transaction_history_staking_reward">Staking reward</string>
|
||||
<string name="transaction_history_to_inline_address">to: %%image%% %s</string>
|
||||
<string name="transaction_history_transaction_for_address">for: %s</string>
|
||||
<string name="transaction_history_transaction_from_address">from: %s</string>
|
||||
<string name="transaction_history_transaction_to_address">to: %s</string>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ abstract class VerifyDesignTokensTask : DefaultTask() {
|
|||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
abstract val tokensDir: DirectoryProperty
|
||||
|
||||
@get:InputDirectory
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
abstract val iconsDir: DirectoryProperty
|
||||
|
||||
@get:InputFile
|
||||
@get:PathSensitive(PathSensitivity.NONE)
|
||||
abstract val hashFile: RegularFileProperty
|
||||
|
|
@ -37,21 +41,21 @@ abstract class VerifyDesignTokensTask : DefaultTask() {
|
|||
"Run: git submodule update --init --recursive"
|
||||
}
|
||||
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
val jsonFiles = tokensDirValue.walkTopDown()
|
||||
.filter { it.isFile && it.extension == "json" }
|
||||
.sortedBy { it.relativeTo(tokensDirValue).path }
|
||||
.toList()
|
||||
|
||||
val nul = byteArrayOf(0)
|
||||
for (file in jsonFiles) {
|
||||
digest.update(file.relativeTo(tokensDirValue).invariantSeparatorsPath.toByteArray())
|
||||
digest.update(nul)
|
||||
digest.update(file.readBytes())
|
||||
digest.update(nul)
|
||||
val iconsDirValue = iconsDir.get().asFile
|
||||
require(iconsDirValue.exists() && iconsDirValue.isDirectory) {
|
||||
"ds-tokens icons folder not found: ${iconsDirValue.absolutePath}\n" +
|
||||
"Run: git submodule update --init --recursive"
|
||||
}
|
||||
|
||||
val actual = digest.digest()
|
||||
val tokensInputHash = hashTreeHex(tokensDirValue, "json")
|
||||
val iconsHash = hashTreeHex(iconsDirValue, "svg")
|
||||
|
||||
// Mirror build-tokens.mjs: sha256(tokensInputHash + 0x00 + iconsHash), all hex strings.
|
||||
val outer = MessageDigest.getInstance("SHA-256")
|
||||
outer.update(tokensInputHash.toByteArray())
|
||||
outer.update(0)
|
||||
outer.update(iconsHash.toByteArray())
|
||||
val actual = outer.digest()
|
||||
.joinToString("") { b: Byte -> b.toInt().and(0xFF).toString(16).padStart(2, '0') }
|
||||
val expected = hashFileValue.readText().trim()
|
||||
|
||||
|
|
@ -64,6 +68,23 @@ abstract class VerifyDesignTokensTask : DefaultTask() {
|
|||
|
||||
stampFile.get().asFile.writeText(actual)
|
||||
}
|
||||
|
||||
private fun hashTreeHex(root: java.io.File, extension: String): String {
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
val files = root.walkTopDown()
|
||||
.filter { it.isFile && it.extension == extension }
|
||||
.sortedBy { it.relativeTo(root).invariantSeparatorsPath }
|
||||
.toList()
|
||||
val nul = byteArrayOf(0)
|
||||
for (file in files) {
|
||||
digest.update(file.relativeTo(root).invariantSeparatorsPath.toByteArray())
|
||||
digest.update(nul)
|
||||
digest.update(file.readBytes())
|
||||
digest.update(nul)
|
||||
}
|
||||
return digest.digest()
|
||||
.joinToString("") { b: Byte -> b.toInt().and(0xFF).toString(16).padStart(2, '0') }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
|
|
@ -83,6 +104,7 @@ android {
|
|||
|
||||
val verifyDesignTokens = tasks.register<VerifyDesignTokensTask>("verifyDesignTokens") {
|
||||
tokensDir.set(file("ds-tokens/tokens"))
|
||||
iconsDir.set(file("ds-tokens/icons"))
|
||||
hashFile.set(file("src/main/java/com/tangem/core/ui/res/generated/.tokens-hash"))
|
||||
stampFile.set(layout.buildDirectory.file("tokens-verified.stamp"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ enum class AccountIconSize {
|
|||
@Composable
|
||||
fun AccountResIcon(@DrawableRes resId: Int, color: Color, size: AccountIconSize, modifier: Modifier = Modifier) {
|
||||
val boxSize by animateDpAsState(
|
||||
targetValue = size.boxSizeInDp(),
|
||||
targetValue = size.toBoxSize(),
|
||||
animationSpec = animation(),
|
||||
)
|
||||
val boxShapeCornerSize by animateDpAsState(
|
||||
|
|
@ -84,7 +84,7 @@ fun AccountResIcon(@DrawableRes resId: Int, color: Color, size: AccountIconSize,
|
|||
@Composable
|
||||
fun PaymentAccountIcon(size: AccountIconSize, modifier: Modifier = Modifier) {
|
||||
val boxSize by animateDpAsState(
|
||||
targetValue = size.boxSizeInDp(),
|
||||
targetValue = size.toBoxSize(),
|
||||
animationSpec = animation(),
|
||||
)
|
||||
val boxShapeCornerSize by animateDpAsState(
|
||||
|
|
@ -115,7 +115,7 @@ fun PaymentAccountIcon(size: AccountIconSize, modifier: Modifier = Modifier) {
|
|||
@Composable
|
||||
fun AccountCharIcon(char: Char, color: Color, size: AccountIconSize, modifier: Modifier = Modifier) {
|
||||
val boxSize by animateDpAsState(
|
||||
size.boxSizeInDp(),
|
||||
size.toBoxSize(),
|
||||
animationSpec = animation(),
|
||||
)
|
||||
val boxShapeCornerSize by animateDpAsState(
|
||||
|
|
@ -163,7 +163,7 @@ private fun AccountIconSize.iconSizeInDp(): Dp = when (this) {
|
|||
AccountIconSize.RedesignedDefault -> 20.dp
|
||||
}
|
||||
|
||||
private fun AccountIconSize.boxSizeInDp(): Dp = when (this) {
|
||||
fun AccountIconSize.toBoxSize(): Dp = when (this) {
|
||||
AccountIconSize.Default -> 36.dp
|
||||
AccountIconSize.Large -> 88.dp
|
||||
AccountIconSize.Medium -> 28.dp
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.tangem.core.ui.components.bottomsheets.modal
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.LocalOverscrollFactory
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
|
|
@ -13,13 +12,18 @@ import androidx.compose.runtime.*
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.Velocity
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.PrimaryButton
|
||||
|
|
@ -31,6 +35,7 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
|||
import com.tangem.core.ui.components.bottomsheets.internal.ModalBottomSheetWithBackHandling
|
||||
import com.tangem.core.ui.components.bottomsheets.internal.collapse
|
||||
import com.tangem.core.ui.res.LocalBottomSheetAlwaysVisible
|
||||
import com.tangem.core.ui.res.LocalCanScrollBackward
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.utils.WindowInsetsZero
|
||||
|
|
@ -111,17 +116,13 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultModalBottomSheet(
|
|||
sheetState = sheetState,
|
||||
onBack = onBack,
|
||||
bsContent = {
|
||||
CompositionLocalProvider(
|
||||
LocalOverscrollFactory provides null,
|
||||
) {
|
||||
BsContent(
|
||||
config = config,
|
||||
containerColor = containerColor,
|
||||
scrollableContent = scrollableContent,
|
||||
title = title,
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
BsContent(
|
||||
config = config,
|
||||
containerColor = containerColor,
|
||||
scrollableContent = scrollableContent,
|
||||
title = title,
|
||||
content = content,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -178,6 +179,18 @@ inline fun <reified T : TangemBottomSheetConfigContent> BsContent(
|
|||
|
||||
val maxHeight = LocalConfiguration.current.screenHeightDp * MODAL_SHEET_MAX_HEIGHT
|
||||
|
||||
val canScrollBackward = LocalCanScrollBackward.current
|
||||
|
||||
val nestedScrollConnection = remember(canScrollBackward) {
|
||||
object : NestedScrollConnection {
|
||||
override fun onPostScroll(consumed: Offset, available: Offset, source: NestedScrollSource): Offset =
|
||||
if (canScrollBackward) available else Offset.Zero
|
||||
|
||||
override suspend fun onPostFling(consumed: Velocity, available: Velocity): Velocity =
|
||||
if (canScrollBackward) available else Velocity.Zero
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.systemBarsPadding()
|
||||
|
|
@ -185,7 +198,8 @@ inline fun <reified T : TangemBottomSheetConfigContent> BsContent(
|
|||
.clip(TangemTheme.shapes.roundedCornersLarge)
|
||||
.background(containerColor)
|
||||
.heightIn(max = maxHeight.dp)
|
||||
.fillMaxWidth(),
|
||||
.fillMaxWidth()
|
||||
.nestedScroll(nestedScrollConnection),
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxWidth()) {
|
||||
title(model)
|
||||
|
|
|
|||
|
|
@ -19,10 +19,49 @@ import androidx.compose.ui.unit.Dp
|
|||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.components.CircleShimmer
|
||||
import com.tangem.core.ui.extensions.conditional
|
||||
import com.tangem.core.ui.res.LocalRedesignEnabled
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||
import com.tangem.core.ui.utils.getGreyScaleColorFilter
|
||||
|
||||
/**
|
||||
* Cryptocurrency icon driven entirely by the supplied [modifier]: the icon and the network badge
|
||||
* lay out within the size set by the modifier — !!!no fixed icon/badge size params!!!.
|
||||
* Use the more configurable [CurrencyIcon] when custom sizing is required.
|
||||
*/
|
||||
@Composable
|
||||
fun TangemCurrencyIcon(state: CurrencyIconState, modifier: Modifier = Modifier, shouldDisplayNetwork: Boolean = true) {
|
||||
Box(modifier = modifier) {
|
||||
val iconModifier = Modifier.matchParentSize()
|
||||
|
||||
when (state) {
|
||||
is CurrencyIconState.Loading -> LoadingIcon(modifier = iconModifier)
|
||||
is CurrencyIconState.Locked -> LockedIcon(modifier = iconModifier)
|
||||
is CurrencyIconState.Empty -> EmptyIcon(resId = state.resId, modifier = iconModifier)
|
||||
is CurrencyIconState.CoinIcon,
|
||||
is CurrencyIconState.FiatIcon,
|
||||
is CurrencyIconState.CustomTokenIcon,
|
||||
is CurrencyIconState.TokenIcon,
|
||||
is CurrencyIconState.PaymentAccount,
|
||||
is CurrencyIconState.CryptoPortfolio.Icon,
|
||||
is CurrencyIconState.CryptoPortfolio.Letter,
|
||||
-> {
|
||||
ContentIconContainer(
|
||||
icon = state,
|
||||
modifier = iconModifier,
|
||||
shouldShowTopBadge = shouldDisplayNetwork,
|
||||
networkBadgeSize = 14.dp,
|
||||
networkBadgeBackground = if (LocalRedesignEnabled.current) {
|
||||
TangemTheme.colors2.surface.level1
|
||||
} else {
|
||||
TangemTheme.colors.background.primary
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cryptocurrency icon with network badge
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import androidx.compose.ui.res.vectorResource
|
|||
import coil.compose.SubcomposeAsyncImage
|
||||
import coil.request.ImageRequest
|
||||
import com.tangem.core.ui.components.CircleShimmer
|
||||
import com.tangem.core.ui.components.currency.icon.CurrencyIcon
|
||||
import com.tangem.core.ui.components.currency.icon.CurrencyIconState
|
||||
import com.tangem.core.ui.components.currency.icon.TangemCurrencyIcon
|
||||
import com.tangem.core.ui.components.icons.identicon.IdentIcon
|
||||
import com.tangem.core.ui.extensions.ColorReference2
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
|
@ -69,7 +69,7 @@ sealed interface TangemIconUM {
|
|||
fun TangemIcon(tangemIconUM: TangemIconUM, modifier: Modifier = Modifier) {
|
||||
when (tangemIconUM) {
|
||||
is TangemIconUM.Currency -> {
|
||||
CurrencyIcon(
|
||||
TangemCurrencyIcon(
|
||||
state = tangemIconUM.currencyIconState,
|
||||
modifier = modifier,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -472,6 +472,8 @@ val LocalMessageEffectAnimation = compositionLocalOf<MessageEffectAnimation> {
|
|||
error("No MessageEffectAnimation provided")
|
||||
}
|
||||
|
||||
val LocalCanScrollBackward = compositionLocalOf { false }
|
||||
|
||||
/**
|
||||
* Determines whether the dark theme should be used based on the given [AppThemeMode].
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
84387e888f54e5056380c38e077962bdfa4a32cfca194d822c13aa7e35661968
|
||||
b32332414db19b8a3e4a62ac2ce1dffcddb8d9e2394053dd2af55a0ce81464eb
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
4d82cc51cdc43627423b9cd186c61fda845cb0773f1d4e272249c777b8555aa1
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_down_12: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_down_12: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_down_12 != null) return _ic_arrow_down_12!!
|
||||
_ic_arrow_down_12 = ImageVector.Builder(
|
||||
name = "ic_arrow_down_12",
|
||||
defaultWidth = 12.dp,
|
||||
defaultHeight = 12.dp,
|
||||
viewportWidth = 12f,
|
||||
viewportHeight = 12f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M5.5 2L5.5 9.04297L2.35352 5.89648C2.15825 5.70122 1.84175 5.70122 1.64649 5.89648C1.45122 6.09175 1.45122 6.40825 1.64649 6.60352L5.64648 10.6035L5.72266 10.666C5.80419 10.7204 5.90056 10.75 6 10.75C6.13261 10.75 6.25975 10.6973 6.35352 10.6035L10.3535 6.60352C10.5488 6.40826 10.5488 6.09175 10.3535 5.89649C10.1583 5.70122 9.84175 5.70122 9.64649 5.89649L6.5 9.04297L6.5 2C6.5 1.72386 6.27614 1.5 6 1.5C5.72386 1.5 5.5 1.72386 5.5 2Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_down_12!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowDown12Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_down_12,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_down_16: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_down_16: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_down_16 != null) return _ic_arrow_down_16!!
|
||||
_ic_arrow_down_16 = ImageVector.Builder(
|
||||
name = "ic_arrow_down_16",
|
||||
defaultWidth = 16.dp,
|
||||
defaultHeight = 16.dp,
|
||||
viewportWidth = 16f,
|
||||
viewportHeight = 16f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M7.4997 2.66669L7.4997 12.4597L3.02021 7.98016C2.82494 7.7849 2.50844 7.7849 2.31318 7.98016C2.11808 8.17544 2.11797 8.49199 2.31318 8.68719L7.64618 14.0202C7.73987 14.1139 7.86721 14.1666 7.9997 14.1667C8.13223 14.1667 8.25946 14.1139 8.35321 14.0202L13.6872 8.6872C13.8824 8.49204 13.8821 8.17545 13.6872 7.98017C13.4919 7.7849 13.1754 7.7849 12.9802 7.98017L8.4997 12.4606L8.4997 2.66669C8.4997 2.39055 8.27584 2.16669 7.9997 2.16669C7.72371 2.16686 7.4997 2.39065 7.4997 2.66669Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_down_16!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowDown16Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_down_16,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_down_20: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_down_20: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_down_20 != null) return _ic_arrow_down_20!!
|
||||
_ic_arrow_down_20 = ImageVector.Builder(
|
||||
name = "ic_arrow_down_20",
|
||||
defaultWidth = 20.dp,
|
||||
defaultHeight = 20.dp,
|
||||
viewportWidth = 20f,
|
||||
viewportHeight = 20f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M9.25031 3.33331L9.2503 15.2728L3.86359 9.88605C3.57073 9.59337 3.09589 9.59337 2.80304 9.88605C2.5102 10.1789 2.51031 10.6537 2.80304 10.9466L9.47003 17.6136L9.58429 17.7073C9.70654 17.7888 9.85124 17.8333 10.0003 17.8333C10.1991 17.8332 10.39 17.7542 10.5306 17.6136L17.1966 10.9466C17.4895 10.6537 17.4895 10.1789 17.1966 9.88605C16.9037 9.59348 16.4288 9.59326 16.136 9.88605L10.7503 15.2728L10.7503 3.33331C10.7503 2.91921 10.4144 2.58349 10.0003 2.58331C9.58609 2.58331 9.25031 2.9191 9.25031 3.33331Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_down_20!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowDown20Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_down_20,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_down_24: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_down_24: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_down_24 != null) return _ic_arrow_down_24!!
|
||||
_ic_arrow_down_24 = ImageVector.Builder(
|
||||
name = "ic_arrow_down_24",
|
||||
defaultWidth = 24.dp,
|
||||
defaultHeight = 24.dp,
|
||||
viewportWidth = 24f,
|
||||
viewportHeight = 24f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M11 4L11 18.0859L4.70703 11.793C4.31651 11.4024 3.6835 11.4024 3.29297 11.793C2.90245 12.1835 2.90245 12.8165 3.29297 13.207L11.293 21.207L11.3662 21.2734C11.5442 21.4193 11.7679 21.5 12 21.5C12.2652 21.5 12.5195 21.3946 12.707 21.207L20.707 13.207C21.0976 12.8165 21.0976 12.1835 20.707 11.793C20.3165 11.4024 19.6835 11.4024 19.293 11.793L13 18.0859L13 4C13 3.44772 12.5523 3 12 3C11.4477 3 11 3.44772 11 4Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_down_24!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowDown24Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_down_24,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_down_28: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_down_28: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_down_28 != null) return _ic_arrow_down_28!!
|
||||
_ic_arrow_down_28 = ImageVector.Builder(
|
||||
name = "ic_arrow_down_28",
|
||||
defaultWidth = 28.dp,
|
||||
defaultHeight = 28.dp,
|
||||
viewportWidth = 28f,
|
||||
viewportHeight = 28f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M12.7496 4.66669L12.7496 20.8991L5.55042 13.6999C5.06226 13.2117 4.27099 13.2117 3.78284 13.6999C3.29485 14.1881 3.29474 14.9794 3.78284 15.4675L13.1158 24.8005C13.3502 25.0348 13.6682 25.1666 13.9996 25.1667C14.3311 25.1667 14.649 25.0348 14.8834 24.8005L24.2174 15.4675C24.7055 14.9794 24.7052 14.1881 24.2174 13.6999C23.7293 13.2117 22.938 13.2117 22.4498 13.6999L15.2496 20.9001L15.2496 4.66669C15.2496 3.97633 14.69 3.41669 13.9996 3.41669C13.3094 3.41686 12.7496 3.97644 12.7496 4.66669Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_down_28!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowDown28Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_down_28,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_down_32: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_down_32: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_down_32 != null) return _ic_arrow_down_32!!
|
||||
_ic_arrow_down_32 = ImageVector.Builder(
|
||||
name = "ic_arrow_down_32",
|
||||
defaultWidth = 32.dp,
|
||||
defaultHeight = 32.dp,
|
||||
viewportWidth = 32f,
|
||||
viewportHeight = 32f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M14.5003 5.33331L14.5003 23.7122L6.39387 15.6058C5.80812 15.0202 4.85852 15.0202 4.27277 15.6058C3.68704 16.1915 3.68715 17.1411 4.27277 17.7269L14.9398 28.3939L15.0491 28.4935C15.3161 28.7123 15.6521 28.8333 16.0003 28.8333C16.398 28.8332 16.7796 28.6751 17.0609 28.3939L27.7269 17.7269C28.3127 17.1411 28.3127 16.1916 27.7269 15.6058C27.1411 15.0203 26.1915 15.0201 25.6058 15.6058L17.5003 23.7122L17.5003 5.33332C17.5003 4.505 16.8286 3.83349 16.0003 3.83332C15.1719 3.83331 14.5003 4.50489 14.5003 5.33331Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_down_32!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowDown32Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_down_32,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_up_12: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_up_12: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_up_12 != null) return _ic_arrow_up_12!!
|
||||
_ic_arrow_up_12 = ImageVector.Builder(
|
||||
name = "ic_arrow_up_12",
|
||||
defaultWidth = 12.dp,
|
||||
defaultHeight = 12.dp,
|
||||
viewportWidth = 12f,
|
||||
viewportHeight = 12f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M5.5 10.25C5.5 10.5261 5.72386 10.75 6 10.75C6.27614 10.75 6.5 10.5261 6.5 10.25V3.20703L9.64648 6.35352C9.84175 6.54878 10.1583 6.54878 10.3535 6.35352C10.5488 6.15825 10.5488 5.84175 10.3535 5.64648L6.35352 1.64648C6.15825 1.45122 5.84175 1.45122 5.64648 1.64648L1.64648 5.64648C1.45122 5.84175 1.45122 6.15825 1.64648 6.35352C1.84175 6.54878 2.15825 6.54878 2.35352 6.35352L5.5 3.20703V10.25Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_up_12!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowUp12Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_up_12,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_up_16: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_up_16: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_up_16 != null) return _ic_arrow_up_16!!
|
||||
_ic_arrow_up_16 = ImageVector.Builder(
|
||||
name = "ic_arrow_up_16",
|
||||
defaultWidth = 16.dp,
|
||||
defaultHeight = 16.dp,
|
||||
viewportWidth = 16f,
|
||||
viewportHeight = 16f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M7.49966 13.6667C7.49966 13.9427 7.72367 14.1665 7.99966 14.1667C8.27581 14.1667 8.49966 13.9428 8.49966 13.6667V3.87372L12.9801 8.35321C13.1754 8.54847 13.4919 8.54847 13.6872 8.35321C13.8821 8.15792 13.8823 7.84133 13.6872 7.64618L8.35318 2.31317C8.1579 2.11807 7.84136 2.11796 7.64615 2.31317L2.31314 7.64618C2.11793 7.84139 2.11804 8.15793 2.31314 8.35321C2.5084 8.54847 2.82491 8.54847 3.02017 8.35321L7.49966 3.87372V13.6667Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_up_16!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowUp16Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_up_16,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_up_20: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_up_20: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_up_20 != null) return _ic_arrow_up_20!!
|
||||
_ic_arrow_up_20 = ImageVector.Builder(
|
||||
name = "ic_arrow_up_20",
|
||||
defaultWidth = 20.dp,
|
||||
defaultHeight = 20.dp,
|
||||
viewportWidth = 20f,
|
||||
viewportHeight = 20f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M9.25034 17.0833C9.25034 17.4975 9.58612 17.8333 10.0003 17.8333C10.4144 17.8331 10.7503 17.4974 10.7503 17.0833V5.14484L16.1361 10.5306C16.4289 10.8234 16.9037 10.8231 17.1966 10.5306C17.4895 10.2377 17.4895 9.76293 17.1966 9.47003L10.5306 2.80304C10.2378 2.5102 9.76297 2.51031 9.47006 2.80304L2.80307 9.47003C2.51034 9.76294 2.51023 10.2377 2.80307 10.5306C3.09592 10.8233 3.57076 10.8233 3.86362 10.5306L9.25034 5.14386V17.0833Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_up_20!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowUp20Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_up_20,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_up_24: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_up_24: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_up_24 != null) return _ic_arrow_up_24!!
|
||||
_ic_arrow_up_24 = ImageVector.Builder(
|
||||
name = "ic_arrow_up_24",
|
||||
defaultWidth = 24.dp,
|
||||
defaultHeight = 24.dp,
|
||||
viewportWidth = 24f,
|
||||
viewportHeight = 24f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M11 20.5C11 21.0523 11.4477 21.5 12 21.5C12.5523 21.5 13 21.0523 13 20.5V6.41406L19.293 12.707C19.6835 13.0976 20.3165 13.0976 20.707 12.707C21.0976 12.3165 21.0976 11.6835 20.707 11.293L12.707 3.29297C12.3165 2.90244 11.6835 2.90244 11.293 3.29297L3.29297 11.293C2.90245 11.6835 2.90245 12.3165 3.29297 12.707C3.68349 13.0976 4.31651 13.0976 4.70703 12.707L11 6.41406V20.5Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_up_24!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowUp24Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_up_24,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_up_28: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_up_28: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_up_28 != null) return _ic_arrow_up_28!!
|
||||
_ic_arrow_up_28 = ImageVector.Builder(
|
||||
name = "ic_arrow_up_28",
|
||||
defaultWidth = 28.dp,
|
||||
defaultHeight = 28.dp,
|
||||
viewportWidth = 28f,
|
||||
viewportHeight = 28f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M12.7497 23.9167C12.7497 24.6069 13.3095 25.1665 13.9997 25.1667C14.69 25.1667 15.2497 24.607 15.2497 23.9167V7.68427L22.4499 14.8835C22.938 15.3716 23.7293 15.3716 24.2174 14.8835C24.7053 14.3953 24.7055 13.604 24.2174 13.1159L14.8835 3.7829C14.3953 3.29491 13.604 3.2948 13.1159 3.7829L3.78287 13.1159C3.29477 13.604 3.29487 14.3953 3.78287 14.8835C4.27102 15.3716 5.06229 15.3716 5.55045 14.8835L12.7497 7.68427V23.9167Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_up_28!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowUp28Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_up_28,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_arrow_up_32: ImageVector? = null
|
||||
|
||||
val Icons.ic_arrow_up_32: ImageVector
|
||||
get() {
|
||||
if (_ic_arrow_up_32 != null) return _ic_arrow_up_32!!
|
||||
_ic_arrow_up_32 = ImageVector.Builder(
|
||||
name = "ic_arrow_up_32",
|
||||
defaultWidth = 32.dp,
|
||||
defaultHeight = 32.dp,
|
||||
viewportWidth = 32f,
|
||||
viewportHeight = 32f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M14.5003 27.3333C14.5003 28.1617 15.1719 28.8333 16.0003 28.8333C16.8286 28.8331 17.5003 28.1616 17.5003 27.3333V8.95538L25.6058 17.0609C26.1915 17.6465 27.1411 17.6463 27.7269 17.0609C28.3127 16.4751 28.3127 15.5255 27.7269 14.9398L17.0609 4.27277C16.4752 3.68703 15.5256 3.68714 14.9398 4.27277L4.2728 14.9398C3.68717 15.5256 3.68706 16.4751 4.2728 17.0609C4.85854 17.6464 5.80815 17.6464 6.39389 17.0609L14.5003 8.95441V27.3333Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_arrow_up_32!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcArrowUp32Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_arrow_up_32,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_sign_equal_12: ImageVector? = null
|
||||
|
||||
val Icons.ic_sign_equal_12: ImageVector
|
||||
get() {
|
||||
if (_ic_sign_equal_12 != null) return _ic_sign_equal_12!!
|
||||
_ic_sign_equal_12 = ImageVector.Builder(
|
||||
name = "ic_sign_equal_12",
|
||||
defaultWidth = 12.dp,
|
||||
defaultHeight = 12.dp,
|
||||
viewportWidth = 12f,
|
||||
viewportHeight = 12f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M9.5 7.5C9.77614 7.5 10 7.72386 10 8C10 8.27614 9.77614 8.5 9.5 8.5H2.5C2.22386 8.5 2 8.27614 2 8C2 7.72386 2.22386 7.5 2.5 7.5H9.5ZM9.5 3.5C9.77614 3.5 10 3.72386 10 4C10 4.27614 9.77614 4.5 9.5 4.5H2.5C2.22386 4.5 2 4.27614 2 4C2 3.72386 2.22386 3.5 2.5 3.5H9.5Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_sign_equal_12!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcSignEqual12Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_sign_equal_12,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_sign_equal_16: ImageVector? = null
|
||||
|
||||
val Icons.ic_sign_equal_16: ImageVector
|
||||
get() {
|
||||
if (_ic_sign_equal_16 != null) return _ic_sign_equal_16!!
|
||||
_ic_sign_equal_16 = ImageVector.Builder(
|
||||
name = "ic_sign_equal_16",
|
||||
defaultWidth = 16.dp,
|
||||
defaultHeight = 16.dp,
|
||||
viewportWidth = 16f,
|
||||
viewportHeight = 16f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M12.5 10C12.7761 10 13 10.2239 13 10.5C13 10.7761 12.7761 11 12.5 11H3.5C3.22386 11 3 10.7761 3 10.5C3 10.2239 3.22386 10 3.5 10H12.5ZM12.5 5C12.7761 5 13 5.22386 13 5.5C13 5.77614 12.7761 6 12.5 6H3.5C3.22386 6 3 5.77614 3 5.5C3 5.22386 3.22386 5 3.5 5H12.5Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_sign_equal_16!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcSignEqual16Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_sign_equal_16,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_sign_equal_20: ImageVector? = null
|
||||
|
||||
val Icons.ic_sign_equal_20: ImageVector
|
||||
get() {
|
||||
if (_ic_sign_equal_20 != null) return _ic_sign_equal_20!!
|
||||
_ic_sign_equal_20 = ImageVector.Builder(
|
||||
name = "ic_sign_equal_20",
|
||||
defaultWidth = 20.dp,
|
||||
defaultHeight = 20.dp,
|
||||
viewportWidth = 20f,
|
||||
viewportHeight = 20f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M16 12.75C16.4142 12.75 16.75 13.0858 16.75 13.5C16.75 13.9142 16.4142 14.25 16 14.25H4C3.58579 14.25 3.25 13.9142 3.25 13.5C3.25 13.0858 3.58579 12.75 4 12.75H16ZM16 5.75C16.4142 5.75 16.75 6.08579 16.75 6.5C16.75 6.91421 16.4142 7.25 16 7.25H4C3.58579 7.25 3.25 6.91421 3.25 6.5C3.25 6.08579 3.58579 5.75 4 5.75H16Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_sign_equal_20!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcSignEqual20Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_sign_equal_20,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_sign_equal_24: ImageVector? = null
|
||||
|
||||
val Icons.ic_sign_equal_24: ImageVector
|
||||
get() {
|
||||
if (_ic_sign_equal_24 != null) return _ic_sign_equal_24!!
|
||||
_ic_sign_equal_24 = ImageVector.Builder(
|
||||
name = "ic_sign_equal_24",
|
||||
defaultWidth = 24.dp,
|
||||
defaultHeight = 24.dp,
|
||||
viewportWidth = 24f,
|
||||
viewportHeight = 24f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17H5C4.44772 17 4 16.5523 4 16C4 15.4477 4.44772 15 5 15H19ZM19 7C19.5523 7 20 7.44772 20 8C20 8.55228 19.5523 9 19 9H5C4.44772 9 4 8.55228 4 8C4 7.44772 4.44772 7 5 7H19Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_sign_equal_24!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcSignEqual24Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_sign_equal_24,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_sign_equal_28: ImageVector? = null
|
||||
|
||||
val Icons.ic_sign_equal_28: ImageVector
|
||||
get() {
|
||||
if (_ic_sign_equal_28 != null) return _ic_sign_equal_28!!
|
||||
_ic_sign_equal_28 = ImageVector.Builder(
|
||||
name = "ic_sign_equal_28",
|
||||
defaultWidth = 28.dp,
|
||||
defaultHeight = 28.dp,
|
||||
viewportWidth = 28f,
|
||||
viewportHeight = 28f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M22 17.25C22.6904 17.25 23.25 17.8096 23.25 18.5C23.25 19.1904 22.6904 19.75 22 19.75H6C5.30964 19.75 4.75 19.1904 4.75 18.5C4.75 17.8096 5.30964 17.25 6 17.25H22ZM22 8.25C22.6904 8.25 23.25 8.80964 23.25 9.5C23.25 10.1904 22.6904 10.75 22 10.75H6C5.30964 10.75 4.75 10.1904 4.75 9.5C4.75 8.80964 5.30964 8.25 6 8.25H22Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_sign_equal_28!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcSignEqual28Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_sign_equal_28,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _ic_sign_equal_32: ImageVector? = null
|
||||
|
||||
val Icons.ic_sign_equal_32: ImageVector
|
||||
get() {
|
||||
if (_ic_sign_equal_32 != null) return _ic_sign_equal_32!!
|
||||
_ic_sign_equal_32 = ImageVector.Builder(
|
||||
name = "ic_sign_equal_32",
|
||||
defaultWidth = 32.dp,
|
||||
defaultHeight = 32.dp,
|
||||
viewportWidth = 32f,
|
||||
viewportHeight = 32f,
|
||||
).apply {
|
||||
addPath(
|
||||
fill = SolidColor(Color.Black),
|
||||
pathFillType = PathFillType.NonZero,
|
||||
pathData = addPathNodes("M25.5 20C26.3284 20 27 20.6716 27 21.5C27 22.3284 26.3284 23 25.5 23H6.5C5.67157 23 5 22.3284 5 21.5C5 20.6716 5.67157 20 6.5 20H25.5ZM25.5 9C26.3284 9 27 9.67157 27 10.5C27 11.3284 26.3284 12 25.5 12H6.5C5.67157 12 5 11.3284 5 10.5C5 9.67157 5.67157 9 6.5 9H25.5Z"),
|
||||
)
|
||||
}.build()
|
||||
return _ic_sign_equal_32!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun IcSignEqual32Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.ic_sign_equal_32,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
@file:Suppress("all")
|
||||
|
||||
package com.tangem.core.ui.res.generated.icons
|
||||
|
||||
/**
|
||||
* Auto-generated namespace for design-system icons.
|
||||
* Each icon is provided as an extension property on this object.
|
||||
*/
|
||||
object Icons
|
||||
|
|
@ -8,6 +8,8 @@ import org.joda.time.DateTimeZone
|
|||
import org.joda.time.LocalDate
|
||||
import org.joda.time.format.DateTimeFormatter
|
||||
|
||||
const val SECONDS_IN_HOUR = 3600
|
||||
|
||||
/**
|
||||
* If [this] timestamp is today or yesterday, returns relative date,
|
||||
* otherwise returns formatting date.
|
||||
|
|
|
|||
340
core/ui/token-gen/build-icons.mjs
Normal file
340
core/ui/token-gen/build-icons.mjs
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
// ── Paths ──────────────────────────────────────────────────────────────────────
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const iconsDir = path.join(__dirname, '..', 'ds-tokens', 'icons');
|
||||
const outputDir = path.join(
|
||||
__dirname, '..', 'src', 'main', 'java', 'com', 'tangem', 'core', 'ui',
|
||||
'res', 'generated', 'icons',
|
||||
);
|
||||
|
||||
const PACKAGE = 'com.tangem.core.ui.res.generated.icons';
|
||||
|
||||
// Source SVGs use #0F0F0F as a "tint placeholder" — rewrite to Color.Black so
|
||||
// Icon(tint = …) at the call site can re-color the icon.
|
||||
const TINT_PLACEHOLDERS = new Set(['#0f0f0f', '#0F0F0F']);
|
||||
|
||||
// ── Helpers ────────────────────────────────────────────────────────────────────
|
||||
|
||||
function* walkSvgs(dir) {
|
||||
if (!fs.existsSync(dir)) return;
|
||||
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const full = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) yield* walkSvgs(full);
|
||||
else if (entry.name.endsWith('.svg')) yield full;
|
||||
}
|
||||
}
|
||||
|
||||
/** Find an attribute value in a snippet of XML. */
|
||||
function attr(snippet, name) {
|
||||
const m = snippet.match(new RegExp(`\\b${name}="([^"]*)"`));
|
||||
return m ? m[1] : null;
|
||||
}
|
||||
|
||||
function capitalize(s) {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
}
|
||||
|
||||
/** Parse an SVG file into a normalized icon descriptor. */
|
||||
function parseSvg(filePath) {
|
||||
const src = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
const svgOpen = src.match(/<svg\b[^>]*>/);
|
||||
if (!svgOpen) throw new Error('No <svg> root element');
|
||||
const svgEl = svgOpen[0];
|
||||
|
||||
// Viewport / default size
|
||||
const viewBox = attr(svgEl, 'viewBox');
|
||||
let viewportW, viewportH;
|
||||
if (viewBox) {
|
||||
const parts = viewBox.split(/\s+/).map(Number);
|
||||
viewportW = parts[2];
|
||||
viewportH = parts[3];
|
||||
}
|
||||
const defaultW = parseFloat(attr(svgEl, 'width')) || viewportW;
|
||||
const defaultH = parseFloat(attr(svgEl, 'height')) || viewportH;
|
||||
viewportW = viewportW ?? defaultW;
|
||||
viewportH = viewportH ?? defaultH;
|
||||
|
||||
if (!viewportW || !viewportH) {
|
||||
throw new Error('Missing viewBox/width/height');
|
||||
}
|
||||
|
||||
// Group transforms aren't supported (would need matrix decomposition).
|
||||
if (/<g\b[^>]*\btransform=/.test(src)) {
|
||||
throw new Error('<g transform="…"> is not supported by the current generator');
|
||||
}
|
||||
|
||||
// <path .../> elements
|
||||
const paths = [];
|
||||
const pathRe = /<path\b([^>]*?)\/?>/g;
|
||||
let m;
|
||||
while ((m = pathRe.exec(src)) !== null) {
|
||||
const a = m[1];
|
||||
paths.push({
|
||||
d: attr(a, 'd'),
|
||||
fill: attr(a, 'fill'),
|
||||
fillRule: attr(a, 'fill-rule'),
|
||||
fillOpacity: attr(a, 'fill-opacity'),
|
||||
stroke: attr(a, 'stroke'),
|
||||
strokeWidth: attr(a, 'stroke-width'),
|
||||
strokeLinecap: attr(a, 'stroke-linecap'),
|
||||
strokeLinejoin: attr(a, 'stroke-linejoin'),
|
||||
opacity: attr(a, 'opacity'),
|
||||
});
|
||||
}
|
||||
|
||||
if (paths.length === 0) throw new Error('No <path> elements found');
|
||||
for (const p of paths) {
|
||||
if (!p.d) throw new Error('A <path> is missing the "d" attribute');
|
||||
}
|
||||
|
||||
return { viewportW, viewportH, defaultW, defaultH, paths };
|
||||
}
|
||||
|
||||
/**
|
||||
* ic_arrow_down_24_regular.svg →
|
||||
* { propName: 'ic_arrow_down_24', fileName: 'IcArrowDown24' }
|
||||
*/
|
||||
function deriveNames(svgFile) {
|
||||
const base = path.basename(svgFile, '.svg').replace(/_regular$/, '');
|
||||
const fileName = base
|
||||
.split('_')
|
||||
.map(part => capitalize(part))
|
||||
.join('');
|
||||
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(base)) {
|
||||
throw new Error(`Icon name "${base}" is not a valid Kotlin identifier`);
|
||||
}
|
||||
return { propName: base, fileName };
|
||||
}
|
||||
|
||||
/** Convert an SVG color string into a Compose Color expression, or null to skip. */
|
||||
function svgColorToKotlin(value) {
|
||||
if (!value || value === 'none') return null;
|
||||
if (TINT_PLACEHOLDERS.has(value.toLowerCase())) return 'Color.Black';
|
||||
|
||||
const hex6 = value.match(/^#([0-9a-fA-F]{6})$/);
|
||||
if (hex6) return `Color(0xFF${hex6[1].toUpperCase()})`;
|
||||
|
||||
const hex3 = value.match(/^#([0-9a-fA-F]{3})$/);
|
||||
if (hex3) {
|
||||
const [r, g, b] = hex3[1].toUpperCase().split('');
|
||||
return `Color(0xFF${r}${r}${g}${g}${b}${b})`;
|
||||
}
|
||||
|
||||
const hex8 = value.match(/^#([0-9a-fA-F]{8})$/);
|
||||
if (hex8) return `Color(0x${hex8[1].toUpperCase()})`;
|
||||
|
||||
const rgba = value.match(/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/);
|
||||
if (rgba) {
|
||||
const r = (+rgba[1]).toString(16).padStart(2, '0').toUpperCase();
|
||||
const g = (+rgba[2]).toString(16).padStart(2, '0').toUpperCase();
|
||||
const b = (+rgba[3]).toString(16).padStart(2, '0').toUpperCase();
|
||||
const a = Math.round(parseFloat(rgba[4]) * 255).toString(16).padStart(2, '0').toUpperCase();
|
||||
return `Color(0x${a}${r}${g}${b})`;
|
||||
}
|
||||
|
||||
if (value === 'black') return 'Color.Black';
|
||||
if (value === 'white') return 'Color.White';
|
||||
if (value === 'transparent') return 'Color.Transparent';
|
||||
|
||||
throw new Error(`Unsupported SVG color: "${value}"`);
|
||||
}
|
||||
|
||||
function renderPath(p, indent) {
|
||||
const pad = ' '.repeat(indent);
|
||||
const pad1 = ' '.repeat(indent + 1);
|
||||
const args = [];
|
||||
|
||||
// If a path has no fill at all and has stroke, leave fill out. Otherwise default to tintable black.
|
||||
const hasStroke = !!p.stroke && p.stroke !== 'none';
|
||||
const fillSpecified = p.fill != null;
|
||||
let fillKt = svgColorToKotlin(p.fill);
|
||||
if (!fillSpecified && !hasStroke) fillKt = 'Color.Black';
|
||||
if (fillKt) args.push(`fill = SolidColor(${fillKt})`);
|
||||
|
||||
if (p.fillOpacity != null) {
|
||||
args.push(`fillAlpha = ${parseFloat(p.fillOpacity)}f`);
|
||||
} else if (p.opacity != null && fillKt) {
|
||||
args.push(`fillAlpha = ${parseFloat(p.opacity)}f`);
|
||||
}
|
||||
|
||||
const strokeKt = svgColorToKotlin(p.stroke);
|
||||
if (strokeKt) args.push(`stroke = SolidColor(${strokeKt})`);
|
||||
if (p.strokeWidth != null) args.push(`strokeLineWidth = ${parseFloat(p.strokeWidth)}f`);
|
||||
if (p.strokeLinecap) args.push(`strokeLineCap = StrokeCap.${capitalize(p.strokeLinecap)}`);
|
||||
if (p.strokeLinejoin) args.push(`strokeLineJoin = StrokeJoin.${capitalize(p.strokeLinejoin)}`);
|
||||
|
||||
args.push(`pathFillType = PathFillType.${p.fillRule === 'evenodd' ? 'EvenOdd' : 'NonZero'}`);
|
||||
args.push(`pathData = addPathNodes(${JSON.stringify(p.d)})`);
|
||||
|
||||
const lines = [`${pad}addPath(`];
|
||||
for (const arg of args) lines.push(`${pad1}${arg},`);
|
||||
lines.push(`${pad})`);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function renderIconFile({ propName, fileName }, icon) {
|
||||
const usesStroke = icon.paths.some(p => p.stroke && p.stroke !== 'none');
|
||||
|
||||
const imports = [
|
||||
'androidx.compose.material3.Icon',
|
||||
'androidx.compose.runtime.Composable',
|
||||
'androidx.compose.ui.graphics.Color',
|
||||
'androidx.compose.ui.graphics.PathFillType',
|
||||
'androidx.compose.ui.graphics.SolidColor',
|
||||
'androidx.compose.ui.graphics.vector.ImageVector',
|
||||
'androidx.compose.ui.graphics.vector.addPathNodes',
|
||||
'androidx.compose.ui.tooling.preview.Preview',
|
||||
'androidx.compose.ui.unit.dp',
|
||||
];
|
||||
if (usesStroke) {
|
||||
imports.push('androidx.compose.ui.graphics.StrokeCap');
|
||||
imports.push('androidx.compose.ui.graphics.StrokeJoin');
|
||||
}
|
||||
imports.sort();
|
||||
|
||||
const pathBlocks = icon.paths.map(p => renderPath(p, 2)).join('\n');
|
||||
|
||||
return `@file:Suppress("all")
|
||||
|
||||
package ${PACKAGE}
|
||||
|
||||
${imports.map(i => `import ${i}`).join('\n')}
|
||||
|
||||
/**
|
||||
* Auto-generated from design tokens. Do not edit manually.
|
||||
*/
|
||||
|
||||
private var _${propName}: ImageVector? = null
|
||||
|
||||
val Icons.${propName}: ImageVector
|
||||
get() {
|
||||
if (_${propName} != null) return _${propName}!!
|
||||
_${propName} = ImageVector.Builder(
|
||||
name = ${JSON.stringify(propName)},
|
||||
defaultWidth = ${icon.defaultW}.dp,
|
||||
defaultHeight = ${icon.defaultH}.dp,
|
||||
viewportWidth = ${icon.viewportW}f,
|
||||
viewportHeight = ${icon.viewportH}f,
|
||||
).apply {
|
||||
${pathBlocks.replace(/^/gm, ' ')}
|
||||
}.build()
|
||||
return _${propName}!!
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true)
|
||||
private fun ${fileName}Preview() {
|
||||
Icon(
|
||||
imageVector = Icons.${propName},
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
const ICONS_NAMESPACE = `@file:Suppress("all")
|
||||
|
||||
package ${PACKAGE}
|
||||
|
||||
/**
|
||||
* Auto-generated namespace for design-system icons.
|
||||
* Each icon is provided as an extension property on this object.
|
||||
*/
|
||||
object Icons
|
||||
`;
|
||||
|
||||
// ── Hash gate ──────────────────────────────────────────────────────────────────
|
||||
|
||||
function computeIconsHash() {
|
||||
const files = [...walkSvgs(iconsDir)];
|
||||
files.sort((a, b) => {
|
||||
const ra = path.relative(iconsDir, a).split(path.sep).join('/');
|
||||
const rb = path.relative(iconsDir, b).split(path.sep).join('/');
|
||||
return ra.localeCompare(rb);
|
||||
});
|
||||
const hash = crypto.createHash('sha256');
|
||||
for (const file of files) {
|
||||
hash.update(path.relative(iconsDir, file).split(path.sep).join('/'));
|
||||
hash.update('\0');
|
||||
hash.update(fs.readFileSync(file));
|
||||
hash.update('\0');
|
||||
}
|
||||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
// ── Main ───────────────────────────────────────────────────────────────────────
|
||||
|
||||
export async function buildIcons() {
|
||||
console.log('\nBuilding icon vectors...');
|
||||
|
||||
const newHash = computeIconsHash();
|
||||
const hashFile = path.join(outputDir, '.icons-hash');
|
||||
if (fs.existsSync(hashFile)) {
|
||||
const prev = fs.readFileSync(hashFile, 'utf8').trim();
|
||||
if (prev === newHash) {
|
||||
console.log(` ✓ icons unchanged (${newHash.substring(0, 12)}…); skipping`);
|
||||
return { hash: newHash };
|
||||
}
|
||||
}
|
||||
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
|
||||
// Parse every SVG up-front so we fail fast on errors before writing anything.
|
||||
const icons = [];
|
||||
for (const svgFile of walkSvgs(iconsDir)) {
|
||||
const names = deriveNames(svgFile);
|
||||
let parsed;
|
||||
try {
|
||||
parsed = parseSvg(svgFile);
|
||||
} catch (e) {
|
||||
throw new Error(`${path.relative(iconsDir, svgFile)}: ${e.message}`);
|
||||
}
|
||||
icons.push({ names, parsed });
|
||||
}
|
||||
|
||||
// Detect property-name collisions early.
|
||||
const seen = new Map();
|
||||
for (const { names } of icons) {
|
||||
if (seen.has(names.propName)) {
|
||||
throw new Error(
|
||||
`Duplicate icon property "${names.propName}" (file collision: ` +
|
||||
`${seen.get(names.propName)}.kt vs ${names.fileName}.kt)`,
|
||||
);
|
||||
}
|
||||
seen.set(names.propName, names.fileName);
|
||||
}
|
||||
|
||||
// Write namespace + per-icon files.
|
||||
const expectedFiles = new Set(['Icons.kt', '.icons-hash']);
|
||||
fs.writeFileSync(path.join(outputDir, 'Icons.kt'), ICONS_NAMESPACE);
|
||||
|
||||
for (const { names, parsed } of icons) {
|
||||
const file = `${names.fileName}.kt`;
|
||||
expectedFiles.add(file);
|
||||
fs.writeFileSync(path.join(outputDir, file), renderIconFile(names, parsed));
|
||||
}
|
||||
|
||||
// Cleanup stale generated files (icons that no longer have a source SVG).
|
||||
let removed = 0;
|
||||
for (const entry of fs.readdirSync(outputDir)) {
|
||||
if (!expectedFiles.has(entry) && entry.endsWith('.kt')) {
|
||||
fs.unlinkSync(path.join(outputDir, entry));
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(hashFile, newHash + '\n');
|
||||
const removedNote = removed > 0 ? `, removed ${removed} stale` : '';
|
||||
console.log(` ✓ ${icons.length} icon(s) (${newHash.substring(0, 12)}…${removedNote})`);
|
||||
return { hash: newHash };
|
||||
}
|
||||
|
||||
// Run directly when executed as `node build-icons.mjs`.
|
||||
if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
|
||||
await buildIcons();
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import crypto from 'crypto';
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { buildIcons } from './build-icons.mjs';
|
||||
|
||||
// ── Paths ──────────────────────────────────────────────────────────────────────
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
|
@ -908,8 +909,19 @@ function computeTokensHash() {
|
|||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
const tokensHash = computeTokensHash();
|
||||
// ── Build icons ───────────────────────────────────────────────────────────────
|
||||
// Run before writing .tokens-hash so the icons hash can be folded in — Gradle
|
||||
// then has a single hash that invalidates on any ds-tokens change (tokens or icons).
|
||||
const { hash: iconsHash } = await buildIcons();
|
||||
|
||||
const tokensInputHash = computeTokensHash();
|
||||
const tokensHash = crypto
|
||||
.createHash('sha256')
|
||||
.update(tokensInputHash)
|
||||
.update('\0')
|
||||
.update(iconsHash)
|
||||
.digest('hex');
|
||||
fs.writeFileSync(path.join(outputDir, '.tokens-hash'), tokensHash + '\n');
|
||||
console.log(` ✓ .tokens-hash (${tokensHash.substring(0, 12)}…)`);
|
||||
console.log(`\n ✓ .tokens-hash (${tokensHash.substring(0, 12)}…)`);
|
||||
|
||||
console.log(`\nDone! Output: ${outputDir}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue