From 6910f74fd9539643748dd0b055562f50d4d7bb4c Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 30 Sep 2025 16:48:26 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../components/SettingsAlertDialog.kt | 2 +- .../details/ui/resetcard/ResetCardScreen.kt | 2 +- .../tangem/tap/features/main/MainViewModel.kt | 2 +- .../tangem/tap/routing/utils/ChildFactory.kt | 6 +-- .../com/tangem/google/GoogleServicesHelper.kt | 4 +- .../com/tangem/common/routing/AppRoute.kt | 12 ++--- .../common/routing/bundle/BundleDecoder.kt | 1 + .../MockYieldBalanceWrapperDTOFactory.kt | 2 +- .../test/data/staking/MockYieldDTOFactory.kt | 8 ++-- .../domain/card/MockScanResponseFactory.kt | 6 +-- .../network/MockNetworkStatusFactory.kt | 23 +++++----- .../domain/wallet/MockUserWalletFactory.kt | 2 +- .../com/tangem/common/test/utils/TruthExt.kt | 9 ++-- .../tangem/common/ui/charts/MarketChart.kt | 38 ++++++++-------- .../common/ui/charts/MarketChartMini.kt | 4 +- .../ui/charts/downsample/LTThreeBuckets.kt | 8 ++-- .../common/ui/charts/layer/ChartMarker.kt | 24 +++++----- .../ui/charts/layer/MarketChartLayer.kt | 10 ++--- .../charts/state/MarketChartDataProducer.kt | 6 +-- .../common/ui/charts/state/MarketChartLook.kt | 4 +- .../ui/charts/state/MarketChartState.kt | 15 ++++--- .../PriceAndTimePointValuesConverter.kt | 32 ++++++++------ .../converters/AmountReduceByTransformer.kt | 2 +- .../converters/AmountReduceToTransformer.kt | 2 +- .../converters/AmountStateConverter.kt | 6 +-- .../GiveTxPermisssionBottomSheet.kt | 4 +- .../permission/state/GiveTxPermissionState.kt | 4 +- .../receive/TokenReceiveBottomSheet.kt | 6 +-- .../NavigationButtonsBlock.kt | 4 +- .../NavigationButtonsState.kt | 18 ++++---- .../preview/NavigationButtonsPreview.kt | 8 ++-- .../common/ui/notifications/NotificationUM.kt | 4 +- .../ui/notifications/NotificationsFactory.kt | 26 ++++++----- .../ui/tokens/TokenItemStateConverter.kt | 18 +++++--- .../tangem/common/ui/tokens/TokenPriceText.kt | 6 +-- .../feature/impl/DevFeatureTogglesManager.kt | 2 +- .../version/DefaultVersionProvider.kt | 14 +++--- .../config/managers/ApiConfigsManager.kt | 2 +- .../config/managers/DevApiConfigsManager.kt | 8 ++-- .../config/managers/MockApiConfigsManager.kt | 2 +- .../config/managers/ProdApiConfigsManager.kt | 2 +- .../api/common/response/ApiResponseError.kt | 10 ++--- .../api/common/response/ResponseExt.kt | 4 +- .../api/express/models/response/Asset.kt | 1 + .../response/TokenMarketInfoResponse.kt | 1 + .../models/response/model/OnrampCountryDTO.kt | 1 + .../response/TangemPayTxHistoryResponse.kt | 1 + .../models/request/ActionRequestBody.kt | 1 + .../response/model/AddressArgumentDTO.kt | 1 + .../response/model/YieldBalanceWrapperDTO.kt | 2 + .../models/response/model/YieldDTO.kt | 2 + .../api/tangemTech/models/CoinsResponse.kt | 5 ++- .../CreateUserNetworkAccountResponse.kt | 1 + .../tangemTech/models/UserTokensResponse.kt | 1 + .../api/tangemTech/models/WalletBody.kt | 1 + .../api/tangemTech/models/WalletResponse.kt | 1 + .../datasource/asset/loader/AssetLoader.kt | 4 +- .../datasource/di/utils/RetrofitApiBuilder.kt | 1 + .../swap/DefaultExpressServiceLoader.kt | 5 ++- .../nft/converter/NFTSdkAssetConverter.kt | 24 +++++----- .../utils/AppPreferencesStoreExt.kt | 4 +- .../swap/DefaultSwapBestRateAnimationStore.kt | 6 +-- .../DefaultTokenReceiveWarningActionStore.kt | 2 +- .../token/converter/PendingActionConverter.kt | 8 ++-- .../tangem/datasource/utils/HttpClientExt.kt | 6 +-- .../utils/NetworkLogsSaveInterceptor.kt | 2 +- .../tangem/datasource/utils/RequestHeader.kt | 4 +- .../core/decompose/model/ModelEntryPoint.kt | 1 + .../java/com/tangem/core/res/Resources.kt | 18 ++++++-- .../com/tangem/core/ui/components/Dialogs.kt | 24 +++++----- .../tangem/core/ui/components/FadeModifier.kt | 4 +- .../com/tangem/core/ui/components/Flicker.kt | 8 ++-- .../tangem/core/ui/components/FullScreen.kt | 18 ++++---- .../com/tangem/core/ui/components/Keyboard.kt | 4 +- .../core/ui/components/ResizableText.kt | 8 ++-- .../tangem/core/ui/components/SettingsRow.kt | 2 +- .../com/tangem/core/ui/components/Shimmers.kt | 20 ++++----- .../tangem/core/ui/components/TextFields.kt | 36 ++++++++------- .../ui/components/appbar/AppBarWithSearch.kt | 8 ++-- .../ui/components/appbar/TopAppBarButton.kt | 4 +- .../appbar/models/TopAppBarButtonUM.kt | 16 +++---- .../ModalBottomSheetWithBackHandling.kt | 7 ++- .../message/MessageBottomSheet.kt | 4 +- .../message/MessageBottomSheetUM.kt | 2 +- .../message/MessageBottomSheetV2.kt | 26 +++++------ .../modal/TangemModalBottomSheet.kt | 5 ++- .../bottomsheets/sheet/TangemBottomSheet.kt | 6 +-- .../buttons/HorizontalActionChips.kt | 2 +- .../core/ui/components/buttons/SmallButton.kt | 10 ++--- .../buttons/actions/ActionButtonConfig.kt | 23 +++++----- .../ui/components/buttons/actions/Actions.kt | 34 +++++++------- .../segmentedbutton/SegmentedButton.kt | 4 +- .../components/currency/icon/CurrencyIcon.kt | 2 +- .../currency/icon/CurrencyIconState.kt | 32 +++++++------- .../currency/icon/CurrencyIconStateBuilder.kt | 14 +++--- .../CryptoCurrencyToIconStateConverter.kt | 14 +++--- .../dropdownmenu/TangemDropdownMenu.kt | 6 +-- .../ui/components/fields/AmountTextField.kt | 10 ++--- .../ui/components/fields/AutoSizeTextField.kt | 25 ++++++----- .../core/ui/components/fields/PinTextField.kt | 6 +-- .../core/ui/components/fields/SearchBar.kt | 4 +- .../fields/SimpleDialogTextField.kt | 8 ++-- .../ui/components/fields/SimpleTextField.kt | 8 ++-- .../grid/EnumeratedTwoColumnGrid.kt | 6 +-- .../components/inputrow/InputRowBestRate.kt | 10 ++--- .../ui/components/inputrow/InputRowDefault.kt | 12 ++--- .../ui/components/inputrow/InputRowEnter.kt | 10 ++--- .../inputrow/InputRowEnterAmount.kt | 2 +- .../components/inputrow/InputRowEnterInfo.kt | 12 ++--- .../inputrow/InputRowEnterInfoAmount.kt | 8 ++-- .../ui/components/inputrow/InputRowImage.kt | 16 +++---- .../components/inputrow/InputRowImageInfo.kt | 2 +- .../inputrow/InputRowImageSelector.kt | 6 +-- .../components/inputrow/InputRowRecipient.kt | 4 +- .../ui/components/list/InfiniteListHandler.kt | 14 +++--- .../notifications/CurrencyNotification.kt | 18 ++++++-- .../NoteMigrationNotification.kt | 4 +- .../components/notifications/Notification.kt | 6 +-- .../notifications/NotificationConfig.kt | 4 +- .../TangemLinearProgressIndicator.kt | 44 ++++++++++++------- .../core/ui/components/rows/ActionRow.kt | 8 ++-- .../core/ui/components/rows/ChainRow.kt | 12 ++--- .../ui/components/rows/model/ChainRowUM.kt | 4 +- .../core/ui/components/showcase/Showcase.kt | 4 +- .../ui/components/snackbar/TangemSnackbar.kt | 2 +- .../components/snackbar/TangemSnackbarHost.kt | 2 +- .../snackbar/TangemSnackbarModelProvider.kt | 4 +- .../stories/inner/StoriesStepStateMachine.kt | 2 +- .../core/ui/components/token/TokenItem.kt | 6 +-- .../empty/EmptyTransactionsBlockState.kt | 8 ++-- .../core/ui/extensions/TextReference.kt | 12 ++--- .../bigdecimal/BigDecimalCryptoFormat.kt | 6 +-- .../bigdecimal/BigDecimalPercentFormat.kt | 6 +-- .../tangem/core/ui/message/EventMessage.kt | 15 +++---- .../core/ui/message/EventMessageEffect.kt | 16 +++---- .../tangem/core/ui/message/dialog/Dialogs.kt | 2 +- .../core/ui/reordarable/ReorderableItem.kt | 23 ++++++++-- .../core/ui/utils/DecimalFormatterExt.kt | 6 +-- .../com/tangem/core/ui/utils/PathUtils.kt | 7 ++- .../com/tangem/core/ui/utils/PreviewUtils.kt | 6 +-- .../fetcher/DefaultWalletAccountsFetcher.kt | 4 +- .../producer/WalletAccountListFlowFactory.kt | 2 +- .../DefaultDeviceFlipDetector.kt | 4 +- .../tangem/data/balancehiding/FlipListener.kt | 4 +- .../data/common/api/ApiResponseRaise.kt | 2 +- .../settings/DefaultAppRatingRepository.kt | 17 +++++-- .../repository/DefaultTxHistoryRepository.kt | 4 +- .../RefactoredTxHistoryRepository.kt | 2 +- .../tangem/data/visa/DefaultVisaRepository.kt | 4 +- .../tangem/data/visa/MockVisaRepository.kt | 2 +- .../tangem/domain/demo/models/DemoConfig.kt | 2 +- .../utils/EmailMessageTitleResolver.kt | 5 ++- .../domain/swap/models/SwapCurrencies.kt | 4 +- .../swap/usecase/GetSwapPairsUseCase.kt | 2 +- .../usecase/GetSwapSupportedPairsUseCase.kt | 2 +- .../swap/usecase/SelectInitialPairUseCase.kt | 4 +- .../txhistory/model/TxHistoryListConfig.kt | 2 +- .../repository/TxHistoryRepository.kt | 2 +- .../usecase/GetFixedTxHistoryItemsUseCase.kt | 18 ++++++-- .../usecase/GetTxHistoryItemsUseCase.kt | 7 ++- .../domain/visa/GetVisaTxHistoryUseCase.kt | 2 +- .../domain/visa/repository/VisaRepository.kt | 2 +- .../createedit/AccountCreateEditModel.kt | 2 +- .../account/details/AccountDetailsModel.kt | 2 +- .../features/biometry/AskBiometryComponent.kt | 2 +- .../biometry/impl/model/AskBiometryModel.kt | 4 +- .../entry/AddExistingWalletModel.kt | 2 +- .../entry/WalletActivationModel.kt | 2 +- .../component/ChooseManagedTokensComponent.kt | 2 +- .../CommonManageTokensAnalyticEvents.kt | 6 +-- .../model/ChooseManagedTokensModel.kt | 2 +- .../ui/ChooseManagedTokenContent.kt | 2 +- .../preview/PreviewManageTokensComponent.kt | 4 +- .../PreviewOnboardingManageTokensComponent.kt | 4 +- .../ui/CustomTokenSelectorContent.kt | 4 +- .../managetokens/ui/ManageTokensScreen.kt | 4 +- .../ui/dialog/CustomDerivationInputDialog.kt | 2 +- .../utils/list/ManageTokensWarningDelegate.kt | 2 +- .../utils/mapper/CurrencyItemMapper.kt | 6 +-- .../details/MarketsTokenDetailsComponent.kt | 2 +- ...efaultMarketsTokenDetailDeepLinkHandler.kt | 2 +- .../DefaultMarketsTokenDetailsComponent.kt | 2 +- .../converters/ExchangeItemStateConverter.kt | 2 +- .../ui/components/ExchangesBottomSheet.kt | 2 +- .../impl/ui/components/InfoBottomSheet.kt | 2 +- .../impl/DefaultMarketsEntryComponent.kt | 2 +- .../markets/portfolio/impl/ui/MyPortfolio.kt | 2 +- .../block/impl/model/TokenMarketBlockModel.kt | 4 +- .../impl/DefaultMarketsTokenListComponent.kt | 2 +- .../converters/MarketsTokenItemConverter.kt | 2 +- .../transformer/UpdateDataStateTransformer.kt | 6 +-- .../receive/ui/NFTReceiveNetworksContent.kt | 20 ++++----- .../onboarding/v2/common/ui/Dialogs.kt | 2 +- .../impl/routing/OnboardingChildFactory.kt | 2 +- .../impl/child/backup/ui/MultiWalletBackup.kt | 2 +- .../ui/MultiWalletCreateWallet.kt | 2 +- .../ui/MultiWalletSeedPhraseImport.kt | 2 +- .../ui/MultiWalletSeedPhraseWordsCheck.kt | 2 +- .../ui/MultiWalletUpgradeWallet.kt | 2 +- .../accesscode/ui/OnboardingVisaAccessCode.kt | 2 +- .../child/approve/ui/OnboardingVisaApprove.kt | 2 +- .../child/pincode/ui/OnboardingVisaPinCode.kt | 2 +- .../onramp/component/OnrampComponent.kt | 2 +- .../ui/OnrampAddToPortfolioContent.kt | 2 +- .../main/entity/OnrampMainComponentUM.kt | 2 +- .../main/entity/factory/OnrampStateFactory.kt | 8 ++-- .../entity/factory/OnrampV2StateFactory.kt | 10 ++--- .../onramp/root/DefaultOnrampComponent.kt | 2 +- .../PushNotificationAnalyticEvents.kt | 2 +- .../DefaultSendEntryPointComponent.kt | 2 +- .../SetButtonsStateTransformer.kt | 8 ++-- ...pprovalBottomSheetInProgressTransformer.kt | 4 +- .../ShowApprovalBottomSheetTransformer.kt | 4 +- .../v2/impl/amount/model/SwapAmountModel.kt | 2 +- .../models/ui/TokensDataStateExpress.kt | 2 +- .../feature/swap/domain/SwapInteractorImpl.kt | 2 +- .../swap/converters/TokensDataConverter.kt | 6 +-- .../tangem/feature/swap/model/SwapModel.kt | 4 +- .../tangem/feature/swap/ui/StateBuilder.kt | 2 +- .../feature/swap/ui/SwapSelectTokenScreen.kt | 2 +- .../ui/TangemPayOnboardingContent.kt | 2 +- .../providers/ui/BlockchainProvidersScreen.kt | 2 +- .../ui/TokenReceiveWarningContent.kt | 2 +- .../components/TokenDetailsActionButton.kt | 12 ++--- .../ui/components/TokenDetailsDialogs.kt | 4 +- .../txhistory/utils/TxHistoryListManager.kt | 6 +-- .../model/WalletSettingsModel.kt | 2 +- .../walletsettings/ui/RenameWalletDialog.kt | 2 +- .../walletsettings/ui/WalletSettingsScreen.kt | 2 +- .../wallet/child/wallet/WalletComponent.kt | 2 +- .../WalletCurrencyActionsClickIntents.kt | 2 +- .../presentation/common/WalletPreviewData.kt | 2 +- .../organizetokens/OrganizeTokensScreen.kt | 6 +-- .../wallet/state/model/WalletManageButton.kt | 26 +++++------ .../presentation/wallet/ui/WalletAlert.kt | 6 +-- .../MultiCurrencyOrganizeButton.kt | 2 +- .../visa/TangemPayMainScreenBlock.kt | 2 +- .../ui/YieldSupplyDepositedWarningContent.kt | 2 +- .../blockchainsdk/compatibility/L2Networks.kt | 8 ++-- .../BlockchainProvidersResponseLoader.kt | 4 +- .../BlockchainProvidersResponseMerger.kt | 4 +- .../DevBlockchainProvidersTypesManager.kt | 4 +- 242 files changed, 866 insertions(+), 732 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsAlertDialog.kt b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsAlertDialog.kt index 327cb900a1..f27a3d76d8 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsAlertDialog.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsAlertDialog.kt @@ -22,7 +22,7 @@ internal fun SettingsAlertDialog(dialog: Dialog.Alert) { isDismissable = false, confirmButton = DialogButtonUM( title = dialog.confirmText.resolveReference(), - warning = true, + isWarning = true, onClick = dialog.onConfirm, ), dismissButton = DialogButtonUM( diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreen.kt index b6557e7f4c..e37cf7eac6 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreen.kt @@ -208,7 +208,7 @@ private fun CommonResetDialog(dialog: ResetCardScreenState.Dialog) { ), confirmButton = DialogButtonUM( title = stringResourceSafe(id = R.string.card_settings_action_sheet_reset), - warning = true, + isWarning = true, onClick = dialog.onConfirmClick, ), onDismissDialog = dialog.onDismiss, diff --git a/app/src/main/java/com/tangem/tap/features/main/MainViewModel.kt b/app/src/main/java/com/tangem/tap/features/main/MainViewModel.kt index 1753406d30..c97295afb0 100644 --- a/app/src/main/java/com/tangem/tap/features/main/MainViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/main/MainViewModel.kt @@ -165,7 +165,7 @@ internal class MainViewModel @Inject constructor( private fun launchAPIRequests(function: suspend CoroutineScope.() -> Unit) { viewModelScope.launch { if (BuildConfig.TESTER_MENU_ENABLED) { - apiConfigsManager.isInitialized + apiConfigsManager.initializedState .filter { it } .first() // wait until isInitialized becomes true diff --git a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt index 56a3421686..0fbbb05221 100644 --- a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt +++ b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt @@ -185,7 +185,7 @@ internal class ChildFactory @Inject constructor( params = MarketsTokenDetailsComponent.Params( token = route.token, appCurrency = route.appCurrency, - showPortfolio = route.showPortfolio, + shouldShowPortfolio = route.shouldShowPortfolio, analyticsParams = route.analyticsParams?.let { params -> MarketsTokenDetailsComponent.AnalyticsParams( blockchain = params.blockchain, @@ -203,7 +203,7 @@ internal class ChildFactory @Inject constructor( userWalletId = route.portfolioId.userWalletId, // todo account portfolioId param, cryptoCurrency = route.currency, source = route.source, - launchSepa = route.launchSepa, + shouldLaunchSepa = route.shouldLaunchSepa, ), componentFactory = onrampComponentFactory, ) @@ -462,7 +462,7 @@ internal class ChildFactory @Inject constructor( initialCurrency = route.initialCurrency, selectedCurrency = route.selectedCurrency, source = ChooseManagedTokensComponent.Source.valueOf(route.source.name), - showSendViaSwapNotification = route.showSendViaSwapNotification, + shouldShowSendViaSwapNotification = route.shouldShowSendViaSwapNotification, analyticsCategoryName = route.analyticsCategoryName, ), componentFactory = chooseManagedTokensComponentFactory, diff --git a/common/google/src/main/java/com/tangem/google/GoogleServicesHelper.kt b/common/google/src/main/java/com/tangem/google/GoogleServicesHelper.kt index e81718555d..6be3254217 100644 --- a/common/google/src/main/java/com/tangem/google/GoogleServicesHelper.kt +++ b/common/google/src/main/java/com/tangem/google/GoogleServicesHelper.kt @@ -78,8 +78,8 @@ object GoogleServicesHelper { return suspendCoroutine> { continuation -> task.addOnCompleteListener { completedTask -> try { - val result = completedTask.getResult(ApiException::class.java) - continuation.resume(Result.success(result)) + val isGooglePayAvailable = completedTask.getResult(ApiException::class.java) + continuation.resume(Result.success(isGooglePayAvailable)) } catch (exception: ApiException) { continuation.resume(Result.failure(exception)) } diff --git a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt index 3893f51268..cff2c7ead2 100644 --- a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt +++ b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt @@ -1,3 +1,5 @@ +@file:Suppress("NullableToStringCall") + package com.tangem.common.routing import android.annotation.SuppressLint @@ -160,7 +162,7 @@ sealed class AppRoute(val path: String) : Route { val initialCurrency: CryptoCurrency, val selectedCurrency: CryptoCurrency?, val source: Source, - val showSendViaSwapNotification: Boolean, + val shouldShowSendViaSwapNotification: Boolean, val analyticsCategoryName: String, ) : AppRoute(path = "/$source/choose_managed_tokens/$userWalletId/${initialCurrency.id.value}") { enum class Source { @@ -271,9 +273,9 @@ sealed class AppRoute(val path: String) : Route { data class MarketsTokenDetails( val token: TokenMarketParams, val appCurrency: AppCurrency, - val showPortfolio: Boolean, + val shouldShowPortfolio: Boolean, val analyticsParams: AnalyticsParams? = null, - ) : AppRoute(path = "/markets_token_details/${token.id}/$showPortfolio") { + ) : AppRoute(path = "/markets_token_details/${token.id}/$shouldShowPortfolio") { @Serializable data class AnalyticsParams( @@ -287,7 +289,7 @@ sealed class AppRoute(val path: String) : Route { val source: OnrampSource, val portfolioId: PortfolioId, val currency: CryptoCurrency, - val launchSepa: Boolean = false, + val shouldLaunchSepa: Boolean = false, ) : AppRoute(path = "/onramp/${portfolioId.stringValue}/${currency.symbol}"), RouteBundleParams { override fun getBundle(): Bundle = bundle(serializer()) @@ -301,7 +303,7 @@ sealed class AppRoute(val path: String) : Route { source = source, portfolioId = PortfolioId(userWalletId), currency = currency, - launchSepa = launchSepa, + shouldLaunchSepa = launchSepa, ) } } diff --git a/common/routing/src/main/kotlin/com/tangem/common/routing/bundle/BundleDecoder.kt b/common/routing/src/main/kotlin/com/tangem/common/routing/bundle/BundleDecoder.kt index 6a51004489..d10f5bc298 100644 --- a/common/routing/src/main/kotlin/com/tangem/common/routing/bundle/BundleDecoder.kt +++ b/common/routing/src/main/kotlin/com/tangem/common/routing/bundle/BundleDecoder.kt @@ -9,6 +9,7 @@ import kotlinx.serialization.encoding.CompositeDecoder import kotlinx.serialization.modules.SerializersModule @ExperimentalSerializationApi +@Suppress("NullableToStringCall") internal class BundleDecoder( private val bundle: Bundle, private val elementsCount: Int = -1, diff --git a/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldBalanceWrapperDTOFactory.kt b/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldBalanceWrapperDTOFactory.kt index bb2343344e..b204ba985a 100644 --- a/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldBalanceWrapperDTOFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldBalanceWrapperDTOFactory.kt @@ -28,7 +28,7 @@ object MockYieldBalanceWrapperDTOFactory { amount = BigDecimal.ONE, date = null, pricePerShare = BigDecimal.ZERO, - pendingActions = listOf(), + pendingActions = emptyList(), pendingActionConstraints = null, tokenDTO = TokenDTO( name = "The-Open-Network", diff --git a/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldDTOFactory.kt b/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldDTOFactory.kt index c58ff8edc0..52d77fa3a1 100644 --- a/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldDTOFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/data/staking/MockYieldDTOFactory.kt @@ -30,13 +30,13 @@ object MockYieldDTOFactory { logoURI = null, isPoints = null, ), - tokens = listOf(), + tokens = emptyList(), args = YieldDTO.ArgsDTO( enter = YieldDTO.ArgsDTO.Enter( addresses = YieldDTO.ArgsDTO.Enter.Addresses( address = AddressArgumentDTO(required = false), ), - args = mapOf(), + args = emptyMap(), ), exit = null, ), @@ -69,7 +69,7 @@ object MockYieldDTOFactory { logoURI = null, isPoints = null, ), - tokensDTO = listOf(), + tokensDTO = emptyList(), type = "type", rewardSchedule = YieldDTO.MetadataDTO.RewardScheduleDTO.DAY, cooldownPeriod = null, @@ -81,7 +81,7 @@ object MockYieldDTOFactory { revshare = YieldDTO.MetadataDTO.EnabledDTO(enabled = true), fee = YieldDTO.MetadataDTO.EnabledDTO(enabled = true), ), - validators = listOf(), + validators = emptyList(), isAvailable = true, ) } diff --git a/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt b/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt index 53527291ff..0b04f1cf91 100644 --- a/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt @@ -63,7 +63,7 @@ object MockScanResponseFactory { isResettingUserCodesAllowed = false, isLinkedTerminalEnabled = false, isBackupAllowed = cardConfig is MultiWalletCardConfig, - supportedEncryptionModes = listOf(), + supportedEncryptionModes = emptyList(), isFilesAllowed = true, isHDWalletAllowed = cardConfig is MultiWalletCardConfig, isKeysImportAllowed = true, @@ -72,7 +72,7 @@ object MockScanResponseFactory { linkedTerminalStatus = CardDTO.LinkedTerminalStatus.Current, isAccessCodeSet = false, isPasscodeSet = null, - supportedCurves = listOf(), + supportedCurves = emptyList(), wallets = cardConfig.mandatoryCurves.map { CardDTO.Wallet( CardWallet( @@ -85,7 +85,7 @@ object MockScanResponseFactory { index = 0, isImported = true, hasBackup = true, - derivedKeys = mapOf(), + derivedKeys = emptyMap(), ), ) }, diff --git a/common/test/src/main/java/com/tangem/common/test/domain/network/MockNetworkStatusFactory.kt b/common/test/src/main/java/com/tangem/common/test/domain/network/MockNetworkStatusFactory.kt index 99a612b847..41f76b4cb7 100644 --- a/common/test/src/main/java/com/tangem/common/test/domain/network/MockNetworkStatusFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/domain/network/MockNetworkStatusFactory.kt @@ -21,19 +21,20 @@ object MockNetworkStatusFactory { ): NetworkStatus { return NetworkStatus( network = network, - value = NetworkStatus.Verified( - address = NetworkAddress.Single( - defaultAddress = NetworkAddress.Address( - value = "0x1", - type = NetworkAddress.Address.Type.Primary, + value = transform( + NetworkStatus.Verified( + address = NetworkAddress.Single( + defaultAddress = NetworkAddress.Address( + value = "0x1", + type = NetworkAddress.Address.Type.Primary, + ), ), + amounts = emptyMap(), + pendingTransactions = emptyMap(), + yieldSupplyStatuses = emptyMap(), + source = source, ), - amounts = mapOf(), - pendingTransactions = mapOf(), - yieldSupplyStatuses = mapOf(), - source = source, - ) - .let(transform), + ), ) } diff --git a/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt b/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt index a216096699..4afe1d94aa 100644 --- a/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt @@ -37,7 +37,7 @@ object MockUserWalletFactory { return UserWallet.Cold( name = "NODL", walletId = UserWalletId("011"), - cardsInWallet = setOf(), + cardsInWallet = emptySet(), isMultiCurrency = false, scanResponse = MockScanResponseFactory.create( cardConfig = GenericCardConfig(maxWalletCount = 2), diff --git a/common/test/src/main/java/com/tangem/common/test/utils/TruthExt.kt b/common/test/src/main/java/com/tangem/common/test/utils/TruthExt.kt index 3349cef006..baf73d1243 100644 --- a/common/test/src/main/java/com/tangem/common/test/utils/TruthExt.kt +++ b/common/test/src/main/java/com/tangem/common/test/utils/TruthExt.kt @@ -8,11 +8,11 @@ import com.google.common.truth.Truth fun assertEither(actual: Either, expected: Either) { actual .onRight { Truth.assertThat(actual).isEqualTo(expected) } - .onLeft { - val expectedError = expected.leftOrNull() ?: error("Actual is Either.Left: $it") + .onLeft { throwable -> + val expectedError = expected.leftOrNull() ?: error("Actual is Either.Left: $throwable") - Truth.assertThat(it).isInstanceOf(expectedError::class.java) - Truth.assertThat(it).hasMessageThat().isEqualTo(expectedError.message) + Truth.assertThat(throwable).isInstanceOf(expectedError::class.java) + Truth.assertThat(throwable).hasMessageThat().isEqualTo(expectedError.message) } } @@ -24,6 +24,7 @@ fun assertEitherRight(actual: Either) { } } +@Suppress("NullableToStringCall") fun assertEitherLeft(actual: Either, expected: Throwable) { actual .onRight { error("Actual is Either.Right: $it") } diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChart.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChart.kt index e0eafb470d..52f967ed67 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChart.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChart.kt @@ -90,7 +90,7 @@ fun MarketChart( backgroundLineColor = state.chartColor.copy(alpha = backgroundColorAlpha), secondLineColor = splitChartSegmentColor, backgroundSecondLineColor = splitChartSegmentColor.copy(alpha = backgroundSplitChartSegmentColorAlpha), - secondColorOnTheRightSide = state.markerHighlightRightSide.not(), + secondColorOnTheRightSide = state.shouldMarkerHighlightRightSide.not(), markerFraction = state.markerFraction, axisValueOverrider = AxisValueOverrider.fixed(), canvasHeight = chartHeight, @@ -114,10 +114,10 @@ fun MarketChart( CartesianChartHost( modifier = modifier - .onGloballyPositioned { - canvasWidth = it.size.width - chartHeight = if (it.size.height != 0) { - it.size.height - bottomAxisHeight + .onGloballyPositioned { layoutCoordinates -> + canvasWidth = layoutCoordinates.size.width + chartHeight = if (layoutCoordinates.size.height != 0) { + layoutCoordinates.size.height - bottomAxisHeight } else { 0 } @@ -126,7 +126,7 @@ fun MarketChart( .drawBehind { state.markerFraction state.chartColor - state.markerHighlightRightSide + state.shouldMarkerHighlightRightSide }, chart = chart, modelProducer = state.modelProducer, @@ -269,7 +269,7 @@ private fun rememberChartAxisGuidelineComponent(color: Color): LineComponent { // region Preview -@Suppress("LongMethod") +@Suppress("LongMethod", "NullableToStringCall") @Preview(showBackground = true, widthDp = 360) @Preview(showBackground = true, widthDp = 360, uiMode = Configuration.UI_MODE_NIGHT_YES) @Composable @@ -283,7 +283,7 @@ private fun MarketChartPreview( MarketChartDataProducer.build { chartLook = MarketChartLook( type = MarketChartLook.Type.Growing, - markerHighlightRightSide = true, + shouldMarkerHighlightRightSide = true, ) } } @@ -294,8 +294,8 @@ private fun MarketChartPreview( x = x.toImmutableList(), y = y.toImmutableList(), ) - updateLook { - it.copy( + updateLook { marketChartLook -> + marketChartLook.copy( xAxisFormatter = { value -> value.toLong().toTimeFormat(DateTimeFormatters.dateMMMdd) }, @@ -322,8 +322,8 @@ private fun MarketChartPreview( onMarkerShown = { x, y -> markerPoint = Pair(x, y) }, - colorMapper = { - when (it) { + colorMapper = { type -> + when (type) { MarketChartLook.Type.Growing -> growingColor MarketChartLook.Type.Falling -> fallingColor MarketChartLook.Type.Neutral -> neutralColor @@ -354,7 +354,7 @@ private fun MarketChartPreview( onClick = { dataProducer.runTransaction { updateLook { - it.copy(markerHighlightRightSide = !it.markerHighlightRightSide) + it.copy(shouldMarkerHighlightRightSide = !it.shouldMarkerHighlightRightSide) } } }, @@ -367,10 +367,10 @@ private fun MarketChartPreview( onClick = { coroutineScope.launch { dataProducer.runTransactionSuspend { - updateData { + updateData { data -> MarketChartData.Data( - x = it.x, - y = it.y.reversed().toImmutableList(), + x = data.x, + y = data.y.reversed().toImmutableList(), ) } } @@ -383,9 +383,9 @@ private fun MarketChartPreview( Button( onClick = { dataProducer.runTransaction { - updateLook { - it.copy( - type = when (it.type) { + updateLook { look -> + look.copy( + type = when (look.type) { MarketChartLook.Type.Growing -> MarketChartLook.Type.Falling MarketChartLook.Type.Falling -> MarketChartLook.Type.Neutral MarketChartLook.Type.Neutral -> MarketChartLook.Type.Growing diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChartMini.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChartMini.kt index 2e62078f0f..6c564e49e5 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChartMini.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/MarketChartMini.kt @@ -104,10 +104,10 @@ private fun PreviewColumn() { TangemThemePreview { LazyColumn { - items(100) { + items(100) { i -> MarketChartMini( rawData = data, - type = if (it % 3 == 0) MarketChartLook.Type.Growing else MarketChartLook.Type.Falling, + type = if (i % 3 == 0) MarketChartLook.Type.Growing else MarketChartLook.Type.Falling, ) } } diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/downsample/LTThreeBuckets.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/downsample/LTThreeBuckets.kt index 21578b9cc1..88325af11c 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/downsample/LTThreeBuckets.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/downsample/LTThreeBuckets.kt @@ -51,10 +51,10 @@ object LTThreeBuckets { val yRes = ArrayList(points.size) val indexesRes = ArrayList(points.size) - results.fastForEach { - xRes.add(it.x) - yRes.add(it.y) - indexesRes.add(it.originalIndex!!) + results.fastForEach { result -> + xRes.add(result.x) + yRes.add(result.y) + indexesRes.add(requireNotNull(result.originalIndex)) } return Result( diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/ChartMarker.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/ChartMarker.kt index 5ef509c92b..19ed6e31d3 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/ChartMarker.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/ChartMarker.kt @@ -62,12 +62,7 @@ internal fun rememberTangemChartMarker(color: Color): CartesianMarker { }, indicatorSizeDp = INDICATOR_SIZE_DP, guideline = guideline, - valueFormatter = object : CartesianMarkerValueFormatter { - override fun format( - context: CartesianDrawContext, - targets: List, - ): CharSequence = "" - }, + valueFormatter = CartesianMarkerValueFormatter { _, _ -> "" }, ) { override fun updateInsets( context: CartesianMeasureContext, @@ -76,7 +71,12 @@ internal fun rememberTangemChartMarker(color: Color): CartesianMarker { insets: Insets, ) { with(context) { - super.updateInsets(context, horizontalDimensions, model, insets) + super.updateInsets( + context = context, + horizontalDimensions = horizontalDimensions, + model = model, + insets = insets, + ) val baseShadowInsetDp = CLIPPING_FREE_SHADOW_RADIUS_MULTIPLIER * LABEL_BACKGROUND_SHADOW_RADIUS_DP val topInset = (baseShadowInsetDp - LABEL_BACKGROUND_SHADOW_DY_DP).pixels @@ -90,11 +90,11 @@ internal fun rememberTangemChartMarker(color: Color): CartesianMarker { cacheStore .getOrSet(keyNamespace, indicator, outColor) { indicator.invoke(outColor) } .draw( - this, - x - halfIndicatorSize, - y - halfIndicatorSize, - x + halfIndicatorSize, - y + halfIndicatorSize, + context = this, + left = x - halfIndicatorSize, + top = y - halfIndicatorSize, + right = x + halfIndicatorSize, + bottom = y + halfIndicatorSize, ) } } diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/MarketChartLayer.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/MarketChartLayer.kt index a01ceb3d22..c869560ccd 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/MarketChartLayer.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/layer/MarketChartLayer.kt @@ -64,7 +64,7 @@ internal fun rememberMarketChartLayer( val backgroundColorLineGradient = persistentListOf(backgroundLineColor, Color.Transparent) val backgroundSecondLineColorGradient = persistentListOf(backgroundSecondLineColor, Color.Transparent) - val markerSet = markerFraction != null + val isMarkerSet = markerFraction != null return rememberLayer( fractionValue = markerFraction ?: 0f, @@ -75,17 +75,17 @@ internal fun rememberMarketChartLayer( } else { lineColor }, - backLineColor = if (markerSet && !secondColorOnTheRightSide) { + backLineColor = if (isMarkerSet && !secondColorOnTheRightSide) { backgroundSecondLineColorGradient } else { backgroundColorLineGradient }, lineColorRight = when { - markerSet && secondColorOnTheRightSide -> secondLineColor + isMarkerSet && secondColorOnTheRightSide -> secondLineColor else -> lineColor }, backLineColorRight = when { - markerSet && secondColorOnTheRightSide -> backgroundSecondLineColorGradient + isMarkerSet && secondColorOnTheRightSide -> backgroundSecondLineColorGradient else -> backgroundColorLineGradient }, ) @@ -148,7 +148,7 @@ private fun LayerChartPreview( val y = previewData.second.map { it.toFloat() } val x = List(y.size) { it.toFloat() } val model = CartesianChartModel(LineCartesianLayerModel.build { series(x, y) }) - var lineColor by remember { + val lineColor by remember { mutableStateOf(Color.Blue) } diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartDataProducer.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartDataProducer.kt index 86f5ef5dd6..74adf8e118 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartDataProducer.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartDataProducer.kt @@ -85,7 +85,7 @@ class TransactionSuspend( class MarketChartDataProducer private constructor( initialData: MarketChartData, initialLook: MarketChartLook, - val pointsValuesConverter: PointValuesConverter = PriceAndTimePointValuesConverter(needToFormatAxis = true), + val pointsValuesConverter: PointValuesConverter = PriceAndTimePointValuesConverter(shouldFormatAxis = true), private val dispatcher: CoroutineDispatcher = Dispatchers.Default, ) { internal val dataState = MutableStateFlow(initialData) @@ -166,7 +166,7 @@ class MarketChartDataProducer private constructor( * @return A MarketChartDataProducer. */ suspend fun buildSuspend( - pointsValuesConverter: PointValuesConverter = PriceAndTimePointValuesConverter(needToFormatAxis = true), + pointsValuesConverter: PointValuesConverter = PriceAndTimePointValuesConverter(shouldFormatAxis = true), dispatcher: CoroutineDispatcher = Dispatchers.Default, block: TransactionSuspend.() -> Unit, ): MarketChartDataProducer { @@ -191,7 +191,7 @@ class MarketChartDataProducer private constructor( * @return A MarketChartDataProducer. */ fun build( - pointsValuesConverter: PointValuesConverter = PriceAndTimePointValuesConverter(needToFormatAxis = true), + pointsValuesConverter: PointValuesConverter = PriceAndTimePointValuesConverter(shouldFormatAxis = true), dispatcher: CoroutineDispatcher = Dispatchers.Default, block: Transaction.() -> Unit, ): MarketChartDataProducer { diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartLook.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartLook.kt index 72c608da53..2b7599b033 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartLook.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartLook.kt @@ -9,14 +9,14 @@ import com.tangem.common.ui.charts.state.formatter.AxisLabelFormatter * and formatters for x and y axis. * * @property type The type of the chart, can be either Growing or Falling. - * @property markerHighlightRightSide A boolean indicating whether the marker highlights the right side of the chart. + * @property shouldMarkerHighlightRightSide A boolean indicating whether the marker highlights the right side of the chart. * @property xAxisFormatter A formatter for the x-axis labels. * @property yAxisFormatter A formatter for the y-axis labels. */ @Immutable data class MarketChartLook( val type: Type = Type.Growing, - val markerHighlightRightSide: Boolean = true, + val shouldMarkerHighlightRightSide: Boolean = true, val xAxisFormatter: AxisLabelFormatter = AxisLabelFormatter { it.toString() }, val yAxisFormatter: AxisLabelFormatter = AxisLabelFormatter { it.toString() }, ) { diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartState.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartState.kt index e031fc1a27..62c312b4b4 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartState.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/MarketChartState.kt @@ -20,8 +20,8 @@ import java.math.BigDecimal fun rememberMarketChartState( dataProducer: MarketChartDataProducer = remember { MarketChartDataProducer.build {} }, colorMapper: (MarketChartLook.Type) -> Color = remember { - { - when (it) { + { type -> + when (type) { MarketChartLook.Type.Growing -> Color.Green MarketChartLook.Type.Falling -> Color.Red MarketChartLook.Type.Neutral -> Color.Gray @@ -33,7 +33,12 @@ fun rememberMarketChartState( val lookState = dataProducer.lookState.collectAsState() val state = remember(dataProducer, lookState, colorMapper, onMarkerShown) { - MarketChartState(dataProducer, lookState, colorMapper, onMarkerShown) + MarketChartState( + dataProducer = dataProducer, + lookState = lookState, + colorMapper = colorMapper, + markerCallback = onMarkerShown, + ) } return state @@ -61,8 +66,8 @@ class MarketChartState internal constructor( colorMapper(lookState.value.type) } - internal val markerHighlightRightSide by derivedStateOf { - lookState.value.markerHighlightRightSide + internal val shouldMarkerHighlightRightSide by derivedStateOf { + lookState.value.shouldMarkerHighlightRightSide } internal val xValueFormatter = CartesianValueFormatter { value, _, _ -> diff --git a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/converter/PriceAndTimePointValuesConverter.kt b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/converter/PriceAndTimePointValuesConverter.kt index e51a8f72a6..3ea25b6abf 100644 --- a/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/converter/PriceAndTimePointValuesConverter.kt +++ b/common/ui-charts/src/main/kotlin/com/tangem/common/ui/charts/state/converter/PriceAndTimePointValuesConverter.kt @@ -8,7 +8,7 @@ import java.math.BigDecimal @Suppress("MagicNumber") class PriceAndTimePointValuesConverter( - private val needToFormatAxis: Boolean, + private val shouldFormatAxis: Boolean, ) : PointValuesConverter { private data class MinMaxCache( @@ -18,7 +18,12 @@ class PriceAndTimePointValuesConverter( val maxY: BigDecimal, ) - private var minMaxCache = MinMaxCache(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO) + private var minMaxCache = MinMaxCache( + minX = BigDecimal.ZERO, + maxX = BigDecimal.ZERO, + minY = BigDecimal.ZERO, + maxY = BigDecimal.ZERO, + ) private val formatYValuesCache = mutableMapOf() private val formatXValuesCache = mutableMapOf() @@ -37,15 +42,14 @@ class PriceAndTimePointValuesConverter( val normX = data.x.normalizeTime(min = cache.minX, max = cache.maxX) return if (normX.size > MAX_POINTS) { - LTThreeBuckets + val downsampled = LTThreeBuckets .downsample(normX, normY, MAX_POINTS - 2) - .let { - MarketChartRawData( - originalIndexes = it.originalIndexes.toImmutableList(), - x = it.x.toImmutableList(), - y = it.y.toImmutableList(), - ) - } + + MarketChartRawData( + originalIndexes = downsampled.originalIndexes.toImmutableList(), + x = downsampled.x.toImmutableList(), + y = downsampled.y.toImmutableList(), + ) } else { MarketChartRawData( x = normX.toImmutableList(), @@ -55,8 +59,8 @@ class PriceAndTimePointValuesConverter( } override fun prepareRawXForFormat(rawX: Double, data: MarketChartData.Data): BigDecimal { - if (!needToFormatAxis) return BigDecimal.ZERO - if (formatXValuesCache.containsKey(rawX)) return formatXValuesCache[rawX]!! + if (!shouldFormatAxis) return BigDecimal.ZERO + if (formatXValuesCache.containsKey(rawX)) return requireNotNull(formatXValuesCache[rawX]) val result = (rawX * MINUTE).toBigDecimal() @@ -65,8 +69,8 @@ class PriceAndTimePointValuesConverter( } override fun prepareRawYForFormat(rawY: Double, data: MarketChartData.Data): BigDecimal { - if (!needToFormatAxis) return BigDecimal.ZERO - if (formatYValuesCache.containsKey(rawY)) return formatYValuesCache[rawY]!! + if (!shouldFormatAxis) return BigDecimal.ZERO + if (formatYValuesCache.containsKey(rawY)) return requireNotNull(formatYValuesCache[rawY]) val min = minMaxCache.minY val max = minMaxCache.maxY diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceByTransformer.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceByTransformer.kt index 244ea5b4c0..f96fa69bd0 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceByTransformer.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceByTransformer.kt @@ -53,7 +53,7 @@ class AmountReduceByTransformer( val checkValue = if (amountTextField.isFiatValue) fiatValue else cryptoValue val isExceedBalance = checkValue.checkExceedBalance(maxEnterAmount, amountTextField) - val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } ?: false + val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } == true val isZero = if (amountTextField.isFiatValue) { decimalFiatValue.isNullOrZero() } else { diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceToTransformer.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceToTransformer.kt index cb91187d95..0afd5d8bc5 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceToTransformer.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountReduceToTransformer.kt @@ -52,7 +52,7 @@ class AmountReduceToTransformer( val checkValue = if (amountTextField.isFiatValue) fiatValue else cryptoValue val isExceedBalance = checkValue.checkExceedBalance(maxEnterAmount, amountTextField) - val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } ?: false + val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } == true val isZero = if (amountTextField.isFiatValue) decimalFiatValue.isNullOrZero() else value.isNullOrZero() val isCheckFailed = isExceedBalance || isLessThanMinimumIfProvided return prevState.copy( diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt index c3b284e828..1fecef07c0 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/converters/AmountStateConverter.kt @@ -52,7 +52,7 @@ class AmountStateConverter( val status = cryptoCurrencyStatusProvider() val fiat = maxEnterAmount.fiatAmount.format { fiat(appCurrency.code, appCurrency.symbol) } val crypto = maxEnterAmount.amount.format { crypto(status.currency) } - val noFeeRate = status.value.fiatRate.isNullOrZero() + val hasNoFeeRate = status.value.fiatRate.isNullOrZero() return AmountState.Data( title = value.title, @@ -69,7 +69,7 @@ class AmountStateConverter( title = stringReference(status.currency.symbol), iconState = iconStateConverter.convertCustom( value = status, - forceGrayscale = noFeeRate, + forceGrayscale = hasNoFeeRate, showCustomTokenBadge = false, ), isFiat = false, @@ -80,7 +80,7 @@ class AmountStateConverter( isFiat = true, ), ), - isSegmentedButtonsEnabled = !noFeeRate, + isSegmentedButtonsEnabled = !hasNoFeeRate, selectedButton = 0, isRedesignEnabled = false, ) diff --git a/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/GiveTxPermisssionBottomSheet.kt b/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/GiveTxPermisssionBottomSheet.kt index 617f1dda94..0f7a278f3e 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/GiveTxPermisssionBottomSheet.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/GiveTxPermisssionBottomSheet.kt @@ -88,12 +88,12 @@ private fun GiveTxPermissionBottomSheetContent(content: GiveTxPermissionBottomSh PrimaryButtonIconEnd( text = stringResourceSafe(id = R.string.common_approve), iconResId = content.walletInteractionIcon, - showProgress = data.approveButton.loading, + showProgress = data.approveButton.isLoading, modifier = Modifier .fillMaxWidth() .padding(horizontal = TangemTheme.dimens.spacing16), onClick = data.approveButton.onClick, - enabled = data.approveButton.enabled, + enabled = data.approveButton.isEnabled, ) SpacerH12() diff --git a/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/state/GiveTxPermissionState.kt b/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/state/GiveTxPermissionState.kt index 402c43b957..bc870a57e2 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/state/GiveTxPermissionState.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/permission/state/GiveTxPermissionState.kt @@ -39,8 +39,8 @@ enum class ApproveType(val text: TextReference) { } data class ApprovePermissionButton( - val enabled: Boolean, - val loading: Boolean = false, + val isEnabled: Boolean, + val isLoading: Boolean = false, val onClick: () -> Unit, ) diff --git a/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/receive/TokenReceiveBottomSheet.kt b/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/receive/TokenReceiveBottomSheet.kt index 35cbf7f906..9093a606aa 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/receive/TokenReceiveBottomSheet.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/bottomsheet/receive/TokenReceiveBottomSheet.kt @@ -105,9 +105,9 @@ private fun Info( ) } - notifications.fastForEach { - key(it.hashCode()) { - Notification(config = it) + notifications.fastForEach { notificationConfig -> + key(notificationConfig.hashCode()) { + Notification(config = notificationConfig) } } } diff --git a/common/ui/src/main/java/com/tangem/common/ui/navigationButtons/NavigationButtonsBlock.kt b/common/ui/src/main/java/com/tangem/common/ui/navigationButtons/NavigationButtonsBlock.kt index 496559367f..a52403de79 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/navigationButtons/NavigationButtonsBlock.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/navigationButtons/NavigationButtonsBlock.kt @@ -116,7 +116,7 @@ fun NavigationPrimaryButton(primaryButton: NavigationButton?, modifier: Modifier } button.onClick() }, - showProgress = button.showProgress, + showProgress = button.shouldShowProgress, colors = color, textStyle = TangemTheme.typography.subtitle1, icon = icon, @@ -232,7 +232,7 @@ private fun rememberNavigationButton(button: NavigationButton?): MutableState Unit)? = null, ) : Error( title = resourceReference( @@ -101,7 +101,7 @@ sealed class NotificationUM(val config: NotificationConfig) { text = resourceReference( R.string.common_buy_currency, wrappedList( - if (mergeFeeNetworkName) { + if (shouldMergeFeeNetworkName) { "$currencyName ($feeSymbol)" } else { feeName diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt index 8c68959636..87e98e25c4 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationsFactory.kt @@ -62,7 +62,7 @@ object NotificationsFactory { currencyName = tokenStatus.currency.name, feeName = coinStatus.currency.name, feeSymbol = coinStatus.currency.symbol, - mergeFeeNetworkName = false, + shouldMergeFeeNetworkName = false, onClick = { onClick(coinStatus.currency) }, @@ -303,7 +303,7 @@ object NotificationsFactory { currencyName = cryptoCurrencyStatus.currency.name, feeName = cryptoCurrencyWarning.coinCurrency.name, feeSymbol = cryptoCurrencyWarning.coinCurrency.symbol, - mergeFeeNetworkName = shouldMergeFeeNetworkName, + shouldMergeFeeNetworkName = shouldMergeFeeNetworkName, onClick = { onClick(cryptoCurrencyWarning.coinCurrency) }, @@ -320,9 +320,9 @@ object NotificationsFactory { feeName = cryptoCurrencyWarning.feeCurrencyName, feeSymbol = cryptoCurrencyWarning.feeCurrencySymbol, networkName = cryptoCurrencyWarning.networkName, - mergeFeeNetworkName = shouldMergeFeeNetworkName, + shouldMergeFeeNetworkName = shouldMergeFeeNetworkName, onClick = { - currency?.let { + if (currency != null) { onClick(currency) } }, @@ -381,20 +381,22 @@ object NotificationsFactory { add(NotificationUM.Cardano.InsufficientBalanceToTransferToken(sendingCurrency.name)) } BlockchainSdkError.Cardano.InsufficientRemainingBalanceToWithdrawTokens -> { - when (sendingCurrency) { - is CryptoCurrency.Coin -> NotificationUM.Cardano.InsufficientBalanceToTransferCoin - is CryptoCurrency.Token -> { - NotificationUM.Cardano.InsufficientBalanceToTransferToken(sendingCurrency.name) - } - }.let(::add) + add( + when (sendingCurrency) { + is CryptoCurrency.Coin -> NotificationUM.Cardano.InsufficientBalanceToTransferCoin + is CryptoCurrency.Token -> { + NotificationUM.Cardano.InsufficientBalanceToTransferToken(sendingCurrency.name) + } + }, + ) } BlockchainSdkError.Cardano.InsufficientRemainingBalance, BlockchainSdkError.Cardano.InsufficientSendingAdaAmount, -> { - dustValue?.let { + dustValue?.let { value -> add( NotificationUM.Error.MinimumAmountError( - amount = it.format { crypto(sendingCurrency) }, + amount = value.format { crypto(sendingCurrency) }, ), ) } diff --git a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt index da0b138077..5f418d436d 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt @@ -219,15 +219,19 @@ class TokenItemStateConverter( isFlickering = status.value.isFlickering(), icons = buildList { if (!status.getStakedBalance().isZero()) { - TokenItemState.FiatAmountState.Content.IconUM( - iconRes = R.drawable.ic_staking_24, - tint = IconTint.Accent, - ).let(::add) + add( + TokenItemState.FiatAmountState.Content.IconUM( + iconRes = R.drawable.ic_staking_24, + tint = IconTint.Accent, + ), + ) } if (status.value.sources.total == StatusSource.ONLY_CACHE) { - TokenItemState.FiatAmountState.Content.IconUM( - iconRes = R.drawable.ic_error_sync_24, - ).let(::add) + add( + TokenItemState.FiatAmountState.Content.IconUM( + iconRes = R.drawable.ic_error_sync_24, + ), + ) } }.toImmutableList(), ) diff --git a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenPriceText.kt b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenPriceText.kt index 6a337dae15..b470546536 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenPriceText.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenPriceText.kt @@ -23,11 +23,11 @@ fun TokenPriceText(price: String, modifier: Modifier = Modifier, priceChangeType val generalColor = TangemTheme.colors.text.primary1 val color = remember(generalColor) { Animatable(generalColor) } - var animationSkipped by remember { mutableStateOf(false) } + var isAnimationSkipped by remember { mutableStateOf(false) } LaunchedEffect(price) { - if (animationSkipped.not()) { - animationSkipped = true + if (isAnimationSkipped.not()) { + isAnimationSkipped = true return@LaunchedEffect } diff --git a/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/feature/impl/DevFeatureTogglesManager.kt b/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/feature/impl/DevFeatureTogglesManager.kt index 84dd090158..79d78151b7 100644 --- a/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/feature/impl/DevFeatureTogglesManager.kt +++ b/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/feature/impl/DevFeatureTogglesManager.kt @@ -21,7 +21,7 @@ internal class DevFeatureTogglesManager( private val featureTogglesLocalStorage: LocalTogglesStorage, ) : MutableFeatureTogglesManager { - private var fileFeatureTogglesMap: Map = getFileFeatureToggles() + private val fileFeatureTogglesMap: Map = getFileFeatureToggles() private var featureTogglesMap: MutableMap by Delegates.notNull() init { diff --git a/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/version/DefaultVersionProvider.kt b/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/version/DefaultVersionProvider.kt index 105ca52d15..4b21df5542 100644 --- a/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/version/DefaultVersionProvider.kt +++ b/core/config-toggles/src/main/kotlin/com/tangem/core/configtoggle/version/DefaultVersionProvider.kt @@ -23,14 +23,14 @@ internal class DefaultVersionProvider @Inject constructor( private fun getVersionName(): String { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - context.packageManager - .getPackageInfo( - context.packageName, - PackageManager.PackageInfoFlags.of(0), - ) - .versionName!! + requireNotNull( + context + .packageManager + .getPackageInfo(context.packageName, PackageManager.PackageInfoFlags.of(0)) + .versionName, + ) } else { - context.packageManager.getPackageInfo(context.packageName, 0).versionName!! + requireNotNull(context.packageManager.getPackageInfo(context.packageName, 0).versionName) } } diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ApiConfigsManager.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ApiConfigsManager.kt index a111d2b2a0..6cf3d1953e 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ApiConfigsManager.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ApiConfigsManager.kt @@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.StateFlow interface ApiConfigsManager { /** Flag that determines whether the manager is initialized */ - val isInitialized: StateFlow + val initializedState: StateFlow /** Initialize resources */ fun initialize() diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/DevApiConfigsManager.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/DevApiConfigsManager.kt index 08703b2212..4cb42ed9d0 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/DevApiConfigsManager.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/DevApiConfigsManager.kt @@ -28,11 +28,11 @@ internal class DevApiConfigsManager( override val configs: StateFlow> field = MutableStateFlow(value = getInitialConfigs()) - override val isInitialized: StateFlow + override val initializedState: StateFlow field = MutableStateFlow(value = false) override fun initialize() { - isInitialized.value = false + initializedState.value = false appPreferencesStore.getObjectMap(PreferencesKeys.apiConfigsEnvironmentKey) .distinctUntilChanged() @@ -45,8 +45,8 @@ internal class DevApiConfigsManager( savedEnvironments[config.id.name] ?: currentEnvironment } - if (!isInitialized.value) { - isInitialized.value = true + if (!initializedState.value) { + initializedState.value = true } notifyListeners(apiConfigs = apiConfigs, savedEnvironments = savedEnvironments) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MockApiConfigsManager.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MockApiConfigsManager.kt index c423afc4c3..781b4dbf8c 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MockApiConfigsManager.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MockApiConfigsManager.kt @@ -24,7 +24,7 @@ internal class MockApiConfigsManager( override val configs: StateFlow> field = MutableStateFlow(value = getInitialConfigs()) - override val isInitialized: StateFlow = MutableStateFlow(value = true) + override val initializedState: StateFlow = MutableStateFlow(value = true) private val coroutineScope = CoroutineScope(SupervisorJob() + dispatchers.default) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManager.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManager.kt index 8b77808141..0c6bf3942c 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManager.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManager.kt @@ -15,7 +15,7 @@ internal class ProdApiConfigsManager( private val apiConfigs: ApiConfigs, ) : ApiConfigsManager { - override val isInitialized: StateFlow = MutableStateFlow(value = true) + override val initializedState: StateFlow = MutableStateFlow(value = true) override fun initialize() = Unit diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ApiResponseError.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ApiResponseError.kt index f63826874b..1028e2916f 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ApiResponseError.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ApiResponseError.kt @@ -72,14 +72,14 @@ sealed class ApiResponseError : Exception() { /** Represents a network error, typically when there's no connectivity. */ @Suppress("UnusedPrivateMember") - data object NetworkException : ApiResponseError() { - private fun readResolve(): Any = NetworkException + class NetworkException : ApiResponseError() { + private fun readResolve(): Any = NetworkException() } /** Represents a timeout error, typically when the server takes too long to respond. */ @Suppress("UnusedPrivateMember") - data object TimeoutException : ApiResponseError() { - private fun readResolve(): Any = TimeoutException + class TimeoutException : ApiResponseError() { + private fun readResolve(): Any = TimeoutException() } /** @@ -87,5 +87,5 @@ sealed class ApiResponseError : Exception() { * * @property cause The exception that caused this error. */ - data class UnknownException(override val cause: Throwable) : ApiResponseError() + class UnknownException(override val cause: Throwable) : ApiResponseError() } \ No newline at end of file diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ResponseExt.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ResponseExt.kt index a8272de6f1..68ad795052 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ResponseExt.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/response/ResponseExt.kt @@ -58,10 +58,10 @@ internal fun Throwable.toApiError(): ApiResponseError = when (this) { is ConnectException, is UnknownHostException, is SSLHandshakeException, - -> ApiResponseError.NetworkException + -> ApiResponseError.NetworkException() is TimeoutException, is TimeoutCancellationException, is SocketTimeoutException, - -> ApiResponseError.TimeoutException + -> ApiResponseError.TimeoutException() else -> ApiResponseError.UnknownException(cause = this) } \ No newline at end of file diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt index 69e5ccb9a0..39d1864819 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt @@ -4,6 +4,7 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class Asset( @Json(name = "contractAddress") val contractAddress: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/markets/models/response/TokenMarketInfoResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/markets/models/response/TokenMarketInfoResponse.kt index e18e222fd9..0fb1f95598 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/markets/models/response/TokenMarketInfoResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/markets/models/response/TokenMarketInfoResponse.kt @@ -56,6 +56,7 @@ data class TokenMarketInfoResponse( ) @JsonClass(generateAdapter = true) + @Suppress("BooleanPropertyNaming") data class Network( @Json(name = "network_id") val networkId: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/model/OnrampCountryDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/model/OnrampCountryDTO.kt index e7f660a3f4..362fb5dcb4 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/model/OnrampCountryDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/model/OnrampCountryDTO.kt @@ -4,6 +4,7 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class OnrampCountryDTO( @Json(name = "name") val name: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/pay/models/response/TangemPayTxHistoryResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/pay/models/response/TangemPayTxHistoryResponse.kt index c6e87268e6..f3273753ed 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/pay/models/response/TangemPayTxHistoryResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/pay/models/response/TangemPayTxHistoryResponse.kt @@ -26,6 +26,7 @@ data class TangemPayTxHistoryResponse( ) @JsonClass(generateAdapter = true) + @Suppress("BooleanPropertyNaming") data class Spend( @Json(name = "amount") val amount: BigDecimal, @Json(name = "currency") val currency: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt index c7ab58a7fd..37beafb9cd 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt @@ -36,6 +36,7 @@ data class ActionRequestBody( ) @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class ActionRequestBodyArgs( @Json(name = "amount") val amount: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/AddressArgumentDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/AddressArgumentDTO.kt index 6138444c45..eee4f3b4b1 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/AddressArgumentDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/AddressArgumentDTO.kt @@ -5,6 +5,7 @@ import com.squareup.moshi.JsonClass import java.math.BigDecimal @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class AddressArgumentDTO( @Json(name = "required") val required: Boolean, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt index 121730cdcf..27c8cb9b84 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt @@ -1,3 +1,5 @@ +@file:Suppress("BooleanPropertyNaming") + package com.tangem.datasource.api.stakekit.models.response.model import com.squareup.moshi.Json diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt index b3cef83f29..be0fb0cf91 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt @@ -1,3 +1,5 @@ +@file:Suppress("BooleanPropertyNaming") + package com.tangem.datasource.api.stakekit.models.response.model import com.squareup.moshi.Json diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt index de48c2a17a..1fe7409183 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt @@ -1,3 +1,5 @@ +@file:Suppress("BooleanPropertyNaming") + package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json @@ -12,12 +14,13 @@ data class CoinsResponse( ) { @JsonClass(generateAdapter = true) + @Suppress("BooleanPropertyNaming") data class Coin( @Json(name = "id") val id: String, @Json(name = "name") val name: String, @Json(name = "symbol") val symbol: String, @Json(name = "active") val active: Boolean, - @Json(name = "networks") val networks: List = listOf(), + @Json(name = "networks") val networks: List = emptyList(), ) { @JsonClass(generateAdapter = true) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserNetworkAccountResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserNetworkAccountResponse.kt index 829b71dd62..50e345b73e 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserNetworkAccountResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserNetworkAccountResponse.kt @@ -4,6 +4,7 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class CreateUserNetworkAccountResponse( @Json(name = "status") val status: Boolean, @Json(name = "data") val data: AccountCreated, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt index 8e1dec299f..c5f172e68c 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt @@ -5,6 +5,7 @@ import com.squareup.moshi.JsonClass import com.tangem.common.extensions.calculateHashCode @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class UserTokensResponse( @Json(name = "version") val version: Int = 0, @Json(name = "group") val group: GroupType, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletBody.kt index 6ad3704bfb..806199d729 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletBody.kt @@ -4,6 +4,7 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class WalletBody( @Json(name = "notifyStatus") val notifyStatus: Boolean? = null, @Json(name = "name") val name: String? = null, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletResponse.kt index 63263f0a1d..148577e46e 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/WalletResponse.kt @@ -4,6 +4,7 @@ import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) +@Suppress("BooleanPropertyNaming") data class WalletResponse( @Json(name = "notifyStatus") val notifyStatus: Boolean, @Json(name = "id") val id: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/asset/loader/AssetLoader.kt b/core/datasource/src/main/java/com/tangem/datasource/asset/loader/AssetLoader.kt index 3f47419a51..dc0a3f18bf 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/asset/loader/AssetLoader.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/asset/loader/AssetLoader.kt @@ -59,8 +59,8 @@ class AssetLoader @Inject constructor( if (parsedConfig == null) Timber.e(IllegalStateException("Parsed config [$fileName] is null")) parsedConfig.orEmpty() }, - onFailure = { - Timber.e(it, "Failed to load config [$fileName] from assets") + onFailure = { throwable -> + Timber.e(throwable, "Failed to load config [$fileName] from assets") emptyList() }, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/di/utils/RetrofitApiBuilder.kt b/core/datasource/src/main/java/com/tangem/datasource/di/utils/RetrofitApiBuilder.kt index aa2adc0817..b952dc4b5b 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/di/utils/RetrofitApiBuilder.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/di/utils/RetrofitApiBuilder.kt @@ -192,6 +192,7 @@ internal class RetrofitApiBuilder @Inject constructor( } } + @Suppress("UseEmptyCounterpart") private companion object { val excludedApiForLogging: Set = setOf( diff --git a/core/datasource/src/main/java/com/tangem/datasource/exchangeservice/swap/DefaultExpressServiceLoader.kt b/core/datasource/src/main/java/com/tangem/datasource/exchangeservice/swap/DefaultExpressServiceLoader.kt index d5460278ba..5af71f037e 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/exchangeservice/swap/DefaultExpressServiceLoader.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/exchangeservice/swap/DefaultExpressServiceLoader.kt @@ -72,6 +72,7 @@ internal class DefaultExpressServiceLoader @Inject constructor( return flow { getInitializationStatusInternal(userWalletId).collect { emit(it) } } } + @Suppress("SuspendFunWithFlowReturnType") private suspend fun getInitializationStatusInternal(userWalletId: UserWalletId): InitializationStatusFlow { val initializationStatus = initializationStatuses.value.get(key = userWalletId) if (initializationStatus != null) return initializationStatus @@ -79,8 +80,8 @@ internal class DefaultExpressServiceLoader @Inject constructor( val cached = expressAssetsStore.getSyncOrNull(userWalletId) val default: InitializationStatusFlow = MutableStateFlow(value = cached?.lceContent() ?: lceLoading()) - initializationStatuses.update { - it.toMutableMap().apply { + initializationStatuses.update { statuses -> + statuses.toMutableMap().apply { put(key = userWalletId, value = default) } } diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/nft/converter/NFTSdkAssetConverter.kt b/core/datasource/src/main/java/com/tangem/datasource/local/nft/converter/NFTSdkAssetConverter.kt index 8ebb7bd198..e6715dada8 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/nft/converter/NFTSdkAssetConverter.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/nft/converter/NFTSdkAssetConverter.kt @@ -26,10 +26,10 @@ object NFTSdkAssetConverter : TwoWayConverter, NFTAss amount = asset.amount, decimals = asset.decimals, salePrice = salePrice, - rarity = asset.rarity?.let { + rarity = asset.rarity?.let { rarity -> NFTAsset.Rarity( - rank = it.rank, - label = it.label, + rank = rarity.rank, + label = rarity.label, ) }, media = asset.media?.let { @@ -65,22 +65,22 @@ object NFTSdkAssetConverter : TwoWayConverter, NFTAss amount = value.amount, decimals = value.decimals, salePrice = salePrice, - rarity = value.rarity?.let { + rarity = value.rarity?.let { rarity -> SdkNFTAsset.Rarity( - rank = it.rank, - label = it.label, + rank = rarity.rank, + label = rarity.label, ) }, - media = value.media?.let { + media = value.media?.let { media -> SdkNFTAsset.Media( - animationUrl = it.animationUrl, - imageUrl = it.imageUrl, + animationUrl = media.animationUrl, + imageUrl = media.imageUrl, ) }, - traits = value.traits.map { + traits = value.traits.map { trait -> SdkNFTAsset.Trait( - name = it.name, - value = it.value, + name = trait.name, + value = trait.value, ) }, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/preferences/utils/AppPreferencesStoreExt.kt b/core/datasource/src/main/java/com/tangem/datasource/local/preferences/utils/AppPreferencesStoreExt.kt index 647ff92c89..d0ca477e51 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/preferences/utils/AppPreferencesStoreExt.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/preferences/utils/AppPreferencesStoreExt.kt @@ -37,9 +37,9 @@ inline fun AppPreferencesStore.getObject(key: Preferences.Key try { - it[key]?.let(adapter::fromJson) ?: default + prefs[key]?.let(adapter::fromJson) ?: default } catch (e: JsonDataException) { default } diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/swap/DefaultSwapBestRateAnimationStore.kt b/core/datasource/src/main/java/com/tangem/datasource/local/swap/DefaultSwapBestRateAnimationStore.kt index 4f207731c1..09221a9985 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/swap/DefaultSwapBestRateAnimationStore.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/swap/DefaultSwapBestRateAnimationStore.kt @@ -12,10 +12,10 @@ internal class DefaultSwapBestRateAnimationStore( * If true, reset flag to false */ override suspend fun getSyncOrNull(): Boolean { - val value = dataStore.getSyncOrNull() ?: true - if (value) { + val shouldShowBestRateAnimation = dataStore.getSyncOrNull() ?: true + if (shouldShowBestRateAnimation) { dataStore.store(false) } - return value + return shouldShowBestRateAnimation } } \ No newline at end of file diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/token/DefaultTokenReceiveWarningActionStore.kt b/core/datasource/src/main/java/com/tangem/datasource/local/token/DefaultTokenReceiveWarningActionStore.kt index 8be4bb214a..cdfb3f69bc 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/token/DefaultTokenReceiveWarningActionStore.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/token/DefaultTokenReceiveWarningActionStore.kt @@ -8,7 +8,7 @@ internal class DefaultTokenReceiveWarningActionStore( ) : TokenReceiveWarningActionStore { override suspend fun getSync(): Set { - return persistenceStore.data.firstOrNull() ?: emptySet() + return persistenceStore.data.firstOrNull().orEmpty() } override suspend fun store(symbol: String) { diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/token/converter/PendingActionConverter.kt b/core/datasource/src/main/java/com/tangem/datasource/local/token/converter/PendingActionConverter.kt index 161bc9885c..213fbf2fbc 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/token/converter/PendingActionConverter.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/token/converter/PendingActionConverter.kt @@ -19,11 +19,11 @@ internal object PendingActionConverter : Converter PendingAction.PendingActionArgs.Duration( - required = it.required, - minimum = it.minimum, - maximum = it.maximum, + required = duration.required, + minimum = duration.minimum, + maximum = duration.maximum, ) }, validatorAddress = this?.validatorAddress?.required, diff --git a/core/datasource/src/main/java/com/tangem/datasource/utils/HttpClientExt.kt b/core/datasource/src/main/java/com/tangem/datasource/utils/HttpClientExt.kt index eb040fb1e4..eb7727aea3 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/utils/HttpClientExt.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/utils/HttpClientExt.kt @@ -20,9 +20,9 @@ internal fun OkHttpClient.Builder.addHeaders( Interceptor { chain -> val request = chain.request().newBuilder().apply { runBlocking { - requestHeaders.forEach { - val value = it.value.invoke() - if (value.isNotBlank()) addHeader(name = it.key, value = value) + requestHeaders.forEach { header -> + val value = header.value.invoke() + if (value.isNotBlank()) addHeader(name = header.key, value = value) } } }.build() diff --git a/core/datasource/src/main/java/com/tangem/datasource/utils/NetworkLogsSaveInterceptor.kt b/core/datasource/src/main/java/com/tangem/datasource/utils/NetworkLogsSaveInterceptor.kt index c53422bc3f..58b21f35dd 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/utils/NetworkLogsSaveInterceptor.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/utils/NetworkLogsSaveInterceptor.kt @@ -101,7 +101,7 @@ class NetworkLogsSaveInterceptor( private fun logResponseMessage(response: Response, startNs: Long) { val responseHeaders = response.headers - val responseBody = response.body!! + val responseBody = requireNotNull(response.body) val contentLength = responseBody.contentLength() val message = if (!response.promisesBody()) { diff --git a/core/datasource/src/main/java/com/tangem/datasource/utils/RequestHeader.kt b/core/datasource/src/main/java/com/tangem/datasource/utils/RequestHeader.kt index 9375434e78..9e6b000399 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/utils/RequestHeader.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/utils/RequestHeader.kt @@ -46,8 +46,8 @@ sealed class RequestHeader(vararg pairs: Pair>) fun String.checkHeaderValueOrEmpty(): String { for (i in this.indices) { val c = this[i] - val charCondition = c == '\t' || c in '\u0020'..'\u007e' - if (!charCondition) { + val isChar = c == '\t' || c in '\u0020'..'\u007e' + if (!isChar) { return "" } } diff --git a/core/decompose/src/main/kotlin/com/tangem/core/decompose/model/ModelEntryPoint.kt b/core/decompose/src/main/kotlin/com/tangem/core/decompose/model/ModelEntryPoint.kt index 329556fff3..1a8330193d 100644 --- a/core/decompose/src/main/kotlin/com/tangem/core/decompose/model/ModelEntryPoint.kt +++ b/core/decompose/src/main/kotlin/com/tangem/core/decompose/model/ModelEntryPoint.kt @@ -37,6 +37,7 @@ inline fun AppComponentContext.getOrCreateModel(): M = getOr * @param params The parameters to store in the [ParamsContainer], */ +@Suppress("NullableToStringCall") inline fun AppComponentContext.getOrCreateModel( params: P?, messageSender: UiMessageSender? = null, diff --git a/core/res/src/main/java/com/tangem/core/res/Resources.kt b/core/res/src/main/java/com/tangem/core/res/Resources.kt index aea235e3ae..3964c5c093 100644 --- a/core/res/src/main/java/com/tangem/core/res/Resources.kt +++ b/core/res/src/main/java/com/tangem/core/res/Resources.kt @@ -25,11 +25,16 @@ fun Resources.getStringSafe(@StringRes id: Int): String { */ fun Resources.getStringSafe(@StringRes id: Int, vararg formatArgs: Any): String { return runCatching { getString(id, *formatArgs) } - .recoverCatching { + .recoverCatching { throwable -> // If something goes wrong, returns the resource without arguments val string = getString(id) - reportIssue(it, resources = this, id, *formatArgs) + reportIssue( + throwable = throwable, + resources = this, + id = id, + formatArgs = formatArgs, + ) string } @@ -60,8 +65,13 @@ fun Resources.getPluralStringSafe(@PluralsRes id: Int, count: Int, vararg format } private fun Result.getOrResourceName(resources: Resources, id: Int, vararg formatArgs: Any): String { - return getOrElse { - reportIssue(it, resources, id, formatArgs) + return getOrElse { throwable -> + reportIssue( + throwable = throwable, + resources = resources, + id = id, + formatArgs = formatArgs, + ) // If something still goes wrong, returns the resource name resources.getResourceEntryName(id) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/Dialogs.kt b/core/ui/src/main/java/com/tangem/core/ui/components/Dialogs.kt index b8955c8b80..f9baae94a7 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/Dialogs.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/Dialogs.kt @@ -178,14 +178,14 @@ fun SelectorDialog( * Dialog button params * * @param title Button text. If not provided default values will be used - * @param warning If true then button text will be in theme warning color - * @param enabled If false button will be disabled + * @param isWarning If true then button text will be in theme warning color + * @param isEnabled If false button will be disabled * @param onClick Button click callback */ data class DialogButtonUM( val title: String? = null, - val warning: Boolean = false, - val enabled: Boolean = true, + val isWarning: Boolean = false, + val isEnabled: Boolean = true, val onClick: () -> Unit, ) @@ -196,7 +196,7 @@ data class AdditionalTextInputDialogUM( val label: String? = null, val placeholder: String? = null, val caption: String? = null, - val enabled: Boolean = true, + val isEnabled: Boolean = true, val isError: Boolean = false, val errorText: String? = null, ) @@ -276,7 +276,7 @@ private fun DialogContent(type: DialogType, modifier: Modifier = Modifier) { onValueChange = type.onValueChange, isError = type.params.isError, errorText = type.params.errorText, - isEnabled = type.params.enabled, + isEnabled = type.params.isEnabled, placeholder = type.params.placeholder, ) } @@ -289,7 +289,7 @@ private fun DialogContent(type: DialogType, modifier: Modifier = Modifier) { label = type.params.label, placeholder = type.params.placeholder, caption = type.params.caption, - enabled = type.params.enabled, + enabled = type.params.isEnabled, isError = type.params.isError, onValueChange = { newValue -> type.onValueChange(newValue) @@ -324,15 +324,15 @@ private fun DialogButtons( if (dismissButton != null) { DialogButton( text = dismissButton.title ?: stringResourceSafe(id = R.string.common_cancel), - warning = dismissButton.warning, - enabled = dismissButton.enabled, + warning = dismissButton.isWarning, + enabled = dismissButton.isEnabled, onClick = dismissButton.onClick, ) } DialogButton( text = confirmButton.title ?: stringResourceSafe(id = R.string.common_ok), - warning = confirmButton.warning, - enabled = confirmButton.enabled, + warning = confirmButton.isWarning, + enabled = confirmButton.isEnabled, onClick = confirmButton.onClick, ) } @@ -487,7 +487,7 @@ private fun WarningBasicDialogSample(modifier: Modifier = Modifier) { message = "All protected passwords will be deleted from the secure storage, you must enter the wallet " + "password to work with the app", title = "Attention", - confirmButton = DialogButtonUM(warning = true) {}, + confirmButton = DialogButtonUM(isWarning = true) {}, dismissButton = DialogButtonUM {}, onDismissDialog = {}, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/FadeModifier.kt b/core/ui/src/main/java/com/tangem/core/ui/components/FadeModifier.kt index fcf6361bca..50eaa752d7 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/FadeModifier.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/FadeModifier.kt @@ -29,10 +29,10 @@ fun Modifier.edgeFade( require(value = size > 0.dp) { "Size must be greater than '0'" } - val animatedSize = animationSpec?.let { + val animatedSize = animationSpec?.let { spec -> animateDpAsState( targetValue = if (isVisible) size else 0.dp, - animationSpec = it, + animationSpec = spec, label = "Edge fade width", ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/Flicker.kt b/core/ui/src/main/java/com/tangem/core/ui/components/Flicker.kt index 8ed1c1cbaf..c16743c928 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/Flicker.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/Flicker.kt @@ -29,22 +29,22 @@ fun Modifier.flicker( targetTextAlpha: Float = 0.4f, animationDurationMillis: Int = 1500, ): Modifier = composed { - var alphaChange by remember { mutableStateOf(false) } + var shouldAlphaChange by remember { mutableStateOf(false) } val alpha: Float by animateFloatAsState( - targetValue = if (alphaChange) targetTextAlpha else 1f, + targetValue = if (shouldAlphaChange) targetTextAlpha else 1f, animationSpec = tween( durationMillis = animationDurationMillis, easing = CubicBezierEasing(a = 0.45f, b = 0.0f, c = 0.55f, d = 1.0f), ), finishedListener = { - alphaChange = it == 1f && isFlickering + shouldAlphaChange = it == 1f && isFlickering }, ) LaunchedEffect(isFlickering) { if (isFlickering) { - alphaChange = true + shouldAlphaChange = true } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/FullScreen.kt b/core/ui/src/main/java/com/tangem/core/ui/components/FullScreen.kt index fff3c42836..480c909897 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/FullScreen.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/FullScreen.kt @@ -33,7 +33,7 @@ fun FullScreen( val fullScreenLayout = remember { FullScreenLayout( - notTouchable = notTouchable, + isNotTouchable = notTouchable, focusable = focusable, composeView = view, onBackClick = onBackClick, @@ -53,7 +53,7 @@ fun FullScreen( @SuppressLint("ViewConstructor", "ClickableViewAccessibility") private class FullScreenLayout( - private val notTouchable: Boolean, + private val isNotTouchable: Boolean, private val focusable: Boolean, private val composeView: View, private val onBackClick: () -> Unit, @@ -68,10 +68,10 @@ private class FullScreenLayout( override var shouldCreateCompositionOnAttachedToWindow: Boolean = false private set - private var viewShowing = false + private var isViewShowing = false init { - if (notTouchable) { + if (isNotTouchable) { setOnTouchListener { _, _ -> false } } @@ -110,19 +110,19 @@ private class FullScreenLayout( } fun show() { - if (viewShowing) dismiss() + if (isViewShowing) dismiss() windowManager.addView(this, params) if (focusable.not()) { params.flags = params.flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE } - if (notTouchable) { + if (isNotTouchable) { params.flags = params.flags or WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE } windowManager.updateViewLayout(this, params) - viewShowing = true + isViewShowing = true } override fun dispatchKeyEvent(event: KeyEvent): Boolean { @@ -139,10 +139,10 @@ private class FullScreenLayout( } fun dismiss() { - if (!viewShowing) return + if (!isViewShowing) return disposeComposition() windowManager.removeViewImmediate(this) - viewShowing = false + isViewShowing = false } fun dispose() { diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/Keyboard.kt b/core/ui/src/main/java/com/tangem/core/ui/components/Keyboard.kt index 74029fd218..f0755a270b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/Keyboard.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/Keyboard.kt @@ -38,12 +38,12 @@ fun keyboardAsState(): State { val keyboardState = remember { mutableStateOf(keyboardStateInternal) } LaunchedEffect(keyboardStateInternal) { - val falsePositive = Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && + val isFalsePositive = Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && keyboardStateInternal is Keyboard.Opened && keyboardStateInternal.height < 50.dp // FIX android <=10 devices can randomly send ime paddings, // which leads to a false positive keyboard opening ([REDACTED_TASK_KEY]) - if (falsePositive) return@LaunchedEffect + if (isFalsePositive) return@LaunchedEffect keyboardState.value = keyboardStateInternal } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/ResizableText.kt b/core/ui/src/main/java/com/tangem/core/ui/components/ResizableText.kt index f5d84c141b..8ef0050ac3 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/ResizableText.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/ResizableText.kt @@ -45,8 +45,8 @@ fun ResizableText( overflow = overflow, softWrap = false, maxLines = maxLines, - onTextLayout = { - if (it.hasVisualOverflow) { + onTextLayout = { textLayoutResult -> + if (textLayoutResult.hasVisualOverflow) { val nextFontSizeValue = fontSizeValue.floatValue - fontSizeRange.step.value if (nextFontSizeValue <= fontSizeRange.min.value) { fontSizeValue.floatValue = fontSizeRange.min.value @@ -150,8 +150,8 @@ fun ResizableText( overflow = overflow, softWrap = false, maxLines = maxLines, - onTextLayout = { - if (it.hasVisualOverflow) { + onTextLayout = { result -> + if (result.hasVisualOverflow) { val nextFontSizeValue = fontSizeValue.value - fontSizeRange.step.value if (nextFontSizeValue <= fontSizeRange.min.value) { onFontSizeChange(fontSizeRange.min.value) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/SettingsRow.kt b/core/ui/src/main/java/com/tangem/core/ui/components/SettingsRow.kt index b49c5737ad..f3bfb8028b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/SettingsRow.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/SettingsRow.kt @@ -66,7 +66,7 @@ fun SimpleSettingsRow( visible = !subtitle.isNullOrEmpty(), ) { Text( - text = subtitle ?: "", + text = subtitle.orEmpty(), style = TangemTheme.typography.body2, color = rowColors.subtitleColor(enabled = enabled).value, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/Shimmers.kt b/core/ui/src/main/java/com/tangem/core/ui/components/Shimmers.kt index e613aa253a..7b9220c9ad 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/Shimmers.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/Shimmers.kt @@ -169,17 +169,17 @@ private val TangemShimmerColors: List return buildList { if (isInDarkTheme) { - TangemColorPalette.Dark3.let(::add) - TangemColorPalette.Dark4.let(::add) - TangemColorPalette.Dark6.let(::add) - TangemColorPalette.Dark4.let(::add) - TangemColorPalette.Dark3.let(::add) + add(TangemColorPalette.Dark3) + add(TangemColorPalette.Dark4) + add(TangemColorPalette.Dark6) + add(TangemColorPalette.Dark4) + add(TangemColorPalette.Dark3) } else { - TangemColorPalette.Light2.let(::add) - TangemColorPalette.Light1.let(::add) - TangemColorPalette.White.let(::add) - TangemColorPalette.Light1.let(::add) - TangemColorPalette.Light2.let(::add) + add(TangemColorPalette.Light2) + add(TangemColorPalette.Light1) + add(TangemColorPalette.White) + add(TangemColorPalette.Light1) + add(TangemColorPalette.Light2) } } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/TextFields.kt b/core/ui/src/main/java/com/tangem/core/ui/components/TextFields.kt index 2c8c37e80b..93db6bb7e5 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/TextFields.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/TextFields.kt @@ -148,8 +148,8 @@ private fun TangemTextField( text = label, style = TangemTheme.typography.caption2, color = colors.labelColor( - enabled = enabled, - error = isError, + isEnabled = enabled, + isError = isError, interactionSource = interactionSource, ).value, ) @@ -174,7 +174,7 @@ private fun TangemTextField( null }, ) - if (iconRes != null) { + iconRes?.let { iconRes -> IconButton( modifier = Modifier.size(32.dp), onClick = onClear, @@ -182,7 +182,7 @@ private fun TangemTextField( ) { Icon( modifier = Modifier.size(24.dp), - painter = painterResource(id = iconRes!!), + painter = painterResource(id = iconRes), tint = colors.trailingIconColor(enabled = enabled, isError = isError).value, contentDescription = "Clear input", ) @@ -259,8 +259,8 @@ private fun TangemTextFieldWithIcon( text = label, style = TangemTheme.typography.caption2, color = colors.labelColor( - enabled = enabled, - error = isError, + isEnabled = enabled, + isError = isError, interactionSource = interactionSource, ).value, ) @@ -399,19 +399,19 @@ fun TextFieldColors.trailingIconColor(enabled: Boolean, isError: Boolean): State @Composable fun TextFieldColors.indicatorColor( - enabled: Boolean, + isEnabled: Boolean, isError: Boolean, interactionSource: InteractionSource, ): State { - val focused by interactionSource.collectIsFocusedAsState() + val isFocused by interactionSource.collectIsFocusedAsState() val targetValue = when { - !enabled -> disabledIndicatorColor + !isEnabled -> disabledIndicatorColor isError -> errorIndicatorColor - focused -> focusedIndicatorColor + isFocused -> focusedIndicatorColor else -> unfocusedIndicatorColor } - return if (enabled) { + return if (isEnabled) { animateColorAsState( targetValue = targetValue, animationSpec = tween(durationMillis = 120), @@ -428,13 +428,17 @@ fun TextFieldColors.placeholderColor(enabled: Boolean): State { } @Composable -fun TextFieldColors.labelColor(enabled: Boolean, error: Boolean, interactionSource: InteractionSource): State { - val focused by interactionSource.collectIsFocusedAsState() +fun TextFieldColors.labelColor( + isEnabled: Boolean, + isError: Boolean, + interactionSource: InteractionSource, +): State { + val isFocused by interactionSource.collectIsFocusedAsState() val targetValue = when { - !enabled -> disabledLabelColor - error -> errorLabelColor - focused -> focusedLabelColor + !isEnabled -> disabledLabelColor + isError -> errorLabelColor + isFocused -> focusedLabelColor else -> unfocusedLabelColor } return rememberUpdatedState(targetValue) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/AppBarWithSearch.kt b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/AppBarWithSearch.kt index b9c76c147c..f6f4dd18c0 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/AppBarWithSearch.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/AppBarWithSearch.kt @@ -146,7 +146,7 @@ private fun SubtitleView(subtitle: String, icon: Painter?) { horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing4), verticalAlignment = Alignment.CenterVertically, ) { - icon?.let { + icon?.let { icon -> Image( painter = icon, contentDescription = null, @@ -202,9 +202,9 @@ private fun ExpandedSearchView( } TextField( value = textFieldValue, - onValueChange = { - textFieldValue = it - onSearchChange(it.text) + onValueChange = { value -> + textFieldValue = value + onSearchChange(value.text) }, singleLine = true, modifier = Modifier diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt index 467b3ee036..e95fb67f45 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt @@ -21,7 +21,7 @@ fun TopAppBarButton(button: TopAppBarButtonUM, tint: Color, modifier: Modifier = when (button) { is TopAppBarButtonUM.Icon -> { IconButton( - enabled = button.enabled, + enabled = button.isEnabled, modifier = modifier.size(TangemTheme.dimens.size32), onClick = button.onClicked, ) { @@ -36,7 +36,7 @@ fun TopAppBarButton(button: TopAppBarButtonUM, tint: Color, modifier: Modifier = is TopAppBarButtonUM.Text -> { Text( modifier = modifier - .conditional(button.enabled) { + .conditional(button.isEnabled) { clickable { button.onClicked() } } .padding(4.dp), diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt index 3d1549e138..069df6bbca 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt @@ -6,20 +6,20 @@ import com.tangem.core.ui.extensions.TextReference sealed class TopAppBarButtonUM( open val onClicked: () -> Unit, - open val enabled: Boolean = true, + open val isEnabled: Boolean = true, ) { data class Icon( @DrawableRes val iconRes: Int, override val onClicked: () -> Unit, - override val enabled: Boolean = true, - ) : TopAppBarButtonUM(onClicked, enabled) + override val isEnabled: Boolean = true, + ) : TopAppBarButtonUM(onClicked, isEnabled) data class Text( val text: TextReference, override val onClicked: () -> Unit, - override val enabled: Boolean = true, - ) : TopAppBarButtonUM(onClicked, enabled) + override val isEnabled: Boolean = true, + ) : TopAppBarButtonUM(onClicked, isEnabled) @Suppress("FunctionName") companion object { @@ -29,19 +29,19 @@ sealed class TopAppBarButtonUM( fun Back(enabled: Boolean = true, onBackClicked: () -> Unit) = Icon( iconRes = R.drawable.ic_back_24, onClicked = onBackClicked, - enabled = enabled, + isEnabled = enabled, ) fun Close(enabled: Boolean = true, onCloseClick: () -> Unit) = Icon( iconRes = R.drawable.ic_close_24, onClicked = onCloseClick, - enabled = enabled, + isEnabled = enabled, ) fun Text(text: TextReference, onTextClicked: () -> Unit, enabled: Boolean = true) = Text( text = text, onClicked = onTextClicked, - enabled = enabled, + isEnabled = enabled, ) } } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/internal/ModalBottomSheetWithBackHandling.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/internal/ModalBottomSheetWithBackHandling.kt index b4df773674..95ce4090db 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/internal/ModalBottomSheetWithBackHandling.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/internal/ModalBottomSheetWithBackHandling.kt @@ -50,8 +50,11 @@ fun ModalBottomSheetWithBackHandling( modifier = modifier .focusRequester(requester) .focusable() - .onPreviewKeyEvent { - if (it.key == Key.Back && it.type == KeyEventType.KeyUp && !it.nativeKeyEvent.isCanceled) { + .onPreviewKeyEvent { keyEvent -> + if (keyEvent.key == Key.Back && + keyEvent.type == KeyEventType.KeyUp && + !keyEvent.nativeKeyEvent.isCanceled + ) { backPressedDispatcherOwner?.onBackPressedDispatcher?.onBackPressed() return@onPreviewKeyEvent true } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheet.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheet.kt index 9ecae2ab38..7fd0a2bcb0 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheet.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheet.kt @@ -84,7 +84,7 @@ internal fun Content(model: MessageBottomSheetUM, modifier: Modifier = Modifier) PrimaryButton( modifier = Modifier.fillMaxWidth(), text = model.primaryAction.text.resolveReference(), - enabled = model.primaryAction.enabled, + enabled = model.primaryAction.isEnabled, onClick = model.primaryAction.onClick, ) } @@ -93,7 +93,7 @@ internal fun Content(model: MessageBottomSheetUM, modifier: Modifier = Modifier) SecondaryButton( modifier = Modifier.fillMaxWidth(), text = model.secondaryAction.text.resolveReference(), - enabled = model.secondaryAction.enabled, + enabled = model.secondaryAction.isEnabled, onClick = model.secondaryAction.onClick, ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetUM.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetUM.kt index 88a40bd846..c07d11f22a 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetUM.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetUM.kt @@ -14,7 +14,7 @@ data class MessageBottomSheetUM( data class ActionUM( val text: TextReference, - val enabled: Boolean = true, + val isEnabled: Boolean = true, val onClick: () -> Unit, ) } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetV2.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetV2.kt index bdb7f5f705..f31c547290 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetV2.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/message/MessageBottomSheetV2.kt @@ -64,8 +64,8 @@ fun MessageBottomSheetV2(state: MessageBottomSheetUMV2, onDismissRequest: () -> @Composable fun MessageBottomSheetV2Content(state: MessageBottomSheetUMV2, modifier: Modifier = Modifier) { Column(modifier = modifier) { - state.elements.fastForEach { - when (it) { + state.elements.fastForEach { element -> + when (element) { is MessageBottomSheetUMV2.InfoBlock -> { ContentContainer( modifier = Modifier @@ -73,7 +73,7 @@ fun MessageBottomSheetV2Content(state: MessageBottomSheetUMV2, modifier: Modifie .fillMaxWidth() .padding(horizontal = TangemTheme.dimens.spacing16) .padding(bottom = 32.dp), - state = it, + state = element, ) } else -> Unit @@ -94,32 +94,32 @@ private fun ContentContainer(state: MessageBottomSheetUMV2.InfoBlock, modifier: state.icon?.let { BottomSheetIcon(it) } - state.title?.let { + state.title?.let { title -> Text( modifier = Modifier .fillMaxWidth() .padding(top = TangemTheme.dimens.spacing24), - text = it.resolveReference(), + text = title.resolveReference(), style = TangemTheme.typography.h3, color = TangemTheme.colors.text.primary1, textAlign = TextAlign.Center, ) } - state.body?.let { + state.body?.let { body -> Text( modifier = Modifier .fillMaxWidth() .padding(top = TangemTheme.dimens.spacing8), - text = it.resolveReference(), + text = body.resolveReference(), style = TangemTheme.typography.body2, color = TangemTheme.colors.text.secondary, textAlign = TextAlign.Center, ) } - state.chip?.let { + state.chip?.let { chip -> BottomSheetChip( modifier = Modifier.padding(top = TangemTheme.dimens.spacing16), - chip = it, + chip = chip, ) } } @@ -193,16 +193,16 @@ private fun ButtonsContainer( verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing8), ) { buttons.fastForEach { button -> - val icon = button.icon?.let { + val icon = button.icon?.let { iconResId -> when (button.iconOrder) { - IconOrder.Start -> TangemButtonIconPosition.Start(it) - IconOrder.End -> TangemButtonIconPosition.End(it) + IconOrder.Start -> TangemButtonIconPosition.Start(iconResId) + IconOrder.End -> TangemButtonIconPosition.End(iconResId) } } ?: TangemButtonIconPosition.None TangemButton( modifier = Modifier.fillMaxWidth(), - text = button.text?.resolveReference() ?: "", + text = button.text?.resolveReference().orEmpty(), icon = icon, onClick = { button.onClick?.invoke(closeScope) }, colors = if (button.isPrimary) { diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheet.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheet.kt index b239dfc92b..2d29c50afc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheet.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheet.kt @@ -95,9 +95,10 @@ inline fun DefaultModalBottomSheet( var isVisible by remember { mutableStateOf(value = config.isShown) } val sheetState = rememberModalBottomSheetState( skipPartiallyExpanded = skipPartiallyExpanded, - confirmValueChange = { + confirmValueChange = { sheetValue -> if (!dismissOnClickOutside) { - it != SheetValue.Hidden // Ignore transitions to hidden (prevents dismiss on outside click/back press) + // Ignore transitions to hidden (prevents dismiss on outside click/back press) + sheetValue != SheetValue.Hidden } else { true } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/sheet/TangemBottomSheet.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/sheet/TangemBottomSheet.kt index 26ad428e58..0a9f35bb67 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/sheet/TangemBottomSheet.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/sheet/TangemBottomSheet.kt @@ -163,11 +163,11 @@ inline fun BasicBottomSheet( val bsContent: @Composable ColumnScope.() -> Unit = { Column( - modifier = Modifier.let { + modifier = Modifier.let { modifier -> if (addBottomInsets) { - it.padding(bottom = bottomBarHeight) + modifier.padding(bottom = bottomBarHeight) } else { - it + modifier } }, ) { diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/buttons/HorizontalActionChips.kt b/core/ui/src/main/java/com/tangem/core/ui/components/buttons/HorizontalActionChips.kt index d84ac5aacb..fb3874c760 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/buttons/HorizontalActionChips.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/buttons/HorizontalActionChips.kt @@ -77,7 +77,7 @@ private class ActionButtonConfigProvider : CollectionPreviewParameterProvider Unit, val icon: TangemButtonIconPosition = TangemButtonIconPosition.None, - val enabled: Boolean = true, + val isEnabled: Boolean = true, ) /** @@ -79,7 +79,7 @@ private fun SmallButton(config: SmallButtonConfig, isPrimary: Boolean, modifier: color = backgroundColor, shape = shape, ) - .clickable(enabled = config.enabled, onClick = config.onClick) + .clickable(enabled = config.isEnabled, onClick = config.onClick) .padding( paddingValues = when (config.icon) { is TangemButtonIconPosition.None -> PaddingValues( @@ -103,7 +103,7 @@ private fun SmallButton(config: SmallButtonConfig, isPrimary: Boolean, modifier: text = { val textColor by animateColorAsState( targetValue = when { - !config.enabled -> TangemTheme.colors.text.disabled + !config.isEnabled -> TangemTheme.colors.text.disabled isPrimary -> TangemTheme.colors.text.primary2 else -> TangemTheme.colors.text.primary1 }, @@ -122,7 +122,7 @@ private fun SmallButton(config: SmallButtonConfig, isPrimary: Boolean, modifier: Icon( modifier = Modifier.size(TangemTheme.dimens.size16), painter = painterResource(id = iconResId), - tint = if (config.enabled) { + tint = if (config.isEnabled) { TangemTheme.colors.icon.secondary } else { TangemTheme.colors.icon.inactive @@ -188,7 +188,7 @@ private fun ButtonsSample() { config = config.copy( text = TextReference.Str(value = "Add token"), icon = TangemButtonIconPosition.Start(iconResId = R.drawable.ic_plus_24), - enabled = false, + isEnabled = false, ), ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/ActionButtonConfig.kt b/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/ActionButtonConfig.kt index 290b811544..1bbbcd821c 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/ActionButtonConfig.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/ActionButtonConfig.kt @@ -6,15 +6,14 @@ import com.tangem.core.ui.extensions.TextReference /** * Action button config * - * @property text text - * @property iconResId icon resource id - * @property onClick lambda be invoked when action component is clicked - * @property onLongClick lambda be invoked when action component is long clicked - * @property enabled enabled - * @property dimContent determines whether the button content will be dimmed. This property will be ignored if [enabled] - * is `false`. - * @property isInProgress indicates progress state of button - * @property showBadge display dot in upper right corner + * @property text text + * @property iconResId icon resource id + * @property onClick lambda be invoked when action component is clicked + * @property onLongClick lambda be invoked when action component is long clicked + * @property isEnabled enabled + * @property shouldDimContent determines whether the button content will be dimmed. This property will be ignored if [isEnabled] is `false`. + * @property isInProgress indicates progress state of button + * @property shouldShowBadge display dot in upper right corner * [REDACTED_AUTHOR] */ @@ -23,8 +22,8 @@ data class ActionButtonConfig( @DrawableRes val iconResId: Int, val onClick: () -> Unit, val onLongClick: (() -> TextReference?)? = null, - val enabled: Boolean = true, - val dimContent: Boolean = false, + val isEnabled: Boolean = true, + val shouldDimContent: Boolean = false, val isInProgress: Boolean = false, - val showBadge: Boolean = false, + val shouldShowBadge: Boolean = false, ) \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/Actions.kt b/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/Actions.kt index 110fc5cc3a..64765e5c99 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/Actions.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/buttons/actions/Actions.kt @@ -55,11 +55,11 @@ fun RoundedActionButton( ActionBaseButton( config = config, shape = RoundedCornerShape(size = TangemTheme.dimens.radius24), - content = { + content = { modifier -> ActionButtonContent( config = config, - text = { Text(text = config.text, textColor = it) }, - modifier = it.padding( + text = { color -> Text(text = config.text, textColor = color) }, + modifier = modifier.padding( start = TangemTheme.dimens.spacing16, end = TangemTheme.dimens.spacing24, ), @@ -118,7 +118,7 @@ fun ActionBaseButton( ) { val context = LocalContext.current val backgroundColor by animateColorAsState( - targetValue = if (config.enabled) color else TangemTheme.colors.button.disabled, + targetValue = if (config.isEnabled) color else TangemTheme.colors.button.disabled, label = "Update background color", ) @@ -128,17 +128,17 @@ fun ActionBaseButton( .widthIn(min = 100.dp) .drawWithContent { drawContent() - if (config.showBadge) { + if (config.shouldShowBadge) { drawBadge(containerColor = containerColor) } } .clip(shape) .combinedClickable( - enabled = config.enabled, + enabled = config.isEnabled, onClick = config.onClick, onLongClick = { val toastReference = config.onLongClick?.invoke() - toastReference?.let { + toastReference?.let { toastReference -> Toast .makeText(context, toastReference.resolveReference(context.resources), Toast.LENGTH_SHORT) .show() @@ -175,8 +175,8 @@ fun ActionButtonContent( verticalAlignment = Alignment.CenterVertically, ) { val iconTint = when { - !config.enabled -> TangemTheme.colors.icon.informative - config.dimContent -> TangemTheme.colors.icon.informative + !config.isEnabled -> TangemTheme.colors.icon.informative + config.shouldDimContent -> TangemTheme.colors.icon.informative else -> TangemTheme.colors.icon.primary1 } Icon( @@ -220,8 +220,8 @@ private fun Loading(backgroundColor: Color, modifier: Modifier = Modifier) { @ReadOnlyComposable fun getTextColor(config: ActionButtonConfig): Color { return when { - !config.enabled -> TangemTheme.colors.text.disabled - config.dimContent -> TangemTheme.colors.text.tertiary + !config.isEnabled -> TangemTheme.colors.text.disabled + config.shouldDimContent -> TangemTheme.colors.text.tertiary else -> TangemTheme.colors.text.primary1 } } @@ -249,27 +249,27 @@ private class ActionStateProvider : CollectionPreviewParameterProvider Text( - text = it.text, + text = configPreview.text, modifier = Modifier.padding(TangemTheme.dimens.spacing16), ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIcon.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIcon.kt index 04ede1d5ba..bb17dc63b6 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIcon.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIcon.kt @@ -127,7 +127,7 @@ private fun BoxScope.ContentIconContainer( ) } - if (icon.showCustomBadge) { + if (icon.shouldShowCustomBadge) { CurrencyIconBottomBadge( modifier = Modifier.align(Alignment.BottomEnd), ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconState.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconState.kt index 65107776ea..420e0a839f 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconState.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconState.kt @@ -15,7 +15,7 @@ import com.tangem.core.ui.extensions.TextReference sealed class CurrencyIconState { abstract val isGrayscale: Boolean - abstract val showCustomBadge: Boolean + abstract val shouldShowCustomBadge: Boolean abstract val topBadgeIconResId: Int? /** @@ -24,13 +24,13 @@ sealed class CurrencyIconState { * @property url The URL where the coin icon can be fetched from. May be `null` if not found. * @property fallbackResId The drawable resource ID to be used as a fallback if the URL is not available. * @property isGrayscale Specifies whether to show the icon in grayscale. - * @property showCustomBadge Specifies whether to show the custom token badge. + * @property shouldShowCustomBadge Specifies whether to show the custom token badge. */ data class CoinIcon( val url: String?, @DrawableRes val fallbackResId: Int, override val isGrayscale: Boolean, - override val showCustomBadge: Boolean, + override val shouldShowCustomBadge: Boolean, ) : CurrencyIconState() { override val topBadgeIconResId: Int? = null @@ -42,7 +42,7 @@ sealed class CurrencyIconState { * @property url The URL where the token icon can be fetched from. May be `null` if not found. * @property topBadgeIconResId The drawable resource ID for the network badge. May be `null`. * @property isGrayscale Specifies whether to show the icon in grayscale. - * @property showCustomBadge Specifies whether to show the custom token badge. + * @property shouldShowCustomBadge Specifies whether to show the custom token badge. * @property fallbackTint The color to be used for tinting the fallback icon. * @property fallbackBackground The background color to be used for the fallback icon. */ @@ -50,7 +50,7 @@ sealed class CurrencyIconState { val url: String?, @DrawableRes override val topBadgeIconResId: Int?, override val isGrayscale: Boolean, - override val showCustomBadge: Boolean, + override val shouldShowCustomBadge: Boolean, val fallbackTint: Color, val fallbackBackground: Color, ) : CurrencyIconState() @@ -62,14 +62,14 @@ sealed class CurrencyIconState { * @property background The background color to be used for the icon. * @property topBadgeIconResId The drawable resource ID for the network badge. * @property isGrayscale Specifies whether to show the icon in grayscale. - * @property showCustomBadge Specifies whether to show the custom token badge. + * @property shouldShowCustomBadge Specifies whether to show the custom token badge. */ data class CustomTokenIcon( val tint: Color, val background: Color, @DrawableRes override val topBadgeIconResId: Int, override val isGrayscale: Boolean, - override val showCustomBadge: Boolean = true, + override val shouldShowCustomBadge: Boolean = true, ) : CurrencyIconState() /** @@ -83,13 +83,13 @@ sealed class CurrencyIconState { @DrawableRes val fallbackResId: Int, ) : CurrencyIconState() { override val isGrayscale: Boolean = false - override val showCustomBadge: Boolean = false + override val shouldShowCustomBadge: Boolean = false override val topBadgeIconResId: Int? = null } @Immutable sealed class CryptoPortfolio : CurrencyIconState() { - override val showCustomBadge: Boolean = false + override val shouldShowCustomBadge: Boolean = false override val topBadgeIconResId: Int? = null abstract val color: Color @@ -108,13 +108,13 @@ sealed class CurrencyIconState { data object Loading : CurrencyIconState() { override val isGrayscale: Boolean = false - override val showCustomBadge: Boolean = false + override val shouldShowCustomBadge: Boolean = false override val topBadgeIconResId: Int? = null } data object Locked : CurrencyIconState() { override val isGrayscale: Boolean = false - override val showCustomBadge: Boolean = false + override val shouldShowCustomBadge: Boolean = false override val topBadgeIconResId: Int? = null } @@ -122,27 +122,27 @@ sealed class CurrencyIconState { @DrawableRes val resId: Int = R.drawable.ic_empty_64, ) : CurrencyIconState() { override val isGrayscale: Boolean = true - override val showCustomBadge: Boolean = false + override val shouldShowCustomBadge: Boolean = false override val topBadgeIconResId: Int? = null } fun copySealed( isGrayscale: Boolean = this.isGrayscale, - showCustomBadge: Boolean = this.showCustomBadge, + showCustomBadge: Boolean = this.shouldShowCustomBadge, topBadgeIconResId: Int? = this.topBadgeIconResId, ): CurrencyIconState = when (this) { is CoinIcon -> copy( isGrayscale = isGrayscale, - showCustomBadge = showCustomBadge, + shouldShowCustomBadge = showCustomBadge, ) is CustomTokenIcon -> copy( isGrayscale = isGrayscale, - showCustomBadge = showCustomBadge, + shouldShowCustomBadge = showCustomBadge, topBadgeIconResId = topBadgeIconResId ?: this.topBadgeIconResId, ) is TokenIcon -> copy( isGrayscale = isGrayscale, - showCustomBadge = showCustomBadge, + shouldShowCustomBadge = showCustomBadge, topBadgeIconResId = topBadgeIconResId, ) is CryptoPortfolio.Icon -> copy( diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconStateBuilder.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconStateBuilder.kt index 1aaed64244..204df382e5 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconStateBuilder.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/CurrencyIconStateBuilder.kt @@ -28,7 +28,7 @@ object CurrencyIconStateBuilder { url = url, fallbackResId = fallbackResId, isGrayscale = isGrayscale, - showCustomBadge = showCustomBadge, + shouldShowCustomBadge = showCustomBadge, ) private fun createTokenIcon( @@ -44,7 +44,7 @@ object CurrencyIconStateBuilder { isGrayscale = isGrayscale, fallbackTint = fallbackTint, fallbackBackground = fallbackBackground, - showCustomBadge = showCustomBadge, + shouldShowCustomBadge = showCustomBadge, ) private fun createCustomTokenIcon( @@ -58,7 +58,7 @@ object CurrencyIconStateBuilder { background = background, topBadgeIconResId = topBadgeIconResId, isGrayscale = isGrayscale, - showCustomBadge = showCustomBadge, + shouldShowCustomBadge = showCustomBadge, ) private fun fromCoin( @@ -77,8 +77,8 @@ object CurrencyIconStateBuilder { isGrayscale: Boolean = false, showCustomBadge: Boolean = true, ): CurrencyIconState { - val grayScale = isGrayscale || token.network.isTestnet - val background = token.tryGetBackgroundForTokenIcon(grayScale) + val isGrayscaleOrTestnet = isGrayscale || token.network.isTestnet + val background = token.tryGetBackgroundForTokenIcon(isGrayscaleOrTestnet) val tint = getTintForTokenIcon(background) return if (token.isCustom && token.iconUrl == null) { @@ -86,14 +86,14 @@ object CurrencyIconStateBuilder { tint = tint, background = background, topBadgeIconResId = token.networkIconResId, - isGrayscale = grayScale, + isGrayscale = isGrayscaleOrTestnet, showCustomBadge = showCustomBadge, ) } else { createTokenIcon( url = token.iconUrl, topBadgeIconResId = token.networkIconResId, - isGrayscale = grayScale, + isGrayscale = isGrayscaleOrTestnet, fallbackTint = tint, fallbackBackground = background, showCustomBadge = token.isCustom && showCustomBadge, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/converter/CryptoCurrencyToIconStateConverter.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/converter/CryptoCurrencyToIconStateConverter.kt index 152ff9caf6..c954f883c4 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/converter/CryptoCurrencyToIconStateConverter.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/converter/CryptoCurrencyToIconStateConverter.kt @@ -62,7 +62,7 @@ class CryptoCurrencyToIconStateConverter( url = coin.iconUrl, fallbackResId = coin.networkIconResId, isGrayscale = forceGrayscale || coin.network.isTestnet || isUnreachable || !isAvailable, - showCustomBadge = coin.isCustom && showCustomBadge, + shouldShowCustomBadge = coin.isCustom && showCustomBadge, ) } @@ -72,8 +72,8 @@ class CryptoCurrencyToIconStateConverter( showCustomBadge: Boolean = true, forceGrayscale: Boolean = false, ): CurrencyIconState { - val grayScale = forceGrayscale || token.network.isTestnet || isErrorStatus || !isAvailable - val background = token.tryGetBackgroundForTokenIcon(grayScale) + val isGrayscale = forceGrayscale || token.network.isTestnet || isErrorStatus || !isAvailable + val background = token.tryGetBackgroundForTokenIcon(isGrayscale) val tint = getTintForTokenIcon(background) return if (token.isCustom && token.iconUrl == null) { @@ -81,17 +81,17 @@ class CryptoCurrencyToIconStateConverter( tint = tint, background = background, topBadgeIconResId = token.networkIconResId, - isGrayscale = grayScale, - showCustomBadge = showCustomBadge, + isGrayscale = isGrayscale, + shouldShowCustomBadge = showCustomBadge, ) } else { CurrencyIconState.TokenIcon( url = token.iconUrl, topBadgeIconResId = token.networkIconResId, - isGrayscale = grayScale, + isGrayscale = isGrayscale, fallbackTint = tint, fallbackBackground = background, - showCustomBadge = token.isCustom && showCustomBadge, // `true` for tokens with custom derivation + shouldShowCustomBadge = token.isCustom && showCustomBadge, // `true` for tokens with custom derivation ) } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/dropdownmenu/TangemDropdownMenu.kt b/core/ui/src/main/java/com/tangem/core/ui/components/dropdownmenu/TangemDropdownMenu.kt index d5b7e7ea6d..cbdae62d7e 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/dropdownmenu/TangemDropdownMenu.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/dropdownmenu/TangemDropdownMenu.kt @@ -221,9 +221,9 @@ internal data class DropdownMenuPositionProvider( val toTop = anchorBounds.top - contentOffsetY - popupContentSize.height val toCenter = anchorBounds.top - popupContentSize.height / 2 val toDisplayBottom = windowSize.height - popupContentSize.height - verticalMargin - val y = sequenceOf(toBottom, toTop, toCenter, toDisplayBottom).firstOrNull { - it >= verticalMargin && - it + popupContentSize.height <= windowSize.height - verticalMargin + val y = sequenceOf(toBottom, toTop, toCenter, toDisplayBottom).firstOrNull { element -> + element >= verticalMargin && + element + popupContentSize.height <= windowSize.height - verticalMargin } ?: toTop onPositionCalculated( diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt index 3ec5ffc54c..1a04519e27 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt @@ -189,24 +189,24 @@ private class AmountTextFieldPreviewProvider : PreviewParameterProvider + if (value.text.length <= length) { + onValueChange(value.text) } }, modifier = modifier diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SearchBar.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SearchBar.kt index f7ec1628af..c0390dfda0 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SearchBar.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SearchBar.kt @@ -56,8 +56,8 @@ fun SearchBar( modifier = modifier .fillMaxWidth() .heightIn(min = TangemTheme.dimens.size48) - .onFocusChanged { - if (it.isFocused) { + .onFocusChanged { focusState -> + if (focusState.isFocused) { state.onActiveChange(true) } else { state.onActiveChange(false) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleDialogTextField.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleDialogTextField.kt index 197385d9d9..53cc8c6d5f 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleDialogTextField.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleDialogTextField.kt @@ -51,10 +51,10 @@ fun SimpleDialogTextField( val strokeWidth = 2f val y = size.height - strokeWidth / 2 drawLine( - strokeColor, - Offset(0f, y), - Offset(size.width, y), - strokeWidth, + color = strokeColor, + start = Offset(0f, y), + end = Offset(size.width, y), + strokeWidth = strokeWidth, ) }, decorationBox = { textValue -> diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt index e5c732ea8c..db68ddfa92 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt @@ -91,10 +91,10 @@ fun SimpleTextField( onValueChange = { newTextFieldValueState -> textFieldValueState = newTextFieldValueState - val stringChangedSinceLastInvocation = lastTextValue != newTextFieldValueState.text + val isStringChangedSinceLastInvocation = lastTextValue != newTextFieldValueState.text lastTextValue = newTextFieldValueState.text - if (stringChangedSinceLastInvocation) onValueChange(newTextFieldValueState.text) + if (isStringChangedSinceLastInvocation) onValueChange(newTextFieldValueState.text) }, textStyle = textStyle, cursorBrush = SolidColor(TangemTheme.colors.text.primary1), @@ -133,9 +133,9 @@ private fun SimpleTextPlaceholder( AnimatedContent( targetState = placeholder, label = "Placeholder Change Animation", - ) { + ) { placeholder -> Text( - text = it.resolveReference(), + text = placeholder.resolveReference(), style = textStyle, color = color, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/grid/EnumeratedTwoColumnGrid.kt b/core/ui/src/main/java/com/tangem/core/ui/components/grid/EnumeratedTwoColumnGrid.kt index f3c88b8cde..8f5aaa9d91 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/grid/EnumeratedTwoColumnGrid.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/grid/EnumeratedTwoColumnGrid.kt @@ -93,10 +93,10 @@ private inline fun VerticalGrid( private fun Preview() { TangemThemePreview { EnumeratedTwoColumnGrid( - items = List(24) { + items = List(24) { i -> EnumeratedTwoColumnGridItem( - index = it + 1, - mnemonic = "word${it + 1}", + index = i + 1, + mnemonic = "word${i + 1}", ) }.toImmutableList(), ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowBestRate.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowBestRate.kt index 03201dcd0a..1dea3f423a 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowBestRate.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowBestRate.kt @@ -81,7 +81,7 @@ fun InputRowBestRate( ) } SpacerWMax() - onIconClick?.let { + if (onIconClick != null) { Icon( painter = painterResource(id = R.drawable.ic_chevron_right_24), contentDescription = null, @@ -144,7 +144,7 @@ private fun InputRowBestRatePreview( title = data.title, titleExtra = data.titleExtra, subtitle = data.subtitle, - showTag = data.showTag, + showTag = data.shouldShowTag, onIconClick = data.iconClick, modifier = Modifier .background(TangemTheme.colors.background.action), @@ -155,7 +155,7 @@ private fun InputRowBestRatePreview( private data class InputRowBestRatePreviewData( val title: TextReference, val titleExtra: TextReference, - val showTag: Boolean, + val shouldShowTag: Boolean, val subtitle: TextReference, val iconClick: (() -> Unit)?, ) @@ -167,14 +167,14 @@ private class InputRowBestRatePreviewDataProvider : PreviewParameterProvider Text( text = title.resolveReference(), style = TangemTheme.typography.subtitle2, @@ -86,7 +86,7 @@ fun InputRowDefault( modifier = Modifier.testTag(BaseBlockTestTags.BLOCK_TEXT), ) } - iconRes?.let { + iconRes?.let { iconRes -> Icon( painter = painterResource(id = iconRes), contentDescription = null, @@ -120,7 +120,7 @@ private fun InputRowDefaultPreview( title = TextReference.Str(data.title), text = TextReference.Str(data.text), iconRes = data.iconRes, - showDivider = data.showDivider, + showDivider = data.shouldShowDivider, modifier = Modifier.background(TangemTheme.colors.background.action), ) } @@ -130,7 +130,7 @@ private data class InputRowDefaultPreviewData( val title: String, val text: String, val iconRes: Int?, - val showDivider: Boolean, + val shouldShowDivider: Boolean, ) private class InputRowDefaultPreviewDataProvider : PreviewParameterProvider { @@ -140,13 +140,13 @@ private class InputRowDefaultPreviewDataProvider : PreviewParameterProvider Icon( painter = painterResource(id = iconRes), contentDescription = null, @@ -148,7 +148,7 @@ private fun InputRowEnterPreview( title = TextReference.Str(data.title), text = data.text, iconRes = data.iconRes, - showDivider = data.showDivider, + showDivider = data.shouldShowDivider, description = stringReference(""), onValueChange = {}, modifier = Modifier.background(TangemTheme.colors.background.action), @@ -160,7 +160,7 @@ private data class InputRowEnterPreviewData( val title: String, val text: String, val iconRes: Int?, - val showDivider: Boolean, + val shouldShowDivider: Boolean, ) private class InputRowEnterPreviewDataProvider : @@ -171,13 +171,13 @@ private class InputRowEnterPreviewDataProvider : title = "title", text = "text", iconRes = null, - showDivider = true, + shouldShowDivider = true, ), InputRowEnterPreviewData( title = "title", text = "text", iconRes = R.drawable.ic_chevron_right_24, - showDivider = false, + shouldShowDivider = false, ), ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt index a3fda95160..885e3531b0 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt @@ -93,7 +93,7 @@ fun InputRowEnterAmount( .padding(top = TangemTheme.dimens.spacing8), ) } - iconRes?.let { + iconRes?.let { iconRes -> Icon( painter = painterResource(id = iconRes), contentDescription = null, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfo.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfo.kt index cde9e9b0dd..b6db7ff219 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfo.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfo.kt @@ -77,9 +77,9 @@ fun InputRowEnterInfo( .padding(top = TangemTheme.dimens.spacing8) .weight(1f), ) - info?.let { + info?.let { info -> Text( - text = it.resolveReference(), + text = info.resolveReference(), style = TangemTheme.typography.body2, color = infoColor, modifier = Modifier @@ -104,7 +104,7 @@ private fun InputRowEnterInfoPreview( title = data.title, text = data.text, info = data.info, - showDivider = data.showDivider, + showDivider = data.shouldShowDivider, onValueChange = {}, modifier = Modifier.background(TangemTheme.colors.background.action), ) @@ -114,7 +114,7 @@ private fun InputRowEnterInfoPreview( private data class InputRowEnterInfoPreviewData( val title: TextReference, val text: String, - val showDivider: Boolean, + val shouldShowDivider: Boolean, val info: TextReference?, ) @@ -125,13 +125,13 @@ private class InputRowEnterInfoPreviewDataProvider : InputRowEnterInfoPreviewData( title = TextReference.Str("title"), text = "text", - showDivider = true, + shouldShowDivider = true, info = TextReference.Str("info"), ), InputRowEnterInfoPreviewData( title = TextReference.Str("title"), text = "text", - showDivider = false, + shouldShowDivider = false, info = null, ), ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt index b129ec948f..cbf84eee89 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt @@ -97,9 +97,9 @@ fun InputRowEnterInfoAmount( .padding(top = TangemTheme.dimens.spacing8) .weight(1f), ) - info?.let { + info?.let { info -> Text( - text = it.resolveReference(), + text = info.resolveReference(), style = TangemTheme.typography.body2, color = infoColor, modifier = Modifier @@ -185,9 +185,9 @@ fun InputRowEnterInfoAmountV2( .padding(top = TangemTheme.dimens.spacing8) .weight(1f), ) - info?.let { + info?.let { info -> Text( - text = it.resolveReference(), + text = info.resolveReference(), style = TangemTheme.typography.body2, color = infoColor, modifier = Modifier diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImage.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImage.kt index 90abca3970..dd8b097ad0 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImage.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImage.kt @@ -102,7 +102,7 @@ fun InputRowImage( modifier = Modifier.padding(top = TangemTheme.dimens.spacing2), ) } - iconRes?.let { + iconRes?.let { iconRes -> Icon( painter = painterResource(id = iconRes), contentDescription = null, @@ -137,7 +137,7 @@ private fun InputRowInputEnterInfoPreview( iconRes = data.actionIconRes, onIconClick = {}, showNetworkIcon = false, - showDivider = data.showDivider, + showDivider = data.shouldShowDivider, ) } } @@ -147,9 +147,9 @@ private data class InputRowImagePreviewData( val subtitle: TextReference, val caption: TextReference, val iconState: CurrencyIconState, - val showDivider: Boolean, + val shouldShowDivider: Boolean, val actionIconRes: Int?, - val showNetworkIcon: Boolean = false, + val shouldShowNetworkIcon: Boolean = false, ) private class InputRowImagePreviewDataProvider : @@ -162,8 +162,8 @@ private class InputRowImagePreviewDataProvider : caption = TextReference.Str("caption"), iconState = CurrencyIconState.Locked, actionIconRes = null, - showDivider = false, - showNetworkIcon = false, + shouldShowDivider = false, + shouldShowNetworkIcon = false, ), InputRowImagePreviewData( title = TextReference.Str("title"), @@ -171,8 +171,8 @@ private class InputRowImagePreviewDataProvider : caption = TextReference.Str("caption"), iconState = CurrencyIconState.Locked, actionIconRes = R.drawable.ic_chevron_right_24, - showDivider = true, - showNetworkIcon = true, + shouldShowDivider = true, + shouldShowNetworkIcon = true, ), ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageInfo.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageInfo.kt index c908519e10..b5fbc11286 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageInfo.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageInfo.kt @@ -115,7 +115,7 @@ fun InputRowImageInfo( color = TangemTheme.colors.text.primary1, ) } - infoSubtitle?.let { + if (infoSubtitle != null) { if (infoSubtitle is TextReference.Annotated) { Text( text = infoSubtitle.resolveAnnotatedReference(), diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageSelector.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageSelector.kt index e94c8d5191..e0cfef7e34 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageSelector.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowImageSelector.kt @@ -118,7 +118,7 @@ private fun InputRowImageSelectorPreview( private data class InputRowImageSelectorPreviewData( val subtitle: TextReference, val caption: TextReference, - val showDivider: Boolean, + val shouldShowDivider: Boolean, val actionIconRes: Int?, val isSelected: Boolean, ) @@ -131,14 +131,14 @@ private class InputRowImageSelectorPreviewDataProvider : subtitle = TextReference.Str("subtitle"), caption = TextReference.Str("caption"), actionIconRes = null, - showDivider = false, + shouldShowDivider = false, isSelected = false, ), InputRowImageSelectorPreviewData( subtitle = TextReference.Str("subtitle"), caption = TextReference.Str("caption"), actionIconRes = R.drawable.ic_chevron_right_24, - showDivider = true, + shouldShowDivider = true, isSelected = true, ), ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowRecipient.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowRecipient.kt index 759d32590b..2da1b7ee46 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowRecipient.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowRecipient.kt @@ -89,9 +89,9 @@ fun InputRowRecipient( .fillMaxWidth() .padding(TangemTheme.dimens.spacing12), ) { - AnimatedContent(targetState = titleText, label = "Title Change") { + AnimatedContent(targetState = titleText, label = "Title Change") { title -> Text( - text = it.resolveReference(), + text = title.resolveReference(), style = TangemTheme.typography.subtitle2, color = color, modifier = Modifier.testTag(SendAddressScreenTestTags.ADDRESS_TEXT_FIELD_TITLE), diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/list/InfiniteListHandler.kt b/core/ui/src/main/java/com/tangem/core/ui/components/list/InfiniteListHandler.kt index 8f5f5ba4b7..a4248c9d93 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/list/InfiniteListHandler.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/list/InfiniteListHandler.kt @@ -10,7 +10,7 @@ fun InfiniteListHandler( buffer: Int = 2, triggerLoadMoreCheckOnItemsCountChange: Boolean = false, ) { - val loadMore by remember(buffer, listState) { + val shouldLoadMore by remember(buffer, listState) { derivedStateOf { val layoutInfo = listState.layoutInfo val totalItemsNumber = layoutInfo.totalItemsCount @@ -21,17 +21,17 @@ fun InfiniteListHandler( } val totalItemsCount by remember(listState) { derivedStateOf { listState.layoutInfo.totalItemsCount } } - var emitted by remember(totalItemsCount, buffer, listState) { mutableStateOf(false) } + var isEmitted by remember(key1 = totalItemsCount, key2 = buffer, key3 = listState) { mutableStateOf(false) } - LaunchedEffect(loadMore) { - if (loadMore && !emitted) { - emitted = onLoadMore() + LaunchedEffect(shouldLoadMore) { + if (shouldLoadMore && !isEmitted) { + isEmitted = onLoadMore() } } LaunchedEffect(totalItemsCount) { - if (triggerLoadMoreCheckOnItemsCountChange && loadMore && !emitted) { - emitted = onLoadMore() + if (triggerLoadMoreCheckOnItemsCountChange && shouldLoadMore && !isEmitted) { + isEmitted = onLoadMore() } } } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/CurrencyNotification.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/CurrencyNotification.kt index e1b4cc4b24..1170828687 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/CurrencyNotification.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/CurrencyNotification.kt @@ -111,9 +111,21 @@ private fun Preview_Notification() { url = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins/large/usd-coin.png", topBadgeIconResId = R.drawable.ic_polygon_22, isGrayscale = false, - showCustomBadge = false, - fallbackTint = Color(1.0f, 1.0f, 1.0f, 1.0f, ColorSpaces.Srgb), - fallbackBackground = Color(0.23529412f, 0.28627452f, 0.6117647f, 1.0f, ColorSpaces.Srgb), + shouldShowCustomBadge = false, + fallbackTint = Color( + red = 1.0f, + green = 1.0f, + blue = 1.0f, + alpha = 1.0f, + colorSpace = ColorSpaces.Srgb, + ), + fallbackBackground = Color( + red = 0.23529412f, + green = 0.28627452f, + blue = 0.6117647f, + alpha = 1.0f, + colorSpace = ColorSpaces.Srgb, + ), ), buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig( text = stringReference("Go to token"), diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NoteMigrationNotification.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NoteMigrationNotification.kt index 8bb1793279..fb78dbe2f9 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NoteMigrationNotification.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NoteMigrationNotification.kt @@ -52,9 +52,9 @@ fun NoteMigrationNotification(config: NotificationConfig, modifier: Modifier = M verticalArrangement = Arrangement.spacedBy(10.dp), horizontalAlignment = Alignment.CenterHorizontally, ) { - config.title?.let { + config.title?.let { title -> Text( - text = it.resolveReference(), + text = title.resolveReference(), color = TangemColorPalette.White, style = TangemTheme.typography.h3, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt index 94026d5ae3..6de247399b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/Notification.kt @@ -84,7 +84,7 @@ fun Notification( titleColor = titleColor, subtitle = config.subtitle, subtitleColor = subtitleColor, - showArrowIcon = isEnabled && config.showArrowIcon, + showArrowIcon = isEnabled && config.shouldShowArrowIcon, ) } } @@ -256,7 +256,7 @@ private fun SingleSecondaryButton(config: NotificationButtonsState.SecondaryButt modifier = Modifier.fillMaxWidth(), iconResId = config.iconResId, enabled = isEnabled, - showProgress = config.showProgress, + showProgress = config.shouldShowProgress, ) } else { SecondaryButton( @@ -265,7 +265,7 @@ private fun SingleSecondaryButton(config: NotificationButtonsState.SecondaryButt modifier = Modifier.fillMaxWidth(), size = TangemButtonSize.WideAction, enabled = isEnabled, - showProgress = config.showProgress, + showProgress = config.shouldShowProgress, ) } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationConfig.kt b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationConfig.kt index fab4badd0c..57338f98b4 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationConfig.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/notifications/NotificationConfig.kt @@ -26,7 +26,7 @@ data class NotificationConfig( val buttonsState: ButtonsState? = null, val onClick: (() -> Unit)? = null, val onCloseClick: (() -> Unit)? = null, - val showArrowIcon: Boolean = onClick != null, + val shouldShowArrowIcon: Boolean = onClick != null, val iconTint: IconTint = IconTint.Unspecified, val iconSize: Dp = 20.dp, ) { @@ -44,7 +44,7 @@ data class NotificationConfig( val text: TextReference, @DrawableRes val iconResId: Int? = null, val onClick: () -> Unit, - val showProgress: Boolean = false, + val shouldShowProgress: Boolean = false, ) : ButtonsState() data class PairButtonsConfig( diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/progressbar/TangemLinearProgressIndicator.kt b/core/ui/src/main/java/com/tangem/core/ui/components/progressbar/TangemLinearProgressIndicator.kt index e9fddfa79e..8b97ce00c2 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/progressbar/TangemLinearProgressIndicator.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/progressbar/TangemLinearProgressIndicator.kt @@ -57,7 +57,13 @@ fun TangemLinearProgressIndicator( ) { val strokeWidth = size.height drawLinearIndicatorBackground(backgroundColor, strokeWidth, strokeCap) - drawLinearIndicator(0f, coercedProgress(), color, strokeWidth, strokeCap) + drawLinearIndicator( + startFraction = 0f, + endFraction = coercedProgress(), + color = color, + strokeWidth = strokeWidth, + strokeCap = strokeCap, + ) } } @@ -144,11 +150,11 @@ fun TangemLinearProgressIndicator( } if ((secondLineHead - secondLineTail) > 0) { drawLinearIndicator( - secondLineHead, - secondLineTail, - color, - strokeWidth, - strokeCap, + startFraction = secondLineHead, + endFraction = secondLineTail, + color = color, + strokeWidth = strokeWidth, + strokeCap = strokeCap, ) } } @@ -209,18 +215,24 @@ private fun DrawScope.drawLinearIndicator( if (abs(endFraction - startFraction) > 0) { // Progress line drawLine( - color, - Offset(adjustedBarStart, yOffset), - Offset(adjustedBarEnd, yOffset), - strokeWidth, - strokeCap, + color = color, + start = Offset(adjustedBarStart, yOffset), + end = Offset(adjustedBarEnd, yOffset), + strokeWidth = strokeWidth, + cap = strokeCap, ) } } } private fun DrawScope.drawLinearIndicatorBackground(color: Color, strokeWidth: Float, strokeCap: StrokeCap) = - drawLinearIndicator(0f, 1f, color, strokeWidth, strokeCap) + drawLinearIndicator( + startFraction = 0f, + endFraction = 1f, + color = color, + strokeWidth = strokeWidth, + strokeCap = strokeCap, + ) // Indeterminate linear indicator transition specs // Total duration for one cycle @@ -238,10 +250,10 @@ private const val FIRST_LINE_TAIL_DELAY = 333 private const val SECOND_LINE_HEAD_DELAY = 1000 private const val SECOND_LINE_TAIL_DELAY = 1267 -private val FIRST_LINE_HEAD_EASING = CubicBezierEasing(0.2f, 0f, 0.8f, 1f) -private val FIRST_LINE_TAIL_EASING = CubicBezierEasing(0.4f, 0f, 1f, 1f) -private val SECOND_LINE_HEAD_EASING = CubicBezierEasing(0f, 0f, 0.65f, 1f) -private val SECOND_LINE_TAIL_EASING = CubicBezierEasing(0.1f, 0f, 0.45f, 1f) +private val FIRST_LINE_HEAD_EASING = CubicBezierEasing(a = 0.2f, b = 0f, c = 0.8f, d = 1f) +private val FIRST_LINE_TAIL_EASING = CubicBezierEasing(a = 0.4f, b = 0f, c = 1f, d = 1f) +private val SECOND_LINE_HEAD_EASING = CubicBezierEasing(a = 0f, b = 0f, c = 0.65f, d = 1f) +private val SECOND_LINE_TAIL_EASING = CubicBezierEasing(a = 0.1f, 0f, 0.45f, d = 1f) // region Preview @Preview(showBackground = true, widthDp = 360) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt index 2f66450aba..781bc8b851 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ActionRow.kt @@ -34,16 +34,16 @@ fun SimpleActionRow(title: String, description: String, modifier: Modifier = Mod .align(Alignment.CenterStart), verticalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing8), ) { - AnimatedContent(targetState = title, label = "") { + AnimatedContent(targetState = title, label = "") { title -> Text( - text = it, + text = title, style = TangemTheme.typography.caption2, color = TangemTheme.colors.text.secondary, ) } - AnimatedContent(targetState = description, label = "") { + AnimatedContent(targetState = description, label = "") { description -> Text( - text = it, + text = description, style = TangemTheme.typography.body2, color = TangemTheme.colors.text.primary1, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ChainRow.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ChainRow.kt index ffe4aae9e2..3e2074a6ee 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ChainRow.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ChainRow.kt @@ -37,12 +37,12 @@ fun ChainRow(model: ChainRowUM, modifier: Modifier = Modifier, action: @Composab RowText( mainText = model.name, secondText = model.type, - subtitle = if (model.showCustom) { + subtitle = if (model.shouldShowCustom) { resourceReference(R.string.common_custom) } else { null }, - isEnabled = model.enabled, + isEnabled = model.isEnabled, accentMainText = true, accentSecondText = false, ) @@ -95,25 +95,25 @@ private class ChainRowParameterProvider : CollectionPreviewParameterProvider( listOf( @@ -51,7 +51,7 @@ internal class TangemSnackbarModelProvider : CollectionPreviewParameterProvider< ): TangemSnackbarModel { return TangemSnackbarModel( snackbarData = createSnackbarData(message, actionLabel), - actionOnNewLine = actionOnNewLine, + hasActionOnNewLine = actionOnNewLine, ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt b/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt index e4b1688630..bafee71188 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/stories/inner/StoriesStepStateMachine.kt @@ -10,7 +10,7 @@ class StoriesStepStateMachine( private val isRepeatable: Boolean, ) { - private var _currentIndex = mutableIntStateOf(FIRST_INDEX) + private val _currentIndex = mutableIntStateOf(FIRST_INDEX) val steps = stories.lastIndex val currentIndex: IntState diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/token/TokenItem.kt b/core/ui/src/main/java/com/tangem/core/ui/components/token/TokenItem.kt index 7bb297765a..68212fff41 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/token/TokenItem.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/token/TokenItem.kt @@ -481,7 +481,7 @@ private fun Preview_TokenItem_InLight(@PreviewParameter(TokenItemStateProvider:: private class TokenItemStateProvider : CollectionPreviewParameterProvider( collection = listOf( tokenItemVisibleState.copy( - iconState = coinIconState.copy(showCustomBadge = true), + iconState = coinIconState.copy(shouldShowCustomBadge = true), titleState = TokenItemState.TitleState.Content( text = stringReference(value = "PolygonPolygonPolygonPolygonPolygonPolygon"), hasPending = true, @@ -621,7 +621,7 @@ private class TokenItemStateProvider : CollectionPreviewParameterProvider = WrappedList(emptyList()), - val decapitalize: Boolean = false, + val shouldDecapitalize: Boolean = false, ) : TextReference /** @@ -171,7 +171,7 @@ fun TextReference.resolveReference(): String { val resolvedReference = stringResourceSafe(id = id, *args) - if (decapitalize) { + if (shouldDecapitalize) { resolvedReference.replaceFirstChar { char -> char.lowercase() } } else { resolvedReference diff --git a/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalCryptoFormat.kt b/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalCryptoFormat.kt index ef2cf399a6..cae9546835 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalCryptoFormat.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalCryptoFormat.kt @@ -17,7 +17,7 @@ open class BigDecimalCryptoFormat( val symbol: String, val decimals: Int, val locale: Locale = Locale.getDefault(), - val ignoreSymbolPosition: Boolean = false, + val shouldIgnoreSymbolPosition: Boolean = false, ) : BigDecimalFormat { override fun invoke(value: BigDecimal): String = defaultAmount()(value) @@ -56,7 +56,7 @@ fun BigDecimalFormatScope.crypto( return BigDecimalCryptoFormat( symbol = cryptoCurrency.symbol, decimals = cryptoCurrency.decimals, - ignoreSymbolPosition = ignoreSymbolPosition, + shouldIgnoreSymbolPosition = ignoreSymbolPosition, locale = locale, ) } @@ -64,7 +64,7 @@ fun BigDecimalFormatScope.crypto( // == Formatters == fun BigDecimalCryptoFormat.defaultAmount() = BigDecimalFormat { value -> - if (ignoreSymbolPosition) { + if (shouldIgnoreSymbolPosition) { val formatter = NumberFormat.getInstance(locale).apply { maximumFractionDigits = decimals.coerceAtMost(maximumValue = 8) minimumFractionDigits = 2 diff --git a/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalPercentFormat.kt b/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalPercentFormat.kt index b7019d1d3c..84e5870e68 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalPercentFormat.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/format/bigdecimal/BigDecimalPercentFormat.kt @@ -6,7 +6,7 @@ import java.text.NumberFormat import java.util.Locale class BigDecimalPercentFormat( - val withoutSign: Boolean = true, + val isWithoutSign: Boolean = true, val locale: Locale = Locale.getDefault(), ) : BigDecimalFormat { override fun invoke(value: BigDecimal): String = default()(value) @@ -19,7 +19,7 @@ fun BigDecimalFormatScope.percent( locale: Locale = Locale.getDefault(), ): BigDecimalPercentFormat { return BigDecimalPercentFormat( - withoutSign = withoutSign, + isWithoutSign = withoutSign, locale = locale, ) } @@ -33,7 +33,7 @@ private fun BigDecimalPercentFormat.default(): BigDecimalFormat = BigDecimalForm roundingMode = RoundingMode.HALF_UP } - val valueToFormat = if (withoutSign) value.abs() else value + val valueToFormat = if (isWithoutSign) value.abs() else value formatter.format(valueToFormat) } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/message/EventMessage.kt b/core/ui/src/main/java/com/tangem/core/ui/message/EventMessage.kt index d2988d0b0c..173b9d2094 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/message/EventMessage.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/message/EventMessage.kt @@ -9,7 +9,6 @@ import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetV2Ds import com.tangem.core.ui.components.bottomsheets.message.messageBottomSheetUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference -import com.tangem.core.ui.message.SnackbarMessage.Duration /** * Event that is used to show a message in the UI. @@ -88,7 +87,7 @@ data class SnackbarMessage( * @param secondAction The second dialog action to perform. Optional, `null` by default. * Performing the second action always dismisses the dialog. * @param isDismissable If `false` then dialog can not be dismissed by back button click or by outside click. - * @param dismissOnFirstAction If `true` then dialog is dismissed when first action is performed, + * @param shouldDismissOnFirstAction If `true` then dialog is dismissed when first action is performed, * ignoring lambda passed to [EventMessageAction.onClick]. * `true` by default. * @param onDismissRequest The action to perform when the dialog is dismissed. @@ -99,7 +98,7 @@ data class DialogMessage( val firstAction: EventMessageAction, val secondAction: EventMessageAction? = null, val isDismissable: Boolean = true, - val dismissOnFirstAction: Boolean = true, + val shouldDismissOnFirstAction: Boolean = true, val onDismissRequest: () -> Unit = {}, ) : EventMessage { @@ -138,7 +137,7 @@ data class DialogMessage( message = message, title = title, isDismissable = isDismissable, - dismissOnFirstAction = dismissOnFirstAction, + shouldDismissOnFirstAction = dismissOnFirstAction, onDismissRequest = onDismissRequest, firstAction = firstActionBuilder(buttonsScope), secondAction = secondActionBuilder?.invoke(buttonsScope), @@ -214,14 +213,14 @@ fun bottomSheetMessage(init: @MessageBottomSheetV2Dsl MessageBottomSheetUMV2.() * Represents an action button in the dialog. * * @param title The title of the action. - * @param warning If `true` then the action is highlighted as a warning. - * @param enabled If `false` then the action is disabled. + * @param isWarning If `true` then the action is highlighted as a warning. + * @param isEnabled If `false` then the action is disabled. * @param onClick The action to perform when the button is clicked. * */ data class EventMessageAction( val title: TextReference, - val warning: Boolean = false, - val enabled: Boolean = true, + val isWarning: Boolean = false, + val isEnabled: Boolean = true, val onClick: () -> Unit, ) { diff --git a/core/ui/src/main/java/com/tangem/core/ui/message/EventMessageEffect.kt b/core/ui/src/main/java/com/tangem/core/ui/message/EventMessageEffect.kt index 8d23185045..c7e40837a1 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/message/EventMessageEffect.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/message/EventMessageEffect.kt @@ -100,7 +100,7 @@ fun EventMessageEffect( ) } - loadingMessage?.let { + if (loadingMessage != null) { LoadingDialog() } } @@ -140,7 +140,7 @@ private fun MessageBottomSheet(message: BottomSheetMessage, onDismissRequest: () primaryAction = message.firstAction?.let { action -> MessageBottomSheetUM.ActionUM( text = action.title, - enabled = action.enabled, + isEnabled = action.isEnabled, onClick = { action.onClick() onDismissRequest() @@ -150,7 +150,7 @@ private fun MessageBottomSheet(message: BottomSheetMessage, onDismissRequest: () secondaryAction = message.secondAction?.let { action -> MessageBottomSheetUM.ActionUM( text = action.title, - enabled = action.enabled, + isEnabled = action.isEnabled, onClick = { action.onClick() onDismissRequest() @@ -172,12 +172,12 @@ private fun MessageDialog(message: DialogMessage, onDismissRequest: () -> Unit) confirmButton = message.firstAction.let { action -> DialogButtonUM( title = action.title.resolveReference(), - warning = action.warning, - enabled = action.enabled, + isWarning = action.isWarning, + isEnabled = action.isEnabled, onClick = { action.onClick() - if (message.dismissOnFirstAction) { + if (message.shouldDismissOnFirstAction) { onDismissRequest() } }, @@ -186,8 +186,8 @@ private fun MessageDialog(message: DialogMessage, onDismissRequest: () -> Unit) dismissButton = message.secondAction?.let { action -> DialogButtonUM( title = action.title.resolveReference(), - warning = action.warning, - enabled = action.enabled, + isWarning = action.isWarning, + isEnabled = action.isEnabled, onClick = { action.onClick() onDismissRequest() diff --git a/core/ui/src/main/java/com/tangem/core/ui/message/dialog/Dialogs.kt b/core/ui/src/main/java/com/tangem/core/ui/message/dialog/Dialogs.kt index da674fa0d6..08fb5a9e46 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/message/dialog/Dialogs.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/message/dialog/Dialogs.kt @@ -49,7 +49,7 @@ object Dialogs { title = resourceReference(R.string.common_ok), onClick = {}, ), - dismissOnFirstAction = true, + shouldDismissOnFirstAction = true, onDismissRequest = onDismiss, ) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/reordarable/ReorderableItem.kt b/core/ui/src/main/java/com/tangem/core/ui/reordarable/ReorderableItem.kt index 7df813a2e5..74b76b1479 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/reordarable/ReorderableItem.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/reordarable/ReorderableItem.kt @@ -25,7 +25,15 @@ inline fun LazyItemScope.ReorderableItem( index: Int? = null, orientationLocked: Boolean = true, content: @Composable BoxScope.(isDragging: Boolean) -> Unit, -) = ReorderableItem(reorderableState, key, modifier, Modifier.animateItem(), orientationLocked, index, content) +) = ReorderableItem( + state = reorderableState, + key = key, + modifier = modifier, + defaultDraggingModifier = Modifier.animateItem(), + orientationLocked = orientationLocked, + index = index, + content = content, +) /** * Fixed version of ReorderableItem from reorderable library. @@ -41,7 +49,15 @@ inline fun LazyGridItemScope.ReorderableItem( modifier: Modifier = Modifier, index: Int? = null, content: @Composable BoxScope.(isDragging: Boolean) -> Unit, -) = ReorderableItem(reorderableState, key, modifier, Modifier.animateItem(), false, index, content) +) = ReorderableItem( + state = reorderableState, + key = key, + modifier = modifier, + defaultDraggingModifier = Modifier.animateItem(), + orientationLocked = false, + index = index, + content = content, +) /** * Fixed version of ReorderableItem from reorderable library. @@ -79,7 +95,8 @@ inline fun ReorderableItem( key == state.dragCancelledAnimation.position?.key } if (cancel) { - Modifier.zIndex(1f) + Modifier + .zIndex(1f) .graphicsLayer { translationX = if (!orientationLocked || !state.isVerticalScroll) { state.dragCancelledAnimation.offset.x diff --git a/core/ui/src/main/java/com/tangem/core/ui/utils/DecimalFormatterExt.kt b/core/ui/src/main/java/com/tangem/core/ui/utils/DecimalFormatterExt.kt index 06d5fe6b63..c39566e4c2 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/utils/DecimalFormatterExt.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/utils/DecimalFormatterExt.kt @@ -162,15 +162,15 @@ fun String.parseBigDecimalOrNull() = runCatching { // We assume there will be only decimal separator, otherwise parsing will fail. // Step 1. Exclude formatted (100,000.0) except scientific notation (100.000e10) - val excludeFormatted = this.count { + val shouldExcludeFormatted = this.count { !it.isDigit() && !it.equals(SCIENTIFIC_NOTATION, ignoreCase = true) } > DECIMAL_SEPARATOR_LIMIT // Step 2. Exclude wrong scientific notation (100e100e100) - val excludeWrongScientific = this.count { + val shouldExcludeWrongScientific = this.count { it.equals(SCIENTIFIC_NOTATION, ignoreCase = true) } > DECIMAL_SEPARATOR_LIMIT - if (excludeFormatted || excludeWrongScientific) return null + if (shouldExcludeFormatted || shouldExcludeWrongScientific) return null // An attempt to parse value with POINT decimal separator val parsed = this.toBigDecimalOrNull() diff --git a/core/ui/src/main/java/com/tangem/core/ui/utils/PathUtils.kt b/core/ui/src/main/java/com/tangem/core/ui/utils/PathUtils.kt index 8ab1fe470b..d3bcf6b876 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/utils/PathUtils.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/utils/PathUtils.kt @@ -7,4 +7,9 @@ fun Path.lineTo(offset: Offset) = lineTo(offset.x, offset.y) fun Path.moveTo(offset: Offset) = moveTo(offset.x, offset.y) -fun Path.quadraticBezierTo(control: Offset, end: Offset) = quadraticBezierTo(control.x, control.y, end.x, end.y) \ No newline at end of file +fun Path.quadraticBezierTo(control: Offset, end: Offset) = quadraticBezierTo( + x1 = control.x, + y1 = control.y, + x2 = end.x, + y2 = end.y, +) \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/utils/PreviewUtils.kt b/core/ui/src/main/java/com/tangem/core/ui/utils/PreviewUtils.kt index 6cb1f784b9..5fd66d6dae 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/utils/PreviewUtils.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/utils/PreviewUtils.kt @@ -30,7 +30,7 @@ fun PreviewShimmerContainer(actualContent: @Composable () -> Unit, shimmerConten } SpacerH4() - var shimmerVisible by remember { mutableStateOf(true) } + var isShimmerVisible by remember { mutableStateOf(true) } TangemThemePreview { Box( @@ -39,7 +39,7 @@ fun PreviewShimmerContainer(actualContent: @Composable () -> Unit, shimmerConten }, ) { actualContent() - if (shimmerVisible) { + if (isShimmerVisible) { shimmerContent() } } @@ -48,7 +48,7 @@ fun PreviewShimmerContainer(actualContent: @Composable () -> Unit, shimmerConten LaunchedEffect(Unit) { while (true) { delay(timeMillis = 2000) - shimmerVisible = !shimmerVisible + isShimmerVisible = !isShimmerVisible } } } diff --git a/data/account/src/main/kotlin/com/tangem/data/account/fetcher/DefaultWalletAccountsFetcher.kt b/data/account/src/main/kotlin/com/tangem/data/account/fetcher/DefaultWalletAccountsFetcher.kt index 17bc75d8ff..cdd6967107 100644 --- a/data/account/src/main/kotlin/com/tangem/data/account/fetcher/DefaultWalletAccountsFetcher.kt +++ b/data/account/src/main/kotlin/com/tangem/data/account/fetcher/DefaultWalletAccountsFetcher.kt @@ -122,10 +122,10 @@ internal class DefaultWalletAccountsFetcher @Inject constructor( responseBody }, - onError = { + onError = { throwable -> // pushWalletAccounts and storeWalletAccounts help to avoid cyclic dependency fetchWalletAccountsErrorHandler.handle( - error = it, + error = throwable, userWalletId = userWalletId, savedAccountsResponse = savedAccountsResponse, pushWalletAccounts = ::push, diff --git a/data/account/src/main/kotlin/com/tangem/data/account/producer/WalletAccountListFlowFactory.kt b/data/account/src/main/kotlin/com/tangem/data/account/producer/WalletAccountListFlowFactory.kt index 1f8f47d3c9..765d6afcc1 100644 --- a/data/account/src/main/kotlin/com/tangem/data/account/producer/WalletAccountListFlowFactory.kt +++ b/data/account/src/main/kotlin/com/tangem/data/account/producer/WalletAccountListFlowFactory.kt @@ -50,7 +50,7 @@ internal class WalletAccountListFlowFactory @Inject constructor( val currencies = if (isSingleWalletWithToken) { cardCryptoCurrencyFactory.createCurrenciesForSingleCurrencyCardWithToken(userWallet = userWallet).toSet() } else { - cardCryptoCurrencyFactory.createPrimaryCurrencyForSingleCurrencyCard(userWallet = userWallet).let(::setOf) + setOf(cardCryptoCurrencyFactory.createPrimaryCurrencyForSingleCurrencyCard(userWallet = userWallet)) } return AccountList.empty(userWallet = userWallet, cryptoCurrencies = currencies) diff --git a/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/DefaultDeviceFlipDetector.kt b/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/DefaultDeviceFlipDetector.kt index 9a4c8de638..f69cc30dd9 100644 --- a/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/DefaultDeviceFlipDetector.kt +++ b/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/DefaultDeviceFlipDetector.kt @@ -20,8 +20,8 @@ class DefaultDeviceFlipDetector @Inject constructor( ) : DeviceFlipDetector, DefaultLifecycleObserver { private val sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager - private var gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) - private var isResumedState = AtomicBoolean(false) + private val gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) + private val isResumedState = AtomicBoolean(false) override fun onPause(owner: LifecycleOwner) { isResumedState.set(false) diff --git a/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/FlipListener.kt b/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/FlipListener.kt index b535797121..292a209dc4 100644 --- a/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/FlipListener.kt +++ b/data/balance-hiding/src/main/java/com/tangem/data/balancehiding/FlipListener.kt @@ -17,9 +17,9 @@ internal class FlipListener(private val action: () -> Unit) : SensorEventListene } override fun onSensorChanged(event: SensorEvent?) { - event?.let { + if (event != null) { val currentTime = SystemClock.elapsedRealtime() - val zAxisValue = it.values[2] + val zAxisValue = event.values[2] if (zAxisValue < zAxisThreshold && !isScreenDown) { isScreenDown = true diff --git a/data/common/src/main/kotlin/com/tangem/data/common/api/ApiResponseRaise.kt b/data/common/src/main/kotlin/com/tangem/data/common/api/ApiResponseRaise.kt index 3334a3c339..bda26c7b94 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/api/ApiResponseRaise.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/api/ApiResponseRaise.kt @@ -47,7 +47,7 @@ suspend inline fun safeApiCallWithTimeout( ): T = safeApiCall( call = { withTimeoutOrNull(timeoutMillis) { call() } - ?: raise(ApiResponseError.TimeoutException) + ?: raise(ApiResponseError.TimeoutException()) }, onError = onError, ) diff --git a/data/settings/src/main/java/com/tangem/data/settings/DefaultAppRatingRepository.kt b/data/settings/src/main/java/com/tangem/data/settings/DefaultAppRatingRepository.kt index 78e99623f1..c8942fa6e5 100644 --- a/data/settings/src/main/java/com/tangem/data/settings/DefaultAppRatingRepository.kt +++ b/data/settings/src/main/java/com/tangem/data/settings/DefaultAppRatingRepository.kt @@ -30,13 +30,22 @@ internal class DefaultAppRatingRepository( override fun isReadyToShow(): Flow { // TODO: [REDACTED_JIRA] return combine( - appPreferencesStore.get(key = PreferencesKeys.USER_WAS_INTERACT_WITH_RATING_KEY, default = false), - appPreferencesStore.get( + flow = appPreferencesStore.get( + key = PreferencesKeys.USER_WAS_INTERACT_WITH_RATING_KEY, + default = false, + ), + flow2 = appPreferencesStore.get( key = PreferencesKeys.SHOW_RATING_DIALOG_AT_LAUNCH_COUNT_KEY, default = FIRST_SHOWING_COUNT, ), - appPreferencesStore.get(key = PreferencesKeys.APP_LAUNCH_COUNT_KEY, default = DEFAULT_APP_LAUNCH_COUNT), - appPreferencesStore.get(key = PreferencesKeys.FUNDS_FOUND_DATE_KEY, default = FUNDS_FOUND_DATE_UNDEFINED), + flow3 = appPreferencesStore.get( + key = PreferencesKeys.APP_LAUNCH_COUNT_KEY, + default = DEFAULT_APP_LAUNCH_COUNT, + ), + flow4 = appPreferencesStore.get( + key = PreferencesKeys.FUNDS_FOUND_DATE_KEY, + default = FUNDS_FOUND_DATE_UNDEFINED, + ), ) { isInteracting, ratingShowingCount, appLaunchCount, fundsFoundDate -> if (!isInteracting) { val diff = Calendar.getInstance().timeInMillis - fundsFoundDate diff --git a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt index 0be225606e..ed640bfe95 100644 --- a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt +++ b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt @@ -101,12 +101,12 @@ class DefaultTxHistoryRepository( userWalletId: UserWalletId, currency: CryptoCurrency, pageSize: Int, - refresh: Boolean, + shouldRefresh: Boolean, ): List = withContext(dispatchers.io) { try { cacheRegistry.invokeOnExpire( key = getTxHistoryPageKey(currency, userWalletId, Page.Initial), - skipCache = refresh, + skipCache = shouldRefresh, block = { fetchFixedSizeTxHistoryItems(userWalletId, currency, pageSize) }, ) val txs = txHistoryItemsStore.getSyncOrNull( diff --git a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/RefactoredTxHistoryRepository.kt b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/RefactoredTxHistoryRepository.kt index 419abdf8a1..972344ad6e 100644 --- a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/RefactoredTxHistoryRepository.kt +++ b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/RefactoredTxHistoryRepository.kt @@ -55,7 +55,7 @@ internal class RefactoredTxHistoryRepository( ): PaginationWrapper { cacheRegistry.invokeOnExpire( key = getTxHistoryPageKey(request.page, request.params), - skipCache = request.params.refresh, + skipCache = request.params.shouldRefresh, block = { fetch(request, batchSize) }, ) diff --git a/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt b/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt index 3acbfdd607..2a81db61e6 100644 --- a/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt +++ b/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt @@ -100,7 +100,7 @@ internal class DefaultVisaRepository @Inject constructor( ) } - override suspend fun getTxHistory( + override fun getTxHistory( userWalletId: UserWalletId, pageSize: Int, isRefresh: Boolean, @@ -218,7 +218,7 @@ internal class DefaultVisaRepository @Inject constructor( return cardWallet.publicKey.toHexString() } - private suspend fun findVisaUserWallet(userWalletId: UserWalletId): UserWallet { + private fun findVisaUserWallet(userWalletId: UserWalletId): UserWallet { val userWallet = requireNotNull(userWalletsStore.getSyncOrNull(userWalletId)) { "No user wallet found: $userWalletId" } diff --git a/data/visa/src/main/kotlin/com/tangem/data/visa/MockVisaRepository.kt b/data/visa/src/main/kotlin/com/tangem/data/visa/MockVisaRepository.kt index e6165b5712..007b4b4e26 100644 --- a/data/visa/src/main/kotlin/com/tangem/data/visa/MockVisaRepository.kt +++ b/data/visa/src/main/kotlin/com/tangem/data/visa/MockVisaRepository.kt @@ -15,7 +15,7 @@ internal class MockVisaRepository @Inject constructor() : VisaRepository { TODO("Not implemented for this build type") } - override suspend fun getTxHistory( + override fun getTxHistory( userWalletId: UserWalletId, pageSize: Int, isRefresh: Boolean, diff --git a/domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt b/domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt index 95693247f1..a98f1c5107 100644 --- a/domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt +++ b/domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt @@ -432,5 +432,5 @@ class DemoConfig { ) @Suppress("ClassOrdering") - private val debugTestDemoCardIds = listOf() + private val debugTestDemoCardIds = emptyList() } \ No newline at end of file diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt index 1708558099..583f43cb02 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageTitleResolver.kt @@ -16,7 +16,7 @@ internal class EmailMessageTitleResolver(private val resources: Resources) { /** Resolve email message title by [type] */ fun resolve(type: FeedbackEmailType): String { - return when (type) { + val resId = when (type) { is FeedbackEmailType.DirectUserRequest, is FeedbackEmailType.CurrencyDescriptionError, is FeedbackEmailType.CardAttestationFailed, @@ -32,6 +32,7 @@ internal class EmailMessageTitleResolver(private val resources: Resources) { -> R.string.feedback_preface_tx_failed is FeedbackEmailType.PreActivatedWallet -> R.string.feedback_preface_support } - .let(resources::getStringSafe) + + return resources.getStringSafe(resId) } } \ No newline at end of file diff --git a/domain/swap/models/src/main/java/com/tangem/domain/swap/models/SwapCurrencies.kt b/domain/swap/models/src/main/java/com/tangem/domain/swap/models/SwapCurrencies.kt index 81eb91fe42..b22f150071 100644 --- a/domain/swap/models/src/main/java/com/tangem/domain/swap/models/SwapCurrencies.kt +++ b/domain/swap/models/src/main/java/com/tangem/domain/swap/models/SwapCurrencies.kt @@ -36,12 +36,12 @@ fun SwapCurrencies.getGroupWithDirection(swapDirection: SwapDirection): SwapCurr * * @param available list of available currencies to swap * @param available list of unavailable currencies to swap - * @param afterSearch flag indicates whether user searched token + * @param isAfterSearch flag indicates whether user searched token */ data class SwapCurrenciesGroup( val available: List, val unavailable: List, - val afterSearch: Boolean, + val isAfterSearch: Boolean, ) /** diff --git a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapPairsUseCase.kt b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapPairsUseCase.kt index 1284c416c3..fce04175b5 100644 --- a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapPairsUseCase.kt +++ b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapPairsUseCase.kt @@ -81,7 +81,7 @@ class GetSwapPairsUseCase( return SwapCurrenciesGroup( available = availableCryptoCurrencies, unavailable = unavailableCryptoCurrencies.map { pair -> SwapCryptoCurrency(pair, emptyList()) }, - afterSearch = false, + isAfterSearch = false, ) } } \ No newline at end of file diff --git a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt index 6ef54ca2bd..775eb8f797 100644 --- a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt +++ b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/GetSwapSupportedPairsUseCase.kt @@ -87,7 +87,7 @@ class GetSwapSupportedPairsUseCase( emptyList(), ) }, - afterSearch = false, + isAfterSearch = false, ) } } \ No newline at end of file diff --git a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SelectInitialPairUseCase.kt b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SelectInitialPairUseCase.kt index dcfd5cffb4..4efb56dffe 100644 --- a/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SelectInitialPairUseCase.kt +++ b/domain/swap/src/main/java/com/tangem/domain/swap/usecase/SelectInitialPairUseCase.kt @@ -43,8 +43,8 @@ class SelectInitialPairUseCase( swapCurrenciesGroup: SwapCurrenciesGroup, ): CryptoCurrencyStatus? { return secondaryCryptoCurrency?.let { - swapCurrenciesGroup.available.firstOrNull { - secondaryCryptoCurrency.id == it.currencyStatus.currency.id + swapCurrenciesGroup.available.firstOrNull { currency -> + secondaryCryptoCurrency.id == currency.currencyStatus.currency.id }?.currencyStatus } } diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/model/TxHistoryListConfig.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/model/TxHistoryListConfig.kt index e39db49219..2d18dfca95 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/model/TxHistoryListConfig.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/model/TxHistoryListConfig.kt @@ -3,4 +3,4 @@ package com.tangem.domain.txhistory.model import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.wallet.UserWalletId -data class TxHistoryListConfig(val userWalletId: UserWalletId, val currency: CryptoCurrency, val refresh: Boolean) \ No newline at end of file +data class TxHistoryListConfig(val userWalletId: UserWalletId, val currency: CryptoCurrency, val shouldRefresh: Boolean) \ No newline at end of file diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt index 43ba92e686..d040f021e3 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt @@ -32,6 +32,6 @@ interface TxHistoryRepository { userWalletId: UserWalletId, currency: CryptoCurrency, pageSize: Int, - refresh: Boolean, + shouldRefresh: Boolean, ): List } \ No newline at end of file diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetFixedTxHistoryItemsUseCase.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetFixedTxHistoryItemsUseCase.kt index 903126a53d..912cd3cc36 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetFixedTxHistoryItemsUseCase.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetFixedTxHistoryItemsUseCase.kt @@ -29,7 +29,14 @@ class GetFixedTxHistoryItemsUseCase( ): Either>> { return Either.catch { flow { - emit(repository.getFixedSizeTxHistoryItems(userWalletId, currency, pageSize, refresh)) + emit( + repository.getFixedSizeTxHistoryItems( + userWalletId = userWalletId, + currency = currency, + pageSize = pageSize, + shouldRefresh = refresh, + ), + ) } }.mapLeft { TxHistoryListError.DataError(it) } } @@ -38,10 +45,15 @@ class GetFixedTxHistoryItemsUseCase( userWalletId: UserWalletId, currency: CryptoCurrency, pageSize: Int = DEFAULT_PAGE_SIZE, - refresh: Boolean = false, + shouldRefresh: Boolean = false, ): Either> { return Either.catch { - repository.getFixedSizeTxHistoryItems(userWalletId, currency, pageSize, refresh) + repository.getFixedSizeTxHistoryItems( + userWalletId = userWalletId, + currency = currency, + pageSize = pageSize, + shouldRefresh = shouldRefresh, + ) }.mapLeft { TxHistoryListError.DataError(it) } } } \ No newline at end of file diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetTxHistoryItemsUseCase.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetTxHistoryItemsUseCase.kt index 83a3920bb2..128e4a23b6 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetTxHistoryItemsUseCase.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetTxHistoryItemsUseCase.kt @@ -25,7 +25,12 @@ class GetTxHistoryItemsUseCase(private val repository: TxHistoryRepository) { ): Either>> { return either { repository - .getTxHistoryItems(userWalletId, currency, pageSize, refresh) + .getTxHistoryItems( + userWalletId = userWalletId, + currency = currency, + pageSize = pageSize, + refresh = refresh, + ) .catch { raise(TxHistoryListError.DataError(it)) } } } diff --git a/domain/visa/src/main/kotlin/com/tangem/domain/visa/GetVisaTxHistoryUseCase.kt b/domain/visa/src/main/kotlin/com/tangem/domain/visa/GetVisaTxHistoryUseCase.kt index f0a07ce920..589debf691 100644 --- a/domain/visa/src/main/kotlin/com/tangem/domain/visa/GetVisaTxHistoryUseCase.kt +++ b/domain/visa/src/main/kotlin/com/tangem/domain/visa/GetVisaTxHistoryUseCase.kt @@ -15,7 +15,7 @@ class GetVisaTxHistoryUseCase( private val visaRepository: VisaRepository, ) { - suspend operator fun invoke( + operator fun invoke( userWalletId: UserWalletId, pageSize: Int = DEFAULT_PAGE_SIZE, isRefresh: Boolean = false, diff --git a/domain/visa/src/main/kotlin/com/tangem/domain/visa/repository/VisaRepository.kt b/domain/visa/src/main/kotlin/com/tangem/domain/visa/repository/VisaRepository.kt index fb0c17fc47..02c8b0c061 100644 --- a/domain/visa/src/main/kotlin/com/tangem/domain/visa/repository/VisaRepository.kt +++ b/domain/visa/src/main/kotlin/com/tangem/domain/visa/repository/VisaRepository.kt @@ -11,7 +11,7 @@ interface VisaRepository { suspend fun getVisaCurrency(userWalletId: UserWalletId, isRefresh: Boolean = false): VisaCurrency - suspend fun getTxHistory( + fun getTxHistory( userWalletId: UserWalletId, pageSize: Int, isRefresh: Boolean = false, diff --git a/features/account/impl/src/main/java/com/tangem/features/account/createedit/AccountCreateEditModel.kt b/features/account/impl/src/main/java/com/tangem/features/account/createedit/AccountCreateEditModel.kt index bf9e0762a5..1bf1ceac7d 100644 --- a/features/account/impl/src/main/java/com/tangem/features/account/createedit/AccountCreateEditModel.kt +++ b/features/account/impl/src/main/java/com/tangem/features/account/createedit/AccountCreateEditModel.kt @@ -75,7 +75,7 @@ internal class AccountCreateEditModel @Inject constructor( ) val firstAction = EventMessageAction( title = resourceReference(R.string.account_unsaved_dialog_action_second), - warning = true, + isWarning = true, onClick = { router.pop() }, ) messageSender.send( diff --git a/features/account/impl/src/main/java/com/tangem/features/account/details/AccountDetailsModel.kt b/features/account/impl/src/main/java/com/tangem/features/account/details/AccountDetailsModel.kt index 29f0f9ad7e..2c0a24413a 100644 --- a/features/account/impl/src/main/java/com/tangem/features/account/details/AccountDetailsModel.kt +++ b/features/account/impl/src/main/java/com/tangem/features/account/details/AccountDetailsModel.kt @@ -57,7 +57,7 @@ internal class AccountDetailsModel @Inject constructor( ) val firstAction = EventMessageAction( title = resourceReference(R.string.account_details_archive_action), - warning = true, + isWarning = true, onClick = ::archiveCryptoPortfolio, ) messageSender.send( diff --git a/features/biometry/api/src/main/kotlin/com/tangem/features/biometry/AskBiometryComponent.kt b/features/biometry/api/src/main/kotlin/com/tangem/features/biometry/AskBiometryComponent.kt index b8540bfc50..526a9ddd80 100644 --- a/features/biometry/api/src/main/kotlin/com/tangem/features/biometry/AskBiometryComponent.kt +++ b/features/biometry/api/src/main/kotlin/com/tangem/features/biometry/AskBiometryComponent.kt @@ -7,7 +7,7 @@ import com.tangem.core.ui.decompose.ComposableContentComponent interface AskBiometryComponent : ComposableContentComponent, ComposableBottomSheetComponent { data class Params( - val bottomSheetVariant: Boolean, + val isBottomSheetVariant: Boolean, val modelCallbacks: ModelCallbacks, ) diff --git a/features/biometry/impl/src/main/kotlin/com/tangem/features/biometry/impl/model/AskBiometryModel.kt b/features/biometry/impl/src/main/kotlin/com/tangem/features/biometry/impl/model/AskBiometryModel.kt index 20a033f363..faf365c0f3 100644 --- a/features/biometry/impl/src/main/kotlin/com/tangem/features/biometry/impl/model/AskBiometryModel.kt +++ b/features/biometry/impl/src/main/kotlin/com/tangem/features/biometry/impl/model/AskBiometryModel.kt @@ -55,7 +55,7 @@ internal class AskBiometryModel @Inject constructor( private val _uiState = MutableStateFlow( AskBiometryUM( - bottomSheetVariant = params.bottomSheetVariant, + bottomSheetVariant = params.isBottomSheetVariant, onAllowClick = ::onAllowClick, onDontAllowClick = ::dontAllow, onDismiss = ::dismiss, @@ -160,7 +160,7 @@ internal class AskBiometryModel @Inject constructor( title = resourceReference(R.string.common_cancel), onClick = {}, ), - dismissOnFirstAction = true, + shouldDismissOnFirstAction = true, ), ) } diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt index 423b382025..258fb95a8f 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt @@ -87,7 +87,7 @@ internal class AddExistingWalletModel @Inject constructor( title = resourceReference(R.string.access_code_alert_skip_ok), onClick = { navigateToPushNotificationsOrNext() }, ), - dismissOnFirstAction = true, + shouldDismissOnFirstAction = true, ), ) } diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt index 3d889f2034..1f151f2514 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt @@ -97,7 +97,7 @@ internal class WalletActivationModel @Inject constructor( title = resourceReference(R.string.access_code_alert_skip_ok), onClick = { navigateToPushNotificationsOrNext() }, ), - dismissOnFirstAction = true, + shouldDismissOnFirstAction = true, ), ) } diff --git a/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/ChooseManagedTokensComponent.kt b/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/ChooseManagedTokensComponent.kt index b3616e31a9..2c2ad21bd7 100644 --- a/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/ChooseManagedTokensComponent.kt +++ b/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/ChooseManagedTokensComponent.kt @@ -12,7 +12,7 @@ interface ChooseManagedTokensComponent : ComposableContentComponent { val initialCurrency: CryptoCurrency, val selectedCurrency: CryptoCurrency?, val source: Source, - val showSendViaSwapNotification: Boolean, + val shouldShowSendViaSwapNotification: Boolean, val callback: ModelCallback? = null, val analyticsCategoryName: String, ) diff --git a/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/analytics/CommonManageTokensAnalyticEvents.kt b/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/analytics/CommonManageTokensAnalyticEvents.kt index eba0758c21..e6cffb244a 100644 --- a/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/analytics/CommonManageTokensAnalyticEvents.kt +++ b/features/manage-tokens/api/src/main/kotlin/com/tangem/features/managetokens/component/analytics/CommonManageTokensAnalyticEvents.kt @@ -8,7 +8,7 @@ import com.tangem.core.analytics.models.AnalyticsParam.Key.TOKEN_PARAM sealed class CommonManageTokensAnalyticEvents( category: String, event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent(category = category, event = event, params = params) { data class TokenSearchClicked( @@ -26,8 +26,8 @@ sealed class CommonManageTokensAnalyticEvents( event = "Token Searched", params = buildMap { put(CHOSEN_TOKEN, if (isTokenChosen) "Yes" else "No") - token?.let { put(TOKEN_PARAM, token) } - blockchain?.let { put(BLOCKCHAIN, blockchain) } + if (token != null) { put(TOKEN_PARAM, token) } + if (blockchain != null) { put(BLOCKCHAIN, blockchain) } }, ) } \ No newline at end of file diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/model/ChooseManagedTokensModel.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/model/ChooseManagedTokensModel.kt index 03b4921a5d..a877ba39b6 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/model/ChooseManagedTokensModel.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/model/ChooseManagedTokensModel.kt @@ -124,7 +124,7 @@ internal class ChooseManagedTokensModel @Inject constructor( } private fun getNotification(): NotificationUM? { - return if (params.source == Source.SendViaSwap && params.showSendViaSwapNotification) { + return if (params.source == Source.SendViaSwap && params.shouldShowSendViaSwapNotification) { ChooseManagedTokensNotificationUM.SendViaSwap(onCloseClick = ::removeNotification) } else { null diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/ui/ChooseManagedTokenContent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/ui/ChooseManagedTokenContent.kt index 615347a07f..d22eaebcff 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/ui/ChooseManagedTokenContent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/choosetoken/ui/ChooseManagedTokenContent.kt @@ -153,7 +153,7 @@ private fun LazyListScope.contentItems(items: ImmutableList) { name = name, type = symbol, icon = icon, - showCustom = false, + shouldShowCustom = false, ) }, modifier = Modifier diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt index 9889edc028..59513c7d2e 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt @@ -128,7 +128,7 @@ internal class PreviewManageTokensComponent( background = Color.Black, topBadgeIconResId = R.drawable.img_eth_22, isGrayscale = false, - showCustomBadge = true, + shouldShowCustomBadge = true, ), onRemoveClick = {}, ) @@ -141,7 +141,7 @@ internal class PreviewManageTokensComponent( url = null, fallbackResId = R.drawable.img_btc_22, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), networks = if (index == 2) { CurrencyItemUM.Basic.NetworksUM.Expanded(getCurrencyNetworks(index)) diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt index 28da1876e7..790bffdd7c 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt @@ -66,7 +66,7 @@ internal class PreviewOnboardingManageTokensComponent( background = Color.Black, topBadgeIconResId = R.drawable.img_eth_22, isGrayscale = false, - showCustomBadge = true, + shouldShowCustomBadge = true, ), onRemoveClick = {}, ) @@ -79,7 +79,7 @@ internal class PreviewOnboardingManageTokensComponent( url = null, fallbackResId = R.drawable.img_btc_22, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), networks = if (index == 2) { CurrencyItemUM.Basic.NetworksUM.Expanded(getCurrencyNetworks()) diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/CustomTokenSelectorContent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/CustomTokenSelectorContent.kt index b7eae1ce2c..37097a8f34 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/CustomTokenSelectorContent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/CustomTokenSelectorContent.kt @@ -163,9 +163,9 @@ private fun NetworkItem(model: CurrencyNetworkUM, modifier: Modifier = Modifier) url = null, fallbackResId = model.iconResId, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), - showCustom = false, + shouldShowCustom = false, ) }, action = { diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/ManageTokensScreen.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/ManageTokensScreen.kt index 6c1d6a16cc..ebb75ad905 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/ManageTokensScreen.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/ManageTokensScreen.kt @@ -290,7 +290,7 @@ private fun CustomCurrencyItem(item: CurrencyItemUM.Custom, modifier: Modifier = name = name, type = symbol, icon = icon, - showCustom = true, + shouldShowCustom = true, ) }, action = { @@ -316,7 +316,7 @@ private fun BasicCurrencyItem(item: CurrencyItemUM.Basic, isEditable: Boolean, m name = name, type = symbol, icon = icon, - showCustom = false, + shouldShowCustom = false, ) }, action = { diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/dialog/CustomDerivationInputDialog.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/dialog/CustomDerivationInputDialog.kt index d9cb84c75d..e398c2569a 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/dialog/CustomDerivationInputDialog.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/ui/dialog/CustomDerivationInputDialog.kt @@ -27,7 +27,7 @@ internal fun CustomDerivationInputDialog(model: CustomDerivationInputUM, onDismi fieldValue = value, confirmButton = DialogButtonUM( title = stringResourceSafe(id = R.string.common_ok), - enabled = model.isConfirmEnabled, + isEnabled = model.isConfirmEnabled, onClick = model.onConfirm, ), dismissButton = DialogButtonUM( diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/list/ManageTokensWarningDelegate.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/list/ManageTokensWarningDelegate.kt index 037e69b449..cbc53ded2c 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/list/ManageTokensWarningDelegate.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/list/ManageTokensWarningDelegate.kt @@ -77,7 +77,7 @@ internal class ManageTokensWarningDelegate @AssistedInject constructor( firstActionBuilder = { EventMessageAction( title = resourceReference(R.string.token_details_hide_alert_hide), - warning = true, + isWarning = true, onClick = onConfirm, ) }, diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/mapper/CurrencyItemMapper.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/mapper/CurrencyItemMapper.kt index 47a6cfe610..a3114a8d29 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/mapper/CurrencyItemMapper.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/utils/mapper/CurrencyItemMapper.kt @@ -32,7 +32,7 @@ private fun ManagedCryptoCurrency.Custom.toUiModel( url = iconUrl, fallbackResId = network.id.getIconRes(isColored = true), isGrayscale = false, - showCustomBadge = true, + shouldShowCustomBadge = true, ) } is ManagedCryptoCurrency.Custom.Token -> { @@ -44,7 +44,7 @@ private fun ManagedCryptoCurrency.Custom.toUiModel( fallbackTint = getTintForTokenIcon(background), topBadgeIconResId = network.id.getIconRes(isColored = true), isGrayscale = false, - showCustomBadge = true, + shouldShowCustomBadge = true, ) } }, @@ -68,7 +68,7 @@ private fun ManagedCryptoCurrency.Token.toUiModel( url = iconUrl, topBadgeIconResId = null, isGrayscale = if (isEditable) !isAdded else false, - showCustomBadge = false, + shouldShowCustomBadge = false, fallbackTint = getTintForTokenIcon(background), fallbackBackground = background, ), diff --git a/features/markets/api/src/main/kotlin/com/tangem/features/markets/details/MarketsTokenDetailsComponent.kt b/features/markets/api/src/main/kotlin/com/tangem/features/markets/details/MarketsTokenDetailsComponent.kt index 81ecc42dcc..58e368cc07 100644 --- a/features/markets/api/src/main/kotlin/com/tangem/features/markets/details/MarketsTokenDetailsComponent.kt +++ b/features/markets/api/src/main/kotlin/com/tangem/features/markets/details/MarketsTokenDetailsComponent.kt @@ -19,7 +19,7 @@ interface MarketsTokenDetailsComponent : ComposableContentComponent { data class Params( val token: TokenMarketParams, val appCurrency: AppCurrency, - val showPortfolio: Boolean, + val shouldShowPortfolio: Boolean, val analyticsParams: AnalyticsParams?, ) diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/deeplink/DefaultMarketsTokenDetailDeepLinkHandler.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/deeplink/DefaultMarketsTokenDetailDeepLinkHandler.kt index 35b7a3b8d6..b1f7050b8b 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/deeplink/DefaultMarketsTokenDetailDeepLinkHandler.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/deeplink/DefaultMarketsTokenDetailDeepLinkHandler.kt @@ -62,7 +62,7 @@ internal class DefaultMarketsTokenDetailDeepLinkHandler @AssistedInject construc imageUrl = getTokenIconUrlFromDefaultHost(rawTokenId), ), appCurrency = appCurrency, - showPortfolio = true, + shouldShowPortfolio = true, analyticsParams = null, ), ) diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt index fe9238e9a2..1210aa9da6 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt @@ -46,7 +46,7 @@ internal class DefaultMarketsTokenDetailsComponent @AssistedInject constructor( private val model: MarketsTokenDetailsModel = getOrCreateModel(updatedParams) - private val portfolioComponent: MarketsPortfolioComponent? = if (updatedParams.showPortfolio) { + private val portfolioComponent: MarketsPortfolioComponent? = if (updatedParams.shouldShowPortfolio) { portfolioComponentFactory.create( context = child("my_portfolio"), params = MarketsPortfolioComponent.Params( diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/model/converters/ExchangeItemStateConverter.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/model/converters/ExchangeItemStateConverter.kt index eb55abd9dd..096f0d0430 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/model/converters/ExchangeItemStateConverter.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/model/converters/ExchangeItemStateConverter.kt @@ -27,7 +27,7 @@ internal object ExchangeItemStateConverter : Converter Unit, modifier: Modifier = subtitle = TextReference.Res(id = R.string.information_generated_with_ai), iconResId = R.drawable.ic_magic_28, onClick = onClick, - showArrowIcon = false, + shouldShowArrowIcon = false, ), modifier = modifier, subtitleColor = TangemTheme.colors.text.primary1, diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/entry/impl/DefaultMarketsEntryComponent.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/entry/impl/DefaultMarketsEntryComponent.kt index adc1968208..06f3b26d19 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/entry/impl/DefaultMarketsEntryComponent.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/entry/impl/DefaultMarketsEntryComponent.kt @@ -79,7 +79,7 @@ internal class DefaultMarketsEntryComponent @AssistedInject constructor( params = MarketsTokenDetailsComponent.Params( token = token, appCurrency = appCurrency, - showPortfolio = true, + shouldShowPortfolio = true, analyticsParams = MarketsTokenDetailsComponent.AnalyticsParams( blockchain = null, source = "Market", diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/ui/MyPortfolio.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/ui/MyPortfolio.kt index 615366fd0e..1c88861dac 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/ui/MyPortfolio.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/ui/MyPortfolio.kt @@ -106,7 +106,7 @@ private fun AddButton(state: AddButtonState, onClick: () -> Unit) { text = resourceReference(R.string.markets_add_token), icon = TangemButtonIconPosition.Start(R.drawable.ic_plus_24), onClick = onClick, - enabled = state == AddButtonState.Available, + isEnabled = state == AddButtonState.Available, ), ) } diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/token/block/impl/model/TokenMarketBlockModel.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/token/block/impl/model/TokenMarketBlockModel.kt index bb1496cfe6..db7d46227c 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/token/block/impl/model/TokenMarketBlockModel.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/token/block/impl/model/TokenMarketBlockModel.kt @@ -44,7 +44,7 @@ internal class TokenMarketBlockModel @Inject constructor( private val params = paramsContainer.require() - private val priceAndTimePointValuesConverter = PriceAndTimePointValuesConverter(needToFormatAxis = false) + private val priceAndTimePointValuesConverter = PriceAndTimePointValuesConverter(shouldFormatAxis = false) private val currentAppCurrency = getSelectedAppCurrencyUseCase() .map { maybeAppCurrency -> @@ -152,7 +152,7 @@ internal class TokenMarketBlockModel @Inject constructor( AppRoute.MarketsTokenDetails( token = tokenParam, appCurrency = currentAppCurrency.value, - showPortfolio = false, + shouldShowPortfolio = false, analyticsParams = AppRoute.MarketsTokenDetails.AnalyticsParams( blockchain = params.cryptoCurrency.network.name, source = "Token", diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/DefaultMarketsTokenListComponent.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/DefaultMarketsTokenListComponent.kt index 76418cb24f..8e6955c9b0 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/DefaultMarketsTokenListComponent.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/DefaultMarketsTokenListComponent.kt @@ -53,7 +53,7 @@ internal class DefaultMarketsTokenListComponent @AssistedInject constructor( AppRoute.MarketsTokenDetails( token = token.toSerializableParam(), appCurrency = appCurrency, - showPortfolio = true, + shouldShowPortfolio = true, analyticsParams = AnalyticsParams( blockchain = null, source = "Market", diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/model/converters/MarketsTokenItemConverter.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/model/converters/MarketsTokenItemConverter.kt index 22712a972c..0256ce0fd1 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/model/converters/MarketsTokenItemConverter.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/tokenlist/impl/model/converters/MarketsTokenItemConverter.kt @@ -23,7 +23,7 @@ internal class MarketsTokenItemConverter( private val appCurrency: AppCurrency, ) : Converter { - private val priceAndTimePointValuesConverter = PriceAndTimePointValuesConverter(needToFormatAxis = false) + private val priceAndTimePointValuesConverter = PriceAndTimePointValuesConverter(shouldFormatAxis = false) override fun convert(value: TokenMarket): MarketsListItemUM { return MarketsListItemUM( diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/entity/transformer/UpdateDataStateTransformer.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/entity/transformer/UpdateDataStateTransformer.kt index 91afe47b28..fc0f7c8e99 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/entity/transformer/UpdateDataStateTransformer.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/entity/transformer/UpdateDataStateTransformer.kt @@ -43,10 +43,10 @@ internal class UpdateDataStateTransformer( url = null, fallbackResId = getActiveIconRes(rawId), isGrayscale = !enabled, - showCustomBadge = custom, + shouldShowCustomBadge = custom, ), - showCustom = custom, - enabled = enabled, + shouldShowCustom = custom, + isEnabled = enabled, ), onItemClick = { onNetworkClick(this, enabled) diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/ui/NFTReceiveNetworksContent.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/ui/NFTReceiveNetworksContent.kt index 06c8648a94..c7d2c4393b 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/ui/NFTReceiveNetworksContent.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/receive/ui/NFTReceiveNetworksContent.kt @@ -140,9 +140,9 @@ private fun Preview_NFTReceiveNetworksUM() { url = null, fallbackResId = R.drawable.img_eth_22, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), - showCustom = false, + shouldShowCustom = false, ), onItemClick = { }, ), @@ -155,9 +155,9 @@ private fun Preview_NFTReceiveNetworksUM() { url = null, fallbackResId = R.drawable.img_polygon_22, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), - showCustom = false, + shouldShowCustom = false, ), onItemClick = { }, ), @@ -170,9 +170,9 @@ private fun Preview_NFTReceiveNetworksUM() { url = null, fallbackResId = R.drawable.img_bsc_22, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), - showCustom = false, + shouldShowCustom = false, ), onItemClick = { }, ), @@ -185,9 +185,9 @@ private fun Preview_NFTReceiveNetworksUM() { url = null, fallbackResId = R.drawable.img_avalanche_22, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), - showCustom = false, + shouldShowCustom = false, ), onItemClick = { }, ), @@ -200,9 +200,9 @@ private fun Preview_NFTReceiveNetworksUM() { url = null, fallbackResId = R.drawable.img_avalanche_22, isGrayscale = false, - showCustomBadge = true, + shouldShowCustomBadge = true, ), - showCustom = true, + shouldShowCustom = true, ), onItemClick = { }, ), diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/common/ui/Dialogs.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/common/ui/Dialogs.kt index 7fb5ae3b9b..b19a0dabfa 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/common/ui/Dialogs.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/common/ui/Dialogs.kt @@ -29,7 +29,7 @@ internal fun interruptBackupDialog(onConfirm: () -> Unit) = DialogMessage( message = resourceReference(R.string.onboarding_exit_alert_message), firstAction = EventMessageAction( title = resourceReference(R.string.common_ok), - warning = true, + isWarning = true, onClick = onConfirm, ), secondAction = EventMessageAction( diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/routing/OnboardingChildFactory.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/routing/OnboardingChildFactory.kt index d0e8a13f03..85e1c6dac5 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/routing/OnboardingChildFactory.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/routing/OnboardingChildFactory.kt @@ -81,7 +81,7 @@ internal class OnboardingChildFactory @Inject constructor( is OnboardingRoute.AskBiometry -> askBiometryComponentFactory.create( context = childContext, params = AskBiometryComponent.Params( - bottomSheetVariant = false, + isBottomSheetVariant = false, modelCallbacks = route.modelCallbacks, ), ) diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/backup/ui/MultiWalletBackup.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/backup/ui/MultiWalletBackup.kt index f82b028c2a..731f1eba98 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/backup/ui/MultiWalletBackup.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/backup/ui/MultiWalletBackup.kt @@ -44,7 +44,7 @@ fun MultiWalletBackup(state: MultiWalletBackupUM, modifier: Modifier = Modifier) dismissButton = if (dialog.cancelText != null && dialog.onCancel != null) { DialogButtonUM( title = dialog.cancelText.resolveReference(), - warning = dialog.warningCancelColor, + isWarning = dialog.warningCancelColor, onClick = dialog.onCancel, ) } else { diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/createwallet/ui/MultiWalletCreateWallet.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/createwallet/ui/MultiWalletCreateWallet.kt index 6d865157e7..d687c5ba72 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/createwallet/ui/MultiWalletCreateWallet.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/createwallet/ui/MultiWalletCreateWallet.kt @@ -36,7 +36,7 @@ internal fun MultiWalletCreateWallet(state: MultiWalletCreateWalletUM, modifier: ), dismissButton = DialogButtonUM( title = state.dialog.dismissButtonText.resolveReference(), - warning = state.dialog.dismissWarningColor, + isWarning = state.dialog.dismissWarningColor, onClick = state.dialog.onDismissButtonClick, ), onDismissDialog = state.dialog.onDismiss, diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt index 0fc50e414e..8779ab378a 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseImport.kt @@ -46,7 +46,7 @@ internal fun MultiWalletSeedPhraseImport(state: MultiWalletSeedPhraseUM.Import, ), dismissButton = DialogButtonUM( title = state.dialog.dismissButtonText.resolveReference(), - warning = state.dialog.dismissWarningColor, + isWarning = state.dialog.dismissWarningColor, onClick = state.dialog.onDismissButtonClick, ), onDismissDialog = state.dialog.onDismiss, diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseWordsCheck.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseWordsCheck.kt index dfc2b1cd70..62dffaa3e7 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseWordsCheck.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/seedphrase/ui/MultiWalletSeedPhraseWordsCheck.kt @@ -45,7 +45,7 @@ internal fun MultiWalletSeedPhraseWordsCheck( ), dismissButton = DialogButtonUM( title = state.dialog.dismissButtonText.resolveReference(), - warning = state.dialog.dismissWarningColor, + isWarning = state.dialog.dismissWarningColor, onClick = state.dialog.onDismissButtonClick, ), onDismissDialog = state.dialog.onDismiss, diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/upgradewallet/ui/MultiWalletUpgradeWallet.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/upgradewallet/ui/MultiWalletUpgradeWallet.kt index 28ffd8f2f8..1e63f37730 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/upgradewallet/ui/MultiWalletUpgradeWallet.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/upgradewallet/ui/MultiWalletUpgradeWallet.kt @@ -33,7 +33,7 @@ internal fun MultiWalletUpgradeWallet(state: MultiWalletUpgradeWalletUM, modifie ), dismissButton = DialogButtonUM( title = state.dialog.dismissButtonText.resolveReference(), - warning = state.dialog.dismissWarningColor, + isWarning = state.dialog.dismissWarningColor, onClick = state.dialog.onDismissButtonClick, ), onDismissDialog = state.dialog.onDismiss, diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/accesscode/ui/OnboardingVisaAccessCode.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/accesscode/ui/OnboardingVisaAccessCode.kt index 67c433d86b..4a0686cae5 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/accesscode/ui/OnboardingVisaAccessCode.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/accesscode/ui/OnboardingVisaAccessCode.kt @@ -65,7 +65,7 @@ internal fun OnboardingVisaAccessCode(state: OnboardingVisaAccessCodeUM, modifie }, onClick = state.onContinue, iconRes = R.drawable.ic_tangem_24, - showProgress = state.buttonLoading, + shouldShowProgress = state.buttonLoading, isIconVisible = state.step == OnboardingVisaAccessCodeUM.Step.ReEnter, ), ) diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/approve/ui/OnboardingVisaApprove.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/approve/ui/OnboardingVisaApprove.kt index 106973d0da..ded84b9bbf 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/approve/ui/OnboardingVisaApprove.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/approve/ui/OnboardingVisaApprove.kt @@ -69,7 +69,7 @@ internal fun OnboardingVisaApprove(state: OnboardingVisaApproveUM, modifier: Mod textReference = resourceReference(R.string.common_approve), iconRes = R.drawable.ic_tangem_24, isIconVisible = true, - showProgress = state.approveButtonLoading, + shouldShowProgress = state.approveButtonLoading, onClick = state.onApproveClick, ), ) diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/pincode/ui/OnboardingVisaPinCode.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/pincode/ui/OnboardingVisaPinCode.kt index 094a37d884..f0d7b4856e 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/pincode/ui/OnboardingVisaPinCode.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/child/pincode/ui/OnboardingVisaPinCode.kt @@ -87,7 +87,7 @@ internal fun OnboardingVisaPinCode(state: OnboardingVisaPinCodeUM, modifier: Mod primaryButton = NavigationButton( textReference = resourceReference(R.string.common_submit), onClick = state.onSubmitClick, - showProgress = state.submitButtonLoading, + shouldShowProgress = state.submitButtonLoading, isEnabled = state.submitButtonEnabled, ), ) diff --git a/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/component/OnrampComponent.kt b/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/component/OnrampComponent.kt index 3de1a19fb7..66356e9ae5 100644 --- a/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/component/OnrampComponent.kt +++ b/features/onramp/api/src/main/kotlin/com/tangem/features/onramp/component/OnrampComponent.kt @@ -12,7 +12,7 @@ interface OnrampComponent : ComposableContentComponent { val userWalletId: UserWalletId, val cryptoCurrency: CryptoCurrency, val source: OnrampSource, - val launchSepa: Boolean = false, + val shouldLaunchSepa: Boolean = false, ) interface Factory : ComponentFactory diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/hottokens/portfolio/ui/OnrampAddToPortfolioContent.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/hottokens/portfolio/ui/OnrampAddToPortfolioContent.kt index b507a11e81..db961c1580 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/hottokens/portfolio/ui/OnrampAddToPortfolioContent.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/hottokens/portfolio/ui/OnrampAddToPortfolioContent.kt @@ -147,7 +147,7 @@ private fun PreviewOnrampAddToPortfolioContent() { fallbackTint = TangemColorPalette.Black, fallbackBackground = TangemColorPalette.Meadow, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), addButtonUM = OnrampAddToPortfolioUM.AddButtonUM( isProgress = false, diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/OnrampMainComponentUM.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/OnrampMainComponentUM.kt index ae9041847c..e375c15faf 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/OnrampMainComponentUM.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/OnrampMainComponentUM.kt @@ -31,7 +31,7 @@ internal sealed interface OnrampMainComponentUM { endButtonUM = TopAppBarButtonUM.Icon( iconRes = R.drawable.ic_more_vertical_24, onClicked = openSettings, - enabled = false, + isEnabled = false, ), ) diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt index 09da044da3..02de508683 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt @@ -39,8 +39,8 @@ internal class OnrampStateFactory( val state = currentStateProvider() val endButton = when (val button = state.topBarConfig.endButtonUM) { - is TopAppBarButtonUM.Icon -> button.copy(enabled = true) - is TopAppBarButtonUM.Text -> button.copy(enabled = true) + is TopAppBarButtonUM.Icon -> button.copy(isEnabled = true) + is TopAppBarButtonUM.Text -> button.copy(isEnabled = true) } return OnrampMainComponentUM.Content( topBarConfig = state.topBarConfig.copy(endButtonUM = endButton), @@ -85,8 +85,8 @@ internal class OnrampStateFactory( fun getErrorState(errorCode: String? = null, onRefresh: () -> Unit): OnrampMainComponentUM { val state = currentStateProvider() val endButton = when (val button = state.topBarConfig.endButtonUM) { - is TopAppBarButtonUM.Icon -> button.copy(enabled = true) - is TopAppBarButtonUM.Text -> button.copy(enabled = true) + is TopAppBarButtonUM.Icon -> button.copy(isEnabled = true) + is TopAppBarButtonUM.Text -> button.copy(isEnabled = true) } return when (state) { diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/mainv2/entity/factory/OnrampV2StateFactory.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/mainv2/entity/factory/OnrampV2StateFactory.kt index e39a2078b2..631c06be7a 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/mainv2/entity/factory/OnrampV2StateFactory.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/mainv2/entity/factory/OnrampV2StateFactory.kt @@ -47,7 +47,7 @@ internal class OnrampV2StateFactory( endButtonUM = TopAppBarButtonUM.Icon( iconRes = R.drawable.ic_more_vertical_24, onClicked = openSettings, - enabled = false, + isEnabled = false, ), ), continueButtonConfig = ContinueButtonUM( @@ -62,8 +62,8 @@ internal class OnrampV2StateFactory( val state = currentStateProvider() val endButton = when (val button = state.topBarConfig.endButtonUM) { - is TopAppBarButtonUM.Icon -> button.copy(enabled = true) - is TopAppBarButtonUM.Text -> button.copy(enabled = true) + is TopAppBarButtonUM.Icon -> button.copy(isEnabled = true) + is TopAppBarButtonUM.Text -> button.copy(isEnabled = true) } val initialAmountBlockState = getInitialAmountBlockState(currency) @@ -123,8 +123,8 @@ internal class OnrampV2StateFactory( fun getErrorState(errorCode: String? = null, onRefresh: () -> Unit): OnrampV2MainComponentUM { val state = currentStateProvider() val endButton = when (val button = state.topBarConfig.endButtonUM) { - is TopAppBarButtonUM.Icon -> button.copy(enabled = true) - is TopAppBarButtonUM.Text -> button.copy(enabled = true) + is TopAppBarButtonUM.Icon -> button.copy(isEnabled = true) + is TopAppBarButtonUM.Text -> button.copy(isEnabled = true) } return when (state) { diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/root/DefaultOnrampComponent.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/root/DefaultOnrampComponent.kt index b9ff5cb77a..6e28350998 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/root/DefaultOnrampComponent.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/root/DefaultOnrampComponent.kt @@ -104,7 +104,7 @@ internal class DefaultOnrampComponent @AssistedInject constructor( ), ) }, - launchSepa = params.launchSepa, + launchSepa = params.shouldLaunchSepa, ), ) } diff --git a/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt b/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt index 8ffec6c23c..411fad6ab3 100644 --- a/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt +++ b/features/push-notifications/api/src/main/java/com/tangem/features/pushnotifications/api/analytics/PushNotificationAnalyticEvents.kt @@ -5,7 +5,7 @@ import com.tangem.core.analytics.models.AnalyticsParam sealed class PushNotificationAnalyticEvents( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent(category = "Push", event = event, params = params) { data class ButtonAllow( diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/entrypoint/DefaultSendEntryPointComponent.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/entrypoint/DefaultSendEntryPointComponent.kt index 67396045c9..fb1684acf2 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/entrypoint/DefaultSendEntryPointComponent.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/entrypoint/DefaultSendEntryPointComponent.kt @@ -125,7 +125,7 @@ internal class DefaultSendEntryPointComponent @AssistedInject constructor( initialCurrency = params.cryptoCurrency, source = ChooseManagedTokensComponent.Source.SendViaSwap, selectedCurrency = null, - showSendViaSwapNotification = showSendViaSwapNotification, + shouldShowSendViaSwapNotification = showSendViaSwapNotification, callback = model, analyticsCategoryName = CommonSendAnalyticEvents.SEND_CATEGORY, ), diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetButtonsStateTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetButtonsStateTransformer.kt index acaeb8948e..a5d35a5215 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetButtonsStateTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetButtonsStateTransformer.kt @@ -52,7 +52,7 @@ internal class SetButtonsStateTransformer( iconRes = R.drawable.ic_tangem_24.takeIf { prevState.showColdWalletInteractionIcon }, isDimmed = isPrimaryButtonDisabled, isIconVisible = isIconVisible, - showProgress = isInProgress, + shouldShowProgress = isInProgress, isEnabled = prevState.isButtonEnabled(), onClick = { if (isPrimaryButtonDisabled) { @@ -70,7 +70,7 @@ internal class SetButtonsStateTransformer( iconRes = R.drawable.ic_back_24, isSecondary = true, isIconVisible = true, - showProgress = false, + shouldShowProgress = false, isEnabled = true, onClick = prevState.clickIntents::onPrevClick, ).takeIf { prevState.currentStep.isPrevButtonVisible() } @@ -82,7 +82,7 @@ internal class SetButtonsStateTransformer( iconRes = R.drawable.ic_web_24, isSecondary = true, isIconVisible = true, - showProgress = false, + shouldShowProgress = false, isEnabled = true, onClick = prevState.clickIntents::onExploreClick, ) to NavigationButton( @@ -90,7 +90,7 @@ internal class SetButtonsStateTransformer( iconRes = R.drawable.ic_share_24, isSecondary = true, isIconVisible = true, - showProgress = false, + shouldShowProgress = false, isEnabled = true, onClick = prevState.clickIntents::onShareClick, ) diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalBottomSheetInProgressTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalBottomSheetInProgressTransformer.kt index 5ceb9ac4d3..5221aba998 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalBottomSheetInProgressTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/SetApprovalBottomSheetInProgressTransformer.kt @@ -18,8 +18,8 @@ internal class SetApprovalBottomSheetInProgressTransformer( config.copy( data = config.data.copy( approveButton = config.data.approveButton.copy( - enabled = false, - loading = true, + isEnabled = false, + isLoading = true, ), cancelButton = config.data.cancelButton.copy( enabled = false, diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/ShowApprovalBottomSheetTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/ShowApprovalBottomSheetTransformer.kt index 4e3bac09c8..8b1ede3cbe 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/ShowApprovalBottomSheetTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/approval/ShowApprovalBottomSheetTransformer.kt @@ -63,8 +63,8 @@ internal class ShowApprovalBottomSheetTransformer( wrappedList(feeCryptoValue, feeFiatValue), ), approveButton = ApprovePermissionButton( - enabled = true, - loading = false, + isEnabled = true, + isLoading = false, onClick = prevState.clickIntents::onApprovalClick, ), cancelButton = CancelPermissionButton( diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt index 58a07429d8..8f43cade49 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/model/SwapAmountModel.kt @@ -281,7 +281,7 @@ internal class SwapAmountModel @Inject constructor( initialCurrency = primaryCryptoCurrency, selectedCurrency = selectedCurrency.takeIf { isEditMode }, source = AppRoute.ChooseManagedTokens.Source.SendViaSwap, - showSendViaSwapNotification = showSendViaSwapNotification, + shouldShowSendViaSwapNotification = showSendViaSwapNotification, analyticsCategoryName = params.analyticsCategoryName, ), ) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataStateExpress.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataStateExpress.kt index 93e4308f49..6e4041dee5 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataStateExpress.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataStateExpress.kt @@ -29,5 +29,5 @@ fun TokensDataStateExpress.getGroupWithReverse(isReverseFromTo: Boolean): Curren data class CurrenciesGroup( val available: List, val unavailable: List, - val afterSearch: Boolean, + val isAfterSearch: Boolean, ) \ No newline at end of file diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt index 8775176d12..fbcde7d463 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt @@ -172,7 +172,7 @@ internal class SwapInteractorImpl @AssistedInject constructor( return CurrenciesGroup( available = availableCryptoCurrencies, unavailable = unavailableCryptoCurrencies.map { CryptoCurrencySwapInfo(it, emptyList()) }, - afterSearch = false, + isAfterSearch = false, ) } diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/TokensDataConverter.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/TokensDataConverter.kt index 86245f0585..9d3b8ab6ac 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/TokensDataConverter.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/TokensDataConverter.kt @@ -55,7 +55,7 @@ class TokensDataConverter( .toImmutableList(), onSearchEntered = onSearchEntered, onTokenSelected = onTokenSelected, - afterSearch = group.afterSearch, + afterSearch = group.isAfterSearch, ) } @@ -85,7 +85,7 @@ class TokensDataConverter( url = currency.iconUrl, fallbackResId = currency.networkIconResId, isGrayscale = !isAvailable, - showCustomBadge = currency.isCustom, + shouldShowCustomBadge = currency.isCustom, ) } is CryptoCurrency.Token -> { @@ -95,7 +95,7 @@ class TokensDataConverter( CurrencyIconState.TokenIcon( url = currency.iconUrl, isGrayscale = !isAvailable, - showCustomBadge = currency.isCustom, + shouldShowCustomBadge = currency.isCustom, topBadgeIconResId = currency.networkIconResId, fallbackTint = tint, fallbackBackground = background, diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt index 35ca5f2d43..fe64745c2b 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt @@ -785,7 +785,7 @@ internal class SwapModel @Inject constructor( fromGroup = tokenDataState.fromGroup.copy( available = available, unavailable = unavailable, - afterSearch = true, + isAfterSearch = true, ), ) } else { @@ -793,7 +793,7 @@ internal class SwapModel @Inject constructor( toGroup = tokenDataState.toGroup.copy( available = available, unavailable = unavailable, - afterSearch = true, + isAfterSearch = true, ), ) } diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt index ec50b17698..039cefd24b 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt @@ -964,7 +964,7 @@ internal class StateBuilder( spenderAddress = getShortAddressValue(permissionDataState.spenderAddress), fee = TextReference.Str("${permissionFee.feeCryptoFormatted} (${permissionFee.feeFiatFormatted})"), approveButton = ApprovePermissionButton( - enabled = true, + isEnabled = true, onClick = onGivePermissionClick, ), cancelButton = CancelPermissionButton( diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/SwapSelectTokenScreen.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/SwapSelectTokenScreen.kt index f2821d83a4..b03970cc63 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/SwapSelectTokenScreen.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/ui/SwapSelectTokenScreen.kt @@ -287,7 +287,7 @@ private val token = TokenToSelectState.TokenToSelect( url = "", fallbackResId = 0, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), id = "", name = "Optimistic Ethereum (ETH)", diff --git a/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayOnboardingContent.kt b/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayOnboardingContent.kt index 1933e8480e..25b03d0e92 100644 --- a/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayOnboardingContent.kt +++ b/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayOnboardingContent.kt @@ -75,7 +75,7 @@ internal fun TangemPayOnboardingContent( textReference = resourceReference(R.string.tangempay_onboarding_get_card_button_text), iconRes = R.drawable.ic_tangem_24, isIconVisible = true, - showProgress = state.buttonLoading, + shouldShowProgress = state.buttonLoading, onClick = onButtonClick, ), ) diff --git a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/providers/ui/BlockchainProvidersScreen.kt b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/providers/ui/BlockchainProvidersScreen.kt index 908033f11b..dfe5e893f2 100644 --- a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/providers/ui/BlockchainProvidersScreen.kt +++ b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/providers/ui/BlockchainProvidersScreen.kt @@ -325,7 +325,7 @@ private fun AddPublicProviderDialog(state: BlockchainProvidersUM.AddPublicProvid fieldValue = value, confirmButton = DialogButtonUM( title = stringResourceSafe(R.string.common_save), - enabled = value.text.isNotBlank() && !state.hasError, + isEnabled = value.text.isNotBlank() && !state.hasError, onClick = { state.onSaveClick( buildString { diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/ui/TokenReceiveWarningContent.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/ui/TokenReceiveWarningContent.kt index 25c47e9b3c..ed2a67a9be 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/ui/TokenReceiveWarningContent.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/ui/TokenReceiveWarningContent.kt @@ -120,7 +120,7 @@ private class TokenReceiveWarningContentProvider : PreviewParameterProvider diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsActionButton.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsActionButton.kt index b3c3f03e68..a43ef77c42 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsActionButton.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsActionButton.kt @@ -25,7 +25,7 @@ internal sealed class TokenDetailsActionButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_buy), iconResId = R.drawable.ic_plus_24, onClick = onClick, - dimContent = dimContent, + shouldDimContent = dimContent, ), ) @@ -40,7 +40,7 @@ internal sealed class TokenDetailsActionButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_send), iconResId = R.drawable.ic_arrow_up_24, onClick = onClick, - dimContent = dimContent, + shouldDimContent = dimContent, ), ) @@ -58,7 +58,7 @@ internal sealed class TokenDetailsActionButton(val config: ActionButtonConfig) { iconResId = R.drawable.ic_arrow_down_24, onClick = onClick, onLongClick = onLongClick, - enabled = true, + isEnabled = true, ), ) @@ -73,7 +73,7 @@ internal sealed class TokenDetailsActionButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_sell), iconResId = R.drawable.ic_currency_24, onClick = onClick, - dimContent = dimContent, + shouldDimContent = dimContent, ), ) @@ -92,8 +92,8 @@ internal sealed class TokenDetailsActionButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.swapping_swap_action), iconResId = R.drawable.ic_exchange_vertical_24, onClick = onClick, - dimContent = dimContent, - showBadge = showBadge, + shouldDimContent = dimContent, + shouldShowBadge = showBadge, ), ) } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenDetailsDialogs.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenDetailsDialogs.kt index 5a4f590fe7..3e57199b5a 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenDetailsDialogs.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenDetailsDialogs.kt @@ -21,7 +21,7 @@ private fun TokenDetailsDialog(config: TokenDetailsDialogConfig) { message = config.content.message.resolveReference(), confirmButton = DialogButtonUM( title = config.content.confirmButtonConfig.text.resolveReference(), - warning = config.content.confirmButtonConfig.warning, + isWarning = config.content.confirmButtonConfig.warning, onClick = config.content.confirmButtonConfig.onClick, ), onDismissDialog = config.onDismissRequest, @@ -29,7 +29,7 @@ private fun TokenDetailsDialog(config: TokenDetailsDialogConfig) { dismissButton = config.content.cancelButtonConfig?.let { cancelButtonConfig -> DialogButtonUM( title = cancelButtonConfig.text.resolveReference(), - warning = cancelButtonConfig.warning, + isWarning = cancelButtonConfig.warning, onClick = cancelButtonConfig.onClick, ) }, diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt index 21ea7b7b33..1c8153f1cb 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt @@ -65,7 +65,7 @@ internal class TxHistoryListManager( suspend fun startLoading() { actionsFlow.emit( BatchAction.Reload( - requestParams = TxHistoryListConfig(userWalletId, currency, refresh = false), + requestParams = TxHistoryListConfig(userWalletId, currency, shouldRefresh = false), ), ) } @@ -73,7 +73,7 @@ internal class TxHistoryListManager( suspend fun reload() { actionsFlow.emit( BatchAction.Reload( - requestParams = TxHistoryListConfig(userWalletId, currency, refresh = true), + requestParams = TxHistoryListConfig(userWalletId, currency, shouldRefresh = true), ), ) } @@ -81,7 +81,7 @@ internal class TxHistoryListManager( suspend fun loadMore(userWalletId: UserWalletId, currency: CryptoCurrency) { actionsFlow.emit( BatchAction.LoadMore( - requestParams = TxHistoryListConfig(userWalletId, currency, refresh = false), + requestParams = TxHistoryListConfig(userWalletId, currency, shouldRefresh = false), ), ) } diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt index 0a86e4509c..d3a36e9a94 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt @@ -194,7 +194,7 @@ internal class WalletSettingsModel @Inject constructor( firstActionBuilder = { EventMessageAction( title = resourceReference(R.string.common_delete), - warning = true, + isWarning = true, onClick = ::forgetWallet, ) }, diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/RenameWalletDialog.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/RenameWalletDialog.kt index 11d76500bd..5cd35e1719 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/RenameWalletDialog.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/RenameWalletDialog.kt @@ -24,7 +24,7 @@ internal fun RenameWalletDialog(model: RenameWalletUM, onDismiss: () -> Unit) { fieldValue = value, confirmButton = DialogButtonUM( title = stringResourceSafe(id = R.string.common_ok), - enabled = model.isConfirmEnabled, + isEnabled = model.isConfirmEnabled, onClick = model.onConfirmClick, ), dismissButton = DialogButtonUM( diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt index 83c17f40d8..68be89856a 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt @@ -214,7 +214,7 @@ private fun CardBlock(model: WalletSettingsItemUM.CardBlock, modifier: Modifier } SecondarySmallButton( config = SmallButtonConfig( - enabled = model.isEnabled, + isEnabled = model.isEnabled, text = resourceReference(R.string.common_rename), onClick = model.onClick, ), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt index 8b75c0188c..3104027a66 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt @@ -68,7 +68,7 @@ internal class WalletComponent @AssistedInject constructor( askBiometryComponentFactory.create( context = childByContext(componentContext), params = AskBiometryComponent.Params( - bottomSheetVariant = true, + isBottomSheetVariant = true, modelCallbacks = model.askBiometryModelCallbacks, ), ) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt index 621784608c..887f075f2b 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletCurrencyActionsClickIntents.kt @@ -450,7 +450,7 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor( AppRoute.MarketsTokenDetails( token = tokenMarketParams, appCurrency = getSelectedAppCurrencyUseCase.unwrap(), - showPortfolio = false, + shouldShowPortfolio = false, analyticsParams = AppRoute.MarketsTokenDetails.AnalyticsParams( blockchain = cryptoCurrencyStatus.currency.network.name, source = "Main", diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt index 59cae0a222..7e70100e8b 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt @@ -79,7 +79,7 @@ internal object WalletPreviewData { fallbackTint = TangemColorPalette.Black, fallbackBackground = TangemColorPalette.Meadow, isGrayscale = false, - showCustomBadge = false, + shouldShowCustomBadge = false, ), titleState = TokenItemState.TitleState.Content(text = stringReference(value = "Polygon")), subtitle2State = TokenItemState.Subtitle2State.TextContent(text = "3 172,14 $"), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/OrganizeTokensScreen.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/OrganizeTokensScreen.kt index 0dab60619c..fab2288352 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/OrganizeTokensScreen.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/OrganizeTokensScreen.kt @@ -260,9 +260,9 @@ private fun TopBar( config = ActionButtonConfig( text = TextReference.Res(id = R.string.organize_tokens_sort_by_balance), iconResId = R.drawable.ic_sort_24, - enabled = config.isEnabled, + isEnabled = config.isEnabled, onClick = config.onSortClick, - dimContent = config.isSortedByBalance, + shouldDimContent = config.isSortedByBalance, ), color = TangemTheme.colors.background.primary, ) @@ -279,7 +279,7 @@ private fun TopBar( }, ), iconResId = R.drawable.ic_group_24, - enabled = config.isEnabled, + isEnabled = config.isEnabled, onClick = config.onGroupClick, ), color = TangemTheme.colors.background.primary, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletManageButton.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletManageButton.kt index af52d510ec..f956593a15 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletManageButton.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletManageButton.kt @@ -45,8 +45,8 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_buy), iconResId = R.drawable.ic_plus_24, onClick = onClick, - enabled = enabled, - dimContent = dimContent, + isEnabled = enabled, + shouldDimContent = dimContent, isInProgress = isInProgress, ), ) @@ -67,8 +67,8 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_send), iconResId = R.drawable.ic_arrow_up_24, onClick = onClick, - enabled = enabled, - dimContent = dimContent, + isEnabled = enabled, + shouldDimContent = dimContent, ), ) @@ -87,8 +87,8 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) { config = ActionButtonConfig( text = TextReference.Res(id = R.string.common_receive), iconResId = R.drawable.ic_arrow_down_24, - enabled = enabled, - dimContent = dimContent, + isEnabled = enabled, + shouldDimContent = dimContent, onClick = onClick, onLongClick = onLongClick, ), @@ -103,8 +103,8 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_stake), iconResId = R.drawable.ic_staking_24, onClick = onClick, - enabled = enabled, - dimContent = dimContent, + isEnabled = enabled, + shouldDimContent = dimContent, ), ) @@ -125,8 +125,8 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.common_sell), iconResId = R.drawable.ic_currency_24, onClick = onClick, - enabled = enabled, - dimContent = dimContent, + isEnabled = enabled, + shouldDimContent = dimContent, isInProgress = isInProgress, ), ) @@ -149,10 +149,10 @@ internal sealed class WalletManageButton(val config: ActionButtonConfig) { text = TextReference.Res(id = R.string.swapping_swap_action), iconResId = R.drawable.ic_exchange_vertical_24, onClick = onClick, - enabled = enabled, - dimContent = dimContent, + isEnabled = enabled, + shouldDimContent = dimContent, isInProgress = isInProgress, - showBadge = showBadge, + shouldShowBadge = showBadge, ), ) } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletAlert.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletAlert.kt index de71152155..9ad537bad7 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletAlert.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletAlert.kt @@ -41,7 +41,7 @@ private fun BasicAlert(state: WalletAlertState.Basic, onDismiss: () -> Unit) { if (onActionClick != null) { confirmButton = DialogButtonUM( title = state.confirmButtonText.resolveReference(), - warning = state.isWarningConfirmButton, + isWarning = state.isWarningConfirmButton, onClick = { onActionClick() onDismiss() @@ -54,7 +54,7 @@ private fun BasicAlert(state: WalletAlertState.Basic, onDismiss: () -> Unit) { } else { confirmButton = DialogButtonUM( title = state.confirmButtonText.resolveReference(), - warning = state.isWarningConfirmButton, + isWarning = state.isWarningConfirmButton, onClick = onDismiss, ) dismissButton = null @@ -77,7 +77,7 @@ private fun TextInputAlert(state: WalletAlertState.TextInput, onDismiss: () -> U fieldValue = value, confirmButton = DialogButtonUM( title = state.confirmButtonText.resolveReference(), - enabled = value.text.isNotEmpty() && + isEnabled = value.text.isNotEmpty() && value.text != state.text && state.errorTextProvider(value.text) == null, onClick = { diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyOrganizeButton.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyOrganizeButton.kt index d207cb203c..da334b825e 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyOrganizeButton.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyOrganizeButton.kt @@ -31,7 +31,7 @@ internal fun LazyListScope.organizeTokensButton( text = resourceReference(id = R.string.organize_tokens_title), iconResId = R.drawable.ic_filter_24, onClick = onClick, - enabled = isEnabled, + isEnabled = isEnabled, ), ) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt index ee134f6fea..d76ececd2e 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/TangemPayMainScreenBlock.kt @@ -33,7 +33,7 @@ internal fun TangemPayMainScreenBlock(state: TangemPayState, modifier: Modifier buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig( text = state.buttonText, onClick = state.onButtonClick, - showProgress = state.showProgress, + shouldShowProgress = state.showProgress, ), ), ) diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/warning/ui/YieldSupplyDepositedWarningContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/warning/ui/YieldSupplyDepositedWarningContent.kt index fde7716c00..dee6512106 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/warning/ui/YieldSupplyDepositedWarningContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/warning/ui/YieldSupplyDepositedWarningContent.kt @@ -144,7 +144,7 @@ private class YieldSupplyWarningContentProvider : PreviewParameterProvider diff --git a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/compatibility/L2Networks.kt b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/compatibility/L2Networks.kt index 6c395cd076..782e3e88ff 100644 --- a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/compatibility/L2Networks.kt +++ b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/compatibility/L2Networks.kt @@ -23,9 +23,9 @@ fun getL2CompatibilityTokenComparison(token: UserTokensResponse.Token, currencyI fun List.applyL2Compatibility(coinId: String): List { return if (coinId == ETHEREUM_COIN_ID) { - val l2Networks = l2BlockchainsList.map { + val l2Networks = l2BlockchainsList.map { blockchain -> CoinsResponse.Coin.Network( - networkId = it.toNetworkId(), + networkId = blockchain.toNetworkId(), ) } this + l2Networks @@ -37,9 +37,9 @@ fun List.applyL2Compatibility(coinId: String): List< fun TokenMarketInfoResponse.applyL2Compatibility(coinId: String): TokenMarketInfoResponse { val networks = this.networks ?: return this return if (coinId == ETHEREUM_COIN_ID) { - val l2Networks = l2BlockchainsList.map { + val l2Networks = l2BlockchainsList.map { blockchain -> TokenMarketInfoResponse.Network( - networkId = it.toNetworkId(), + networkId = blockchain.toNetworkId(), contractAddress = null, decimalCount = null, ) diff --git a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseLoader.kt b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseLoader.kt index 60c5024818..a6765c196a 100644 --- a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseLoader.kt +++ b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseLoader.kt @@ -37,8 +37,8 @@ internal class BlockchainProvidersResponseLoader @Inject constructor( remote = remoteResponse, ) }, - onFailure = { - Timber.e(it, "Failed to load blockchain provider types from backend") + onFailure = { throwable -> + Timber.e(throwable, "Failed to load blockchain provider types from backend") localResponse }, ) diff --git a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseMerger.kt b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseMerger.kt index e64cc2f00e..6e1a918463 100644 --- a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseMerger.kt +++ b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/BlockchainProvidersResponseMerger.kt @@ -30,8 +30,8 @@ internal class BlockchainProvidersResponseMerger @Inject internal constructor( */ fun merge(local: BlockchainProvidersResponse, remote: BlockchainProvidersResponse): BlockchainProvidersResponse { val remoteWithoutInvalidProviders = remote - .mapValues { - it.value + .mapValues { entry -> + entry.value .filterUnsupportedProviders() .filterInvalidProviders() } diff --git a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/DevBlockchainProvidersTypesManager.kt b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/DevBlockchainProvidersTypesManager.kt index 8af47fd124..44587e8923 100644 --- a/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/DevBlockchainProvidersTypesManager.kt +++ b/libs/blockchain-sdk/src/main/java/com/tangem/blockchainsdk/providers/DevBlockchainProvidersTypesManager.kt @@ -52,10 +52,10 @@ internal class DevBlockchainProvidersTypesManager( } override suspend fun update(blockchain: Blockchain, providers: List) { - changedBlockchainProvidersStore.updateData { + changedBlockchainProvidersStore.updateData { blockchainProviders -> val providerModels = BlockchainProviderTypesConverter.convertBack(value = mapOf(blockchain to providers)) - it + providerModels + blockchainProviders + providerModels } }