diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 8f2af51f2d..9d98629279 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -5,6 +5,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/tangem/tap/MainActivity.kt b/app/src/main/java/com/tangem/tap/MainActivity.kt index c047e66353..b1ab10db8d 100644 --- a/app/src/main/java/com/tangem/tap/MainActivity.kt +++ b/app/src/main/java/com/tangem/tap/MainActivity.kt @@ -263,7 +263,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder { tangemSdkManager = injectedTangemSdkManager backupServiceHolder.createAndSetService(cardSdkConfigRepository.sdk, this) - backupService = backupServiceHolder.backupService.get()!! // will be deleted eventually + backupService = requireNotNull(backupServiceHolder.backupService.get()) // will be deleted eventually lockUserWalletsTimer = LockUserWalletsTimer( context = this, @@ -370,8 +370,8 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder { override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) - val fromPush = intent?.extras?.containsKey(OPENED_FROM_GCM_PUSH) ?: false - if (fromPush) { + val isFromPush = intent?.extras?.containsKey(OPENED_FROM_GCM_PUSH) == true + if (isFromPush) { analyticsEventsHandler.send(Push.PushNotificationOpened) } @@ -402,8 +402,8 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder { } override fun dispatchTouchEvent(event: MotionEvent): Boolean { - val result = WindowObscurationObserver.dispatchTouchEvent(event, analyticsEventsHandler) - return if (result) super.dispatchTouchEvent(event) else false + val isHandled = WindowObscurationObserver.dispatchTouchEvent(event, analyticsEventsHandler) + return if (isHandled) super.dispatchTouchEvent(event) else false } override fun dispatchKeyEvent(event: KeyEvent): Boolean { @@ -447,9 +447,9 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder { getPolkadotCheckHasImmortalUseCase() .flowWithLifecycle(lifecycle, minActiveState = Lifecycle.State.CREATED) .distinctUntilChanged() - .collect { + .collect { (_, hasImmortalTransaction) -> analyticsEventsHandler.send( - WalletScreenAnalyticsEvent.Token.PolkadotImmortalTransactions(it.second), + WalletScreenAnalyticsEvent.Token.PolkadotImmortalTransactions(hasImmortalTransaction), ) } } diff --git a/app/src/main/java/com/tangem/tap/TangemApplication.kt b/app/src/main/java/com/tangem/tap/TangemApplication.kt index 9a3f617366..164150ae73 100644 --- a/app/src/main/java/com/tangem/tap/TangemApplication.kt +++ b/app/src/main/java/com/tangem/tap/TangemApplication.kt @@ -88,7 +88,7 @@ lateinit var store: Store lateinit var foregroundActivityObserver: ForegroundActivityObserver internal lateinit var derivationsFinder: DerivationsFinder -abstract class TangemApplication : Application(), ImageLoaderFactory, Configuration.Provider { +open class TangemApplication : Application(), ImageLoaderFactory, Configuration.Provider { // region DI private val entryPoint: ApplicationEntryPoint diff --git a/app/src/main/java/com/tangem/tap/common/TestActions.kt b/app/src/main/java/com/tangem/tap/common/TestActions.kt index 5dc923cf58..95edcd851e 100644 --- a/app/src/main/java/com/tangem/tap/common/TestActions.kt +++ b/app/src/main/java/com/tangem/tap/common/TestActions.kt @@ -7,7 +7,7 @@ package com.tangem.tap.common object TestActions { // It used only for the test actions in debug or debug_beta builds - var testAmountInjectionForWalletManagerEnabled = false + var isTestAmountInjectionForWalletManagerEnabled = false } typealias TestAction = Pair Unit> \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/common/analytics/converters/AnalyticsErrorConverter.kt b/app/src/main/java/com/tangem/tap/common/analytics/converters/AnalyticsErrorConverter.kt index 4f32eee854..a94aa24beb 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/converters/AnalyticsErrorConverter.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/converters/AnalyticsErrorConverter.kt @@ -58,7 +58,7 @@ private class BlockchainSdkErrorConverter( if (value.customMessage.contains(DemoTransactionSender.ID)) return emptyMap() if (value is BlockchainSdkError.WrappedTangemError) { - return (value.tangemError as? TangemSdkError)?.let { cardSdkErrorConverter.convert(it) } ?: emptyMap() + return (value.tangemError as? TangemSdkError)?.let { cardSdkErrorConverter.convert(it) }.orEmpty() } return mapOf( diff --git a/app/src/main/java/com/tangem/tap/common/analytics/events/Chat.kt b/app/src/main/java/com/tangem/tap/common/analytics/events/Chat.kt index f4b9dbc61f..e239d1ccc6 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/events/Chat.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/events/Chat.kt @@ -7,7 +7,7 @@ import com.tangem.core.analytics.models.AnalyticsEvent */ sealed class Chat( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent("Chat", event, params) { class ScreenOpened : Chat("Chat Screen Opened") diff --git a/app/src/main/java/com/tangem/tap/common/analytics/events/Onboarding.kt b/app/src/main/java/com/tangem/tap/common/analytics/events/Onboarding.kt index f35a636601..a4fcb32fe0 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/events/Onboarding.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/events/Onboarding.kt @@ -8,7 +8,7 @@ import com.tangem.core.analytics.models.AnalyticsEvent sealed class Onboarding( category: String, event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent(category, event, params) { class Started : Onboarding("Onboarding", "Onboarding Started") @@ -16,7 +16,7 @@ sealed class Onboarding( sealed class CreateWallet( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Onboarding("Onboarding / Create Wallet", event, params) { class ScreenOpened : CreateWallet("Create Wallet Screen Opened") @@ -36,7 +36,7 @@ sealed class Onboarding( sealed class Backup( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Onboarding("Onboarding / Backup", event, params) { class ScreenOpened : Backup("Backup Screen Opened") @@ -64,7 +64,7 @@ sealed class Onboarding( sealed class Topup( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Onboarding("Onboarding / Top Up", event, params) { class ScreenOpened : Topup("Activation Screen Opened") @@ -79,7 +79,7 @@ sealed class Onboarding( sealed class Twins( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Onboarding("Onboarding / Twins", event, params) { class ScreenOpened : Twins("Twinning Screen Opened") diff --git a/app/src/main/java/com/tangem/tap/common/analytics/events/Settings.kt b/app/src/main/java/com/tangem/tap/common/analytics/events/Settings.kt index 4234256e8c..3ac65172d2 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/events/Settings.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/events/Settings.kt @@ -8,7 +8,7 @@ import com.tangem.core.analytics.models.AnalyticsEvent sealed class Settings( category: String = "Settings", event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent(category, event, params) { class ScreenOpened : Settings(event = "Settings Screen Opened") @@ -17,7 +17,7 @@ sealed class Settings( sealed class CardSettings( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Settings("Settings / Card Settings", event, params) { class ButtonFactoryReset : CardSettings("Button - Factory Reset") @@ -54,7 +54,7 @@ sealed class Settings( sealed class AppSettings( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Settings(category = "Settings / App Settings", event = event, params = params) { class SaveWalletSwitcherChanged(state: AnalyticsParam.OnOffState) : AppSettings( diff --git a/app/src/main/java/com/tangem/tap/common/analytics/events/SignIn.kt b/app/src/main/java/com/tangem/tap/common/analytics/events/SignIn.kt index a9a52c5e25..d34334ec34 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/events/SignIn.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/events/SignIn.kt @@ -7,7 +7,7 @@ import com.tangem.core.analytics.models.AnalyticsEvent */ sealed class SignIn( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent("Sign In", event, params) { class ScreenOpened : SignIn(event = "Sign In Screen Opened") diff --git a/app/src/main/java/com/tangem/tap/common/analytics/events/Token.kt b/app/src/main/java/com/tangem/tap/common/analytics/events/Token.kt index 9f6214a78a..bac4bcc6d2 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/events/Token.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/events/Token.kt @@ -9,12 +9,12 @@ import com.tangem.core.analytics.models.AnalyticsParam.Key.TOKEN_PARAM sealed class Token( category: String, event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : AnalyticsEvent(category, event, params) { sealed class Receive( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Token("Token / Receive", event, params) { class ScreenOpened( @@ -29,7 +29,7 @@ sealed class Token( sealed class Topup( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Token("Token / Topup", event, params) { class ScreenOpened : Topup("Top Up Screen Opened") @@ -38,7 +38,7 @@ sealed class Token( sealed class Withdraw( event: String, - params: Map = mapOf(), + params: Map = emptyMap(), ) : Token("Token / Withdraw", event, params) { class ScreenOpened : Withdraw("Withdraw Screen Opened") diff --git a/app/src/main/java/com/tangem/tap/common/clipboard/DefaultClipboardManager.kt b/app/src/main/java/com/tangem/tap/common/clipboard/DefaultClipboardManager.kt index 73f2ebd5ef..1c33fe0909 100644 --- a/app/src/main/java/com/tangem/tap/common/clipboard/DefaultClipboardManager.kt +++ b/app/src/main/java/com/tangem/tap/common/clipboard/DefaultClipboardManager.kt @@ -19,6 +19,7 @@ internal class DefaultClipboardManager(private val clipboardManager: AndroidClip clipboardManager.setPrimaryClip(clip) } + @Suppress("UseIsNullOrEmpty") override fun getText(default: String?): String? { val clip = clipboardManager.primaryClip diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Store.kt b/app/src/main/java/com/tangem/tap/common/extensions/Store.kt index 5d48278690..62bf0eb950 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/Store.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/Store.kt @@ -90,6 +90,6 @@ fun Store.dispatchNavigationAction(action: AppRouter.() -> Unit) { inline fun Store.inject(getDependency: DaggerGraphState.() -> T?): T { return requireNotNull(state.daggerGraphState.getDependency()) { - "${T::class.simpleName} isn't initialized " + "${T::class.simpleName.orEmpty()} isn't initialized " } } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/common/extensions/WalletManager.kt b/app/src/main/java/com/tangem/tap/common/extensions/WalletManager.kt index 55ebaa1ea3..3aeeb7d9cd 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/WalletManager.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/WalletManager.kt @@ -22,9 +22,9 @@ import timber.log.Timber ) @Suppress("MagicNumber") suspend fun WalletManager.safeUpdate(isDemoCard: Boolean): Result = try { - if (isDemoCard || TestActions.testAmountInjectionForWalletManagerEnabled) { + if (isDemoCard || TestActions.isTestAmountInjectionForWalletManagerEnabled) { delay(500) - TestActions.testAmountInjectionForWalletManagerEnabled = false + TestActions.isTestAmountInjectionForWalletManagerEnabled = false Result.Success(wallet) } else { update() @@ -35,7 +35,7 @@ suspend fun WalletManager.safeUpdate(isDemoCard: Boolean): Result = try val networkConnectionManager = store.inject(DaggerGraphState::networkConnectionManager) if (!networkConnectionManager.isOnline) { - Result.Failure(TapError.NoInternetConnection) + Result.Failure(TapError.NoInternetConnection()) } else { val blockchain = wallet.blockchain val amountToCreateAccount = blockchain.amountToCreateAccount(this, wallet.getFirstToken()) diff --git a/app/src/main/java/com/tangem/tap/common/log/TangemAppLoggerInitializer.kt b/app/src/main/java/com/tangem/tap/common/log/TangemAppLoggerInitializer.kt index a2011ff5e7..924cbede00 100644 --- a/app/src/main/java/com/tangem/tap/common/log/TangemAppLoggerInitializer.kt +++ b/app/src/main/java/com/tangem/tap/common/log/TangemAppLoggerInitializer.kt @@ -44,6 +44,7 @@ class TangemAppLoggerInitializer( } } + @Suppress("BooleanPropertyNaming") private companion object { val IS_LOG_ENABLED: Boolean = BuildConfig.LOG_ENABLED val PERMITTED_PRIORITY = listOf(Log.ERROR, Log.INFO) diff --git a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt index 090cbc72f8..598ad3be24 100644 --- a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt +++ b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalState.kt @@ -20,6 +20,6 @@ data class GlobalState( typealias CryptoCurrencyName = String data class OnboardingState( - val onboardingStarted: Boolean = false, + val isOnboardingStarted: Boolean = false, val shouldResetOnCreate: Boolean = false, ) \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/core/navigation/email/AndroidEmailSender.kt b/app/src/main/java/com/tangem/tap/core/navigation/email/AndroidEmailSender.kt index 8d7beb3948..12e69c91b8 100644 --- a/app/src/main/java/com/tangem/tap/core/navigation/email/AndroidEmailSender.kt +++ b/app/src/main/java/com/tangem/tap/core/navigation/email/AndroidEmailSender.kt @@ -61,9 +61,9 @@ internal class AndroidEmailSender : EmailSender { .setSubject(email.subject) .setText(email.message) - email.attachment?.let { + email.attachment?.let { file -> builder.setStream( - FileProvider.getUriForFile(activity, "${activity.packageName}.provider", it), + FileProvider.getUriForFile(activity, "${activity.packageName}.provider", file), ) } diff --git a/app/src/main/java/com/tangem/tap/domain/TangemSigner.kt b/app/src/main/java/com/tangem/tap/domain/TangemSigner.kt index dffd82ec11..67e1652a6e 100644 --- a/app/src/main/java/com/tangem/tap/domain/TangemSigner.kt +++ b/app/src/main/java/com/tangem/tap/domain/TangemSigner.kt @@ -39,7 +39,7 @@ class TangemSigner( TangemSignerResponse( totalSignedHashes = result.data.totalSignedHashes, remainingSignatures = result.data.remainingSignatures, - isRing = result.data.batchId?.let(::isRing) ?: false, + isRing = result.data.batchId?.let(::isRing) == true, ), ) if (continuation.isActive) { @@ -85,7 +85,7 @@ class TangemSigner( TangemSignerResponse( totalSignedHashes = result.data.totalSignedHashes, remainingSignatures = result.data.remainingSignatures, - isRing = result.data.batchId?.let(::isRing) ?: false, + isRing = result.data.batchId?.let(::isRing) == true, ), ) if (continuation.isActive) { diff --git a/app/src/main/java/com/tangem/tap/domain/TapErrors.kt b/app/src/main/java/com/tangem/tap/domain/TapErrors.kt index 1fc37a0267..2f1677fc5d 100644 --- a/app/src/main/java/com/tangem/tap/domain/TapErrors.kt +++ b/app/src/main/java/com/tangem/tap/domain/TapErrors.kt @@ -20,23 +20,23 @@ sealed class TapError( override val args: List? = null, ) : Throwable(), TapErrors, ArgError { - object UnknownError : TapError(R.string.send_error_unknown) + class UnknownError : TapError(R.string.send_error_unknown) open class CustomError(val customMessage: String) : TapError(R.string.common_custom_string, listOf(customMessage)) - object NoInternetConnection : TapError(R.string.wallet_notification_no_internet) + class NoInternetConnection : TapError(R.string.wallet_notification_no_internet) sealed class WalletManager { class NoAccountError(amountToCreateAccount: String) : CustomError(amountToCreateAccount) class InternalError(message: String) : CustomError(message) - object BlockchainIsUnreachableTryLater : TapError(R.string.wallet_balance_blockchain_unreachable_try_later) + class BlockchainIsUnreachableTryLater : TapError(R.string.wallet_balance_blockchain_unreachable_try_later) } } sealed class TapSdkError(override val messageResId: Int?) : TangemError(code = 50100) { override var customMessage: String = code.toString() - object CardForDifferentApp : TapSdkError(R.string.alert_unsupported_card) - object CardNotSupportedByRelease : TapSdkError(R.string.error_wrong_card_type) + class CardForDifferentApp : TapSdkError(R.string.alert_unsupported_card) + class CardNotSupportedByRelease : TapSdkError(R.string.error_wrong_card_type) } fun TapErrors.assembleErrors(): MutableList?>> { diff --git a/app/src/main/java/com/tangem/tap/domain/card/DefaultResetCardUseCase.kt b/app/src/main/java/com/tangem/tap/domain/card/DefaultResetCardUseCase.kt index b86f57ce33..cd94802690 100644 --- a/app/src/main/java/com/tangem/tap/domain/card/DefaultResetCardUseCase.kt +++ b/app/src/main/java/com/tangem/tap/domain/card/DefaultResetCardUseCase.kt @@ -70,7 +70,7 @@ internal class DefaultResetCardUseCase( null } - type?.let { + if (type != null) { tangemSdkManager.setUserCodeRequestPolicy(policy = UserCodeRequestPolicy.Always(type)) } } diff --git a/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt b/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt index 5b44a91292..17ce65a238 100644 --- a/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt +++ b/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt @@ -119,14 +119,14 @@ internal class LegacyScanProcessor @Inject constructor( } private fun sendAnalytics(analyticsEvent: AnalyticsEvent?, scanResponse: ScanResponse) { - analyticsEvent?.let { + analyticsEvent?.let { event -> // this workaround needed to send CardWasScannedEvent without adding a context val interceptor = CardContextInterceptor(scanResponse) - val params = it.params.toMutableMap() + val params = event.params.toMutableMap() interceptor.intercept(params) - it.params = params.toMap() + event.params = params.toMap() - Analytics.send(it) + Analytics.send(event) } } diff --git a/app/src/main/java/com/tangem/tap/domain/scanCard/UseCaseScanProcessor.kt b/app/src/main/java/com/tangem/tap/domain/scanCard/UseCaseScanProcessor.kt index abf3f1f23d..6076dd07d3 100644 --- a/app/src/main/java/com/tangem/tap/domain/scanCard/UseCaseScanProcessor.kt +++ b/app/src/main/java/com/tangem/tap/domain/scanCard/UseCaseScanProcessor.kt @@ -33,8 +33,8 @@ internal object UseCaseScanProcessor { return scanCardUseCase(cardId, allowsRequestAccessCodeFromRepository) .fold( - ifLeft = { - val error = scanCardExceptionConverter.convertBack(it) + ifLeft = { scanCardException -> + val error = scanCardExceptionConverter.convertBack(scanCardException) Analytics.sendErrorEvent(TangemSdkErrorEvent(error)) CompletionResult.Failure(error) diff --git a/app/src/main/java/com/tangem/tap/domain/scanCard/chains/ScanChainException.kt b/app/src/main/java/com/tangem/tap/domain/scanCard/chains/ScanChainException.kt index b36fb89f0e..cd7a62cab3 100644 --- a/app/src/main/java/com/tangem/tap/domain/scanCard/chains/ScanChainException.kt +++ b/app/src/main/java/com/tangem/tap/domain/scanCard/chains/ScanChainException.kt @@ -8,10 +8,10 @@ sealed class ScanChainException : ScanCardException.ChainException() { /** * May be returned from [DisclaimerChain] * */ - data object DisclaimerWasCanceled : ScanChainException() { + class DisclaimerWasCanceled : ScanChainException() { @Suppress("UnusedPrivateMember") - private fun readResolve(): Any = DisclaimerWasCanceled + private fun readResolve(): Any = DisclaimerWasCanceled() } /** diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/MockProvider.kt b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/MockProvider.kt index 3019dbeba0..c184799348 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/MockProvider.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/MockProvider.kt @@ -13,19 +13,19 @@ object MockProvider { private var content: MockContent = getMockContent(ProductType.Wallet) - private var emulateError: Boolean = false + private var isEmulatingError: Boolean = false private var emulatedError: TangemError = TangemSdkError.TagLost() fun setEmulateError(error: TangemError? = null) { - emulateError = true + isEmulatingError = true error?.let { emulatedError = it } } fun resetEmulateError() { - emulateError = false + isEmulatingError = false } fun setMocks(productType: ProductType) { @@ -74,7 +74,7 @@ object MockProvider { } private fun CompletionResult.Success.orFailure(): CompletionResult { - return if (emulateError) { + return if (isEmulatingError) { CompletionResult.Failure(emulatedError) } else { this diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/BackupWalletMockContent.kt b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/BackupWalletMockContent.kt index c2c8d9ba23..284c59ef1a 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/BackupWalletMockContent.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/BackupWalletMockContent.kt @@ -168,52 +168,52 @@ object BackupWalletMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/84'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch - publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), - chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge - publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), - chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/195'/0'/0/0") to ExtendedPublicKey( - publicKey = byteArrayOf(2, -40, 115, -15, 80, 104, 100, -29, 80, 29, 112, -35, -54, 64, -98, 45, 115, 108, 93, 113, -71, 89, 17, 72, 98, 21, 126, 82, -50, 50, -12, -87, -62), - chainCode = byteArrayOf(-27, 56, 57, 54, 27, -40, 65, 109, 119, -54, -94, 88, -29, -115, -45, -112, -31, 57, 53, 56, 118, 87, 34, -16, -64, -45, 105, 77, 91, -106, -92, 41), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/84'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch + publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), + chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge + publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), + chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/195'/0'/0/0") to ExtendedPublicKey( + publicKey = byteArrayOf(2, -40, 115, -15, 80, 104, 100, -29, 80, 29, 112, -35, -54, 64, -98, 45, 115, 108, 93, 113, -71, 89, 17, 72, 98, 21, 126, 82, -50, 50, -12, -87, -62), + chainCode = byteArrayOf(-27, 56, 57, 54, 27, -40, 65, 109, 119, -54, -94, 88, -29, -115, -45, -112, -31, 57, 53, 56, 118, 87, 34, -16, -64, -45, 105, 77, 91, -106, -92, 41), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), ) @@ -234,24 +234,24 @@ object BackupWalletMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), primaryCard = primaryCard, ) diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/DevWalletMockContent.kt b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/DevWalletMockContent.kt index 29b0ec5fee..e37fa805a0 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/DevWalletMockContent.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/DevWalletMockContent.kt @@ -168,52 +168,52 @@ object DevWalletMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/84'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch - publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), - chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge - publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), - chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/195'/0'/0/0") to ExtendedPublicKey( - publicKey = byteArrayOf(2, -40, 115, -15, 80, 104, 100, -29, 80, 29, 112, -35, -54, 64, -98, 45, 115, 108, 93, 113, -71, 89, 17, 72, 98, 21, 126, 82, -50, 50, -12, -87, -62), - chainCode = byteArrayOf(-27, 56, 57, 54, 27, -40, 65, 109, 119, -54, -94, 88, -29, -115, -45, -112, -31, 57, 53, 56, 118, 87, 34, -16, -64, -45, 105, 77, 91, -106, -92, 41), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/84'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch + publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), + chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge + publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), + chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/195'/0'/0/0") to ExtendedPublicKey( + publicKey = byteArrayOf(2, -40, 115, -15, 80, 104, 100, -29, 80, 29, 112, -35, -54, 64, -98, 45, 115, 108, 93, 113, -71, 89, 17, 72, 98, 21, 126, 82, -50, 50, -12, -87, -62), + chainCode = byteArrayOf(-27, 56, 57, 54, 27, -40, 65, 109, 119, -54, -94, 88, -29, -115, -45, -112, -31, 57, 53, 56, 118, 87, 34, -16, -64, -45, 105, 77, 91, -106, -92, 41), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), ) @@ -234,24 +234,24 @@ object DevWalletMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), primaryCard = primaryCard, ) diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2MockContent.kt b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2MockContent.kt index 9b8fcc752f..3738bc3689 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2MockContent.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2MockContent.kt @@ -219,38 +219,38 @@ object Wallet2MockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch - publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), - chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge - publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), - chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch + publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), + chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge + publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), + chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), ) @@ -271,24 +271,24 @@ object Wallet2MockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), primaryCard = primaryCard, ) diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2WithSeedPhraseMockContent.kt b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2WithSeedPhraseMockContent.kt index 06d7e7db26..d0625bd95a 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2WithSeedPhraseMockContent.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/Wallet2WithSeedPhraseMockContent.kt @@ -219,38 +219,38 @@ object Wallet2WithSeedPhraseMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch - publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), - chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge - publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), - chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch + publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), + chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge + publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), + chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), ) @@ -271,24 +271,24 @@ object Wallet2WithSeedPhraseMockContent : MockContent { byteArrayOf(3, 23, -112, -57, 109, 60, -82, -36, 45, -14, -34, -12, 10, -89, 14, 37, 38, 36, -102, 37, 93, 90, 69, -113, -117, 120, -29, 12, -125, 43, -40, -31, 5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), primaryCard = primaryCard, ) diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/WalletMockContent.kt b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/WalletMockContent.kt index 1db7cd1bb9..1ce637b289 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/WalletMockContent.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/mocks/content/WalletMockContent.kt @@ -168,59 +168,59 @@ object WalletMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/84'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch - publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), - chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/144'/0'/0/0") to ExtendedPublicKey( // xrp - publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), - chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge - publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), - chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/195'/0'/0/0") to ExtendedPublicKey( - publicKey = byteArrayOf(2, -40, 115, -15, 80, 104, 100, -29, 80, 29, 112, -35, -54, 64, -98, 45, 115, 108, 93, 113, -71, 89, 17, 72, 98, 21, 126, 82, -50, 50, -12, -87, -62), - chainCode = byteArrayOf(-27, 56, 57, 54, 27, -40, 65, 109, 119, -54, -94, 88, -29, -115, -45, -112, -31, 57, 53, 56, 118, 87, 34, -16, -64, -45, 105, 77, 91, -106, -92, 41), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/84'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/145'/0'/0/0") to ExtendedPublicKey( // bch + publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), + chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/144'/0'/0/0") to ExtendedPublicKey( // xrp + publicKey = byteArrayOf(2, 38, -6, 92, -37, -91, -59, -108, -18, -119, -55, 41, 38, -33, 44, 59, 24, -79, -14, -38, -10, -123, 106, 56, 39, 8, 112, 29, -41, 99, 70, -104, -121), + chainCode = byteArrayOf(105, -21, -61, -50, 68, -89, 119, 53, -96, -40, 119, 77, -122, 121, 16, 40, -50, -48, -105, -101, -74, -7, -94, -59, -90, 96, 59, 99, 43, -91, 115, -29), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/3'/0'/0/0") to ExtendedPublicKey( // doge + publicKey = byteArrayOf(3, -25, -24, -97, -124, 24, -89, 44, 75, 123, 92, -86, -73, -93, 25, -90, -89, -95, 88, 3, 107, 37, -1, -85, -32, -57, -123, -41, 108, -9, -96, 77, -124), + chainCode = byteArrayOf(119, 3, 41, 112, 71, 54, 72, 30, 39, 25, 25, -104, 92, 46, -109, 63, 93, 67, 43, -102, -87, 39, -95, 106, 45, 67, 109, -29, -35, 10, -107, 104), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/195'/0'/0/0") to ExtendedPublicKey( + publicKey = byteArrayOf(2, -40, 115, -15, 80, 104, 100, -29, 80, 29, 112, -35, -54, 64, -98, 45, 115, 108, 93, 113, -71, 89, 17, 72, 98, 21, 126, 82, -50, 50, -12, -87, -62), + chainCode = byteArrayOf(-27, 56, 57, 54, 27, -40, 65, 109, 119, -54, -94, 88, -29, -115, -45, -112, -31, 57, 53, 56, 118, 87, 34, -16, -64, -45, 105, 77, 91, -106, -92, 41), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), ) @@ -241,24 +241,24 @@ object WalletMockContent : MockContent { byteArrayOf(2, -109, 28, -27, -124, -58, -97, -61, 43, -84, 90, -9, -5, 4, 90, 17, 112, -125, -108, 44, 19, -79, -60, -23, 34, -20, -20, 61, 84, 113, 120, -90, -5), ) to - ExtendedPublicKeysMap( - mapOf( - DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc - publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), - chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), - DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth - publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), - chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), - depth = 0, - parentFingerprint = byteArrayOf(0, 0, 0, 0), - childNumber = 0, - ), + ExtendedPublicKeysMap( + mapOf( + DerivationPath("m/44'/0'/0'/0/0") to ExtendedPublicKey( // btc + publicKey = byteArrayOf(3, 45, 58, -110, -52, -51, -83, -4, -45, -118, 119, 37, 123, -17, 66, -83, 61, -106, 115, 47, 121, 66, 84, -122, -57, -45, 7, -79, 70, -13, 28, -125, -52), + chainCode = byteArrayOf(93, 51, 52, -66, -39, -38, 34, -84, 50, 1, -127, -20, 80, -20, -30, -72, 2, 1, -78, -81, -17, 51, -52, -25, 12, 108, 50, 89, -66, 18, 65, 70), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, + ), + DerivationPath("m/44'/60'/0'/0/0") to ExtendedPublicKey( // eth + publicKey = byteArrayOf(2, 34, 6, 119, -106, 5, -119, 111, -22, 8, 23, -108, -72, -56, 6, 77, -17, -61, -101, -85, 16, 28, 18, 3, -3, -89, -81, -108, 48, -7, -86, -82, -67), + chainCode = byteArrayOf(-75, 55, 107, -106, -37, -81, -15, 72, -102, 94, 55, -39, 9, -112, 1, 90, -50, 103, 53, 120, -92, -36, -85, -39, -65, 1, 88, 46, 92, 104, -13, -109), + depth = 0, + parentFingerprint = byteArrayOf(0, 0, 0, 0), + childNumber = 0, ), ), + ), ), primaryCard = primaryCard, ) diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/SignHashesTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/SignHashesTask.kt index 8d637b7c78..7e559abf8e 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/SignHashesTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/SignHashesTask.kt @@ -42,7 +42,12 @@ class SignHashesTask( is CompletionResult.Failure -> { when { response.error is TangemSdkError.WalletNotFound && pairWalletPublicKey != null -> { - sign(session, pairWalletPublicKey, publicKey.derivationPath, callback) + sign( + session = session, + publicKey = pairWalletPublicKey, + derivationPath = publicKey.derivationPath, + callback = callback, + ) } else -> callback(CompletionResult.Failure(response.error)) } diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt index fba95394c0..ac172d1b9c 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt @@ -64,22 +64,28 @@ class CreateProductWalletTask( cardTypesResolver.isTangemTwins() -> throw UnsupportedOperationException("Use the TwinCardsManager to create a wallet") - else -> CreateWalletTangemWallet(mnemonic, passphrase, shouldReset, derivationStyleProvider, cardDto) + else -> CreateWalletTangemWallet( + mnemonic = mnemonic, + passphrase = passphrase, + shouldReset = shouldReset, + derivationStyleProvider = derivationStyleProvider, + cardDTO = cardDto, + ) } - commandProcessor.proceed(cardDto, session) { - when (it) { + commandProcessor.proceed(cardDto, session) { result -> + when (result) { is CompletionResult.Success -> { - val result = when (commandProcessor) { + val createProductWalletTaskResponse = when (commandProcessor) { is CreateWalletTangemWallet -> { - it.data as CreateProductWalletTaskResponse + result.data as CreateProductWalletTaskResponse } - else -> CreateProductWalletTaskResponse(card = session.environment.card!!) + else -> CreateProductWalletTaskResponse(card = requireNotNull(session.environment.card)) } - callback(CompletionResult.Success(result)) + callback(CompletionResult.Success(createProductWalletTaskResponse)) } - is CompletionResult.Failure -> callback(CompletionResult.Failure(it.error)) + is CompletionResult.Failure -> callback(CompletionResult.Failure(result.error)) } } } @@ -156,7 +162,12 @@ private class CreateWalletTangemWallet( CreateWalletsTask(cardConfig.mandatoryCurves, mnemonic, passphrase).run(session) { result -> when (result) { is CompletionResult.Success -> { - checkIfAllWalletsCreated(card, session, result.data, callback) + checkIfAllWalletsCreated( + card = card, + session = session, + createResponse = result.data, + callback = callback, + ) } is CompletionResult.Failure -> { callback(CompletionResult.Failure(result.error)) @@ -210,12 +221,16 @@ private class CreateWalletTangemWallet( callback: (result: CompletionResult) -> Unit, ) { val resetCommand = ResetToFactorySettingsTask(allowsRequestAccessCodeFromRepository = false) - resetCommand.run(session) { - when (it) { + resetCommand.run(session) { result -> + when (result) { is CompletionResult.Success -> { - createMultiWallet(card, session, callback) + createMultiWallet( + card = card, + session = session, + callback = callback, + ) } - is CompletionResult.Failure -> callback(CompletionResult.Failure(it.error)) + is CompletionResult.Failure -> callback(CompletionResult.Failure(result.error)) } } } @@ -228,17 +243,27 @@ private class CreateWalletTangemWallet( ) { when { card.settings.isBackupAllowed -> { - linkPrimaryCard(card, createWalletResponses, session, callback) + linkPrimaryCard( + card = card, + createWalletResponses = createWalletResponses, + session = session, + callback = callback, + ) } card.settings.isHDWalletAllowed -> { - deriveKeys(card, createWalletResponses, session, callback) + deriveKeys( + card = card, + createWalletResponses = createWalletResponses, + session = session, + callback = callback, + ) } else -> { callback( CompletionResult.Success( - CreateProductWalletTaskResponse(card = session.environment.card!!), + CreateProductWalletTaskResponse(card = requireNotNull(session.environment.card)), ), ) } @@ -247,7 +272,7 @@ private class CreateWalletTangemWallet( private fun linkPrimaryCard( card: CardDTO, - createWalletResponse: List, + createWalletResponses: List, session: CardSession, callback: (result: CompletionResult) -> Unit, ) { @@ -257,14 +282,19 @@ private class CreateWalletTangemWallet( primaryCard = result.data when { card.settings.isHDWalletAllowed -> { - deriveKeys(card, createWalletResponse, session, callback) + deriveKeys( + card = card, + createWalletResponses = createWalletResponses, + session = session, + callback = callback, + ) } else -> { callback( CompletionResult.Success( CreateProductWalletTaskResponse( - card = session.environment.card!!, + card = requireNotNull(session.environment.card), primaryCard = primaryCard, ), ), @@ -282,13 +312,13 @@ private class CreateWalletTangemWallet( private fun deriveKeys( card: CardDTO, - createWalletResponse: List, + createWalletResponses: List, session: CardSession, callback: (result: CompletionResult) -> Unit, ) { val map = mutableMapOf>() var isBlockchainsForCurvesExist = false - createWalletResponse.forEach { response -> + createWalletResponses.forEach { response -> val blockchainsForCurve = getBlockchains(response.cardId, card).filter { it.getSupportedCurves().contains(response.wallet.curve) } diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateWalletsTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateWalletsTask.kt index c0ddcdeea3..628dbf9005 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateWalletsTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateWalletsTask.kt @@ -42,7 +42,7 @@ class CreateWalletsTask( callback: (result: CompletionResult) -> Unit, ) { val extendedPrivateKey = mnemonic?.let { - AnyMasterKeyFactory(mnemonic = it, passphrase = passphrase ?: "").makeMasterKey(curve) + AnyMasterKeyFactory(mnemonic = it, passphrase = passphrase.orEmpty()).makeMasterKey(curve) } CreateWalletTask(curve, extendedPrivateKey).run(session) { result -> when (result) { diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt index fa255fdacb..54df91df2f 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt @@ -34,12 +34,10 @@ internal class DerivationsFinder( val userWalletId = UserWalletIdBuilder.card(card).build() ?: return emptySet() val derivationStyle = derivationStyleProvider.getDerivationStyle() - var blockchains = withContext(dispatchers.io) { + val blockchains = withContext(dispatchers.io) { getBlockchains(userWalletId) - } - - if (blockchains.isEmpty()) { - blockchains = if (DemoHelper.isDemoCardId(card.cardId)) { + }.ifEmpty { + if (DemoHelper.isDemoCardId(card.cardId)) { getDemoBlockchains(derivationStyle) } else { getDefaultBlockchains(derivationStyle) diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/ResetToFactorySettingsTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/ResetToFactorySettingsTask.kt index 51ff0b2d80..c00639f1bd 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/ResetToFactorySettingsTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/ResetToFactorySettingsTask.kt @@ -19,10 +19,15 @@ class ResetToFactorySettingsTask( } private fun deleteWallets(session: CardSession, callback: (result: CompletionResult) -> Unit) { - val wallet = session.environment.card?.wallets?.lastOrNull().guard { - resetBackup(session, callback) - return - } + val wallet = session + .environment + .card + ?.wallets + ?.lastOrNull() + .guard { + resetBackup(session, callback) + return + } PurgeWalletCommand(wallet.publicKey).run(session) { result -> when (result) { diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt index df05ce2f7e..27bc6e7e13 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt @@ -111,13 +111,13 @@ internal class ScanProductTask( } private fun getErrorIfExcludedCard(cardDto: CardDTO, card: Card): TangemError? { - if (cardDto.isExcluded) return TapSdkError.CardForDifferentApp - if (cardDto.isNotSupportedInThatRelease) return TapSdkError.CardNotSupportedByRelease + if (cardDto.isExcluded) return TapSdkError.CardForDifferentApp() + if (cardDto.isNotSupportedInThatRelease) return TapSdkError.CardNotSupportedByRelease() // according ios decline card lower Ed25519Slip0010Available version and contains imported wallets if (card.firmwareVersion < FirmwareVersion.Ed25519Slip0010Available && card.wallets.any { it.isImported } ) { - return TapSdkError.CardNotSupportedByRelease + return TapSdkError.CardNotSupportedByRelease() } return null } @@ -253,12 +253,13 @@ private class ScanWalletProcessor( callback: (result: CompletionResult) -> Unit, ) { mainScope.launch { - val activationInProgress = store.inject(DaggerGraphState::cardRepository) + val isActivationInProgress = store.inject(DaggerGraphState::cardRepository) .isActivationInProgress(card.cardId) @Suppress("ComplexCondition") - if (card.backupStatus == CardDTO.BackupStatus.NoBackup && card.wallets.isNotEmpty() && - activationInProgress + if (card.backupStatus == CardDTO.BackupStatus.NoBackup && + card.wallets.isNotEmpty() && + isActivationInProgress ) { StartPrimaryCardLinkingTask().run(session) { linkingResult -> when (linkingResult) { @@ -372,8 +373,8 @@ private class ScanTwinProcessor : ProductCommandProcessor { return@run } - val verified = TwinsHelper.verifyTwinPublicKey(readDataResult.data.issuerData, publicKey) - val response = if (verified) { + val isVerified = TwinsHelper.verifyTwinPublicKey(readDataResult.data.issuerData, publicKey) + val response = if (isVerified) { val twinPublicKey = readDataResult.data.issuerData.sliceArray(0 until 65) val walletData = session.environment.walletData ScanResponse( diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt index 9dd041b2ea..547876b22f 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt @@ -153,9 +153,9 @@ class VisaCardActivationTask @AssistedInject constructor( val otpTaskDeferred = async { createOTP() } val dataToSign = dataToSignDeferred.await() - .getOrElse { + .getOrElse { error -> otpTaskDeferred.cancel() - return@coroutineScope CompletionResult.Failure(it) + return@coroutineScope CompletionResult.Failure(error) } otpTaskDeferred.await() diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt index 4fa773c18c..64fc98c01d 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt @@ -115,8 +115,8 @@ class VisaCustomerWalletApproveTask( extendedPublicKey = extendedPublicKey, ) - validationResult.onLeft { - callback(CompletionResult.Failure(it.tangemError)) + validationResult.onLeft { error -> + callback(CompletionResult.Failure(error.tangemError)) return } @@ -137,8 +137,8 @@ class VisaCustomerWalletApproveTask( val publicKey = findKeyWithoutDerivation( targetAddress = visaDataForApprove.targetAddress, card = CardDTO(card), - ).getOrElse { - callback(CompletionResult.Failure(it.tangemError)) + ).getOrElse { error -> + callback(CompletionResult.Failure(error.tangemError)) return } diff --git a/app/src/main/java/com/tangem/tap/domain/twins/CreateSecondTwinWalletTask.kt b/app/src/main/java/com/tangem/tap/domain/twins/CreateSecondTwinWalletTask.kt index d55d7d7d32..b466017130 100644 --- a/app/src/main/java/com/tangem/tap/domain/twins/CreateSecondTwinWalletTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/twins/CreateSecondTwinWalletTask.kt @@ -37,7 +37,7 @@ class CreateSecondTwinWalletTask( } if (!TwinsHelper.isTwinsCompatible(firstCardId, card.cardId)) { - callback(CompletionResult.Failure(IncompatibleTwinCard)) + callback(CompletionResult.Failure(IncompatibleTwinCard())) return } diff --git a/app/src/main/java/com/tangem/tap/domain/twins/FinalizeTwinTask.kt b/app/src/main/java/com/tangem/tap/domain/twins/FinalizeTwinTask.kt index 8d2c83906c..2b20696ee9 100644 --- a/app/src/main/java/com/tangem/tap/domain/twins/FinalizeTwinTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/twins/FinalizeTwinTask.kt @@ -24,7 +24,7 @@ class FinalizeTwinTask( when (readResult) { is CompletionResult.Success -> ScanProductTask( - readResult.data, + card = readResult.data, derivationsFinder = null, visaCardScanHandler = null, visaCoroutineScope = null, diff --git a/app/src/main/java/com/tangem/tap/domain/twins/IncompatibleTwinCard.kt b/app/src/main/java/com/tangem/tap/domain/twins/IncompatibleTwinCard.kt index 10afdb020a..a9c4f33eb4 100644 --- a/app/src/main/java/com/tangem/tap/domain/twins/IncompatibleTwinCard.kt +++ b/app/src/main/java/com/tangem/tap/domain/twins/IncompatibleTwinCard.kt @@ -4,7 +4,7 @@ import com.tangem.common.core.TangemError import com.tangem.tap.tangemSdkManager import com.tangem.wallet.R -object IncompatibleTwinCard : TangemError(code = 50005) { +class IncompatibleTwinCard : TangemError(code = 50005) { override var customMessage: String = tangemSdkManager.getString( R.string.twin_error_wrong_twin, ) diff --git a/app/src/main/java/com/tangem/tap/domain/twins/TwinCardsManager.kt b/app/src/main/java/com/tangem/tap/domain/twins/TwinCardsManager.kt index 2a9dcc2d23..b503705f7e 100644 --- a/app/src/main/java/com/tangem/tap/domain/twins/TwinCardsManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/twins/TwinCardsManager.kt @@ -41,7 +41,7 @@ class TwinCardsManager(card: CardDTO) { creatingWalletMessage: Message, ): CompletionResult { val response = tangemSdkManager.createSecondTwinWallet( - firstPublicKey = currentCardPublicKey!!, + firstPublicKey = requireNotNull(currentCardPublicKey), firstCardId = firstCardId, issuerKeys = getIssuerKeys(), preparingMessage = preparingMessage, @@ -58,7 +58,7 @@ class TwinCardsManager(card: CardDTO) { suspend fun complete(message: Message): CompletionResult { val response = tangemSdkManager.finalizeTwin( - secondCardPublicKey = secondCardPublicKey!!.hexToBytes(), + secondCardPublicKey = requireNotNull(secondCardPublicKey).hexToBytes(), issuerKeyPair = getIssuerKeys(), cardId = firstCardId, initialMessage = message, diff --git a/app/src/main/java/com/tangem/tap/domain/twins/WriteProtectedIssuerDataTask.kt b/app/src/main/java/com/tangem/tap/domain/twins/WriteProtectedIssuerDataTask.kt index 7eae636918..7dc2b0adff 100644 --- a/app/src/main/java/com/tangem/tap/domain/twins/WriteProtectedIssuerDataTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/twins/WriteProtectedIssuerDataTask.kt @@ -21,8 +21,9 @@ class WriteProtectedIssuerDataTask( override fun run(session: CardSession, callback: (result: CompletionResult) -> Unit) { SignHashCommand( - twinPublicKey.calculateSha256(), - session.environment.card!!.wallets.first().publicKey, + hash = twinPublicKey.calculateSha256(), + walletPublicKey = requireNotNull(session.environment.card) + .wallets.first().publicKey, ) .run(session) { signResult -> when (signResult) { @@ -31,12 +32,12 @@ class WriteProtectedIssuerDataTask( when (readResult) { is CompletionResult.Success -> { writeIssuerData( - twinPublicKey, - issuerKeys, - signResult.data.signature, - readResult.data, - session, - callback, + twinPublicKey = twinPublicKey, + issuerKeys = issuerKeys, + cardSignature = signResult.data.signature, + readResponse = readResult.data, + session = session, + callback = callback, ) } is CompletionResult.Failure -> callback( @@ -78,7 +79,7 @@ class WriteProtectedIssuerDataTask( ) WriteIssuerDataCommand( issuerData = data, - issuerDataSignature = signedByIssuer.finalizingSignature!!, + issuerDataSignature = requireNotNull(signedByIssuer.finalizingSignature), issuerDataCounter = counter, issuerPublicKey = issuerKeys.publicKey, ).run(session, callback) diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt index 956ce71605..ae13a2ec94 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt @@ -57,12 +57,12 @@ internal class BiometricUserWalletsListManager( override val selectedUserWalletSync: UserWallet? get() = findSelectedUserWallet() - override val isLocked: Flow + override val lockedState: Flow get() = state .mapLatest { it.isLocked } .distinctUntilChanged() - override val isLockedSync: Boolean + override val isLocked: Boolean get() = state.value.isLocked override val hasUserWallets: Boolean @@ -103,7 +103,9 @@ internal class BiometricUserWalletsListManager( override suspend fun select(userWalletId: UserWalletId): CompletionResult = catching { if (state.value.selectedUserWalletId == userWalletId) { - return@catching findSelectedUserWallet()!! + return@catching requireNotNull(findSelectedUserWallet()) { + "Wallet is not found" + } } selectedUserWalletRepository.set(userWalletId) diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/GeneralUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/GeneralUserWalletsListManager.kt index 4ae134f570..f38d94f5c8 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/GeneralUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/GeneralUserWalletsListManager.kt @@ -93,23 +93,23 @@ internal class GeneralUserWalletsListManager( override val walletsCount: Int get() = requireImplementation.walletsCount - override val isLocked: Flow + override val lockedState: Flow get() = implementation.transformLatest { impl -> if (impl == null) return@transformLatest if (impl is UserWalletsListManager.Lockable) { - emitAll(impl.isLocked) + emitAll(impl.lockedState) } else { error("RuntimeUserWalletsListManager is not lockable") } } - override val isLockedSync: Boolean + override val isLocked: Boolean get() { val impl = requireImplementation return if (impl is UserWalletsListManager.Lockable) { - impl.isLockedSync + impl.isLocked } else { error("RuntimeUserWalletsListManager is not lockable") } @@ -173,10 +173,10 @@ internal class GeneralUserWalletsListManager( } if (possibleManager == implementation.value) { - Timber.e("Switch to the same manager ${possibleManager::class.simpleName}") + Timber.e("Switch to the same manager ${possibleManager::class.simpleName.orEmpty()}") } - Timber.i("Switch to ${possibleManager::class.simpleName}") + Timber.i("Switch to ${possibleManager::class.simpleName.orEmpty()}") val previousManager = implementation.value implementation.value = copySelectedUserWallet( diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt index 900c4bb7bf..31ad6301f0 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/RuntimeUserWalletsListManager.kt @@ -74,11 +74,13 @@ internal class RuntimeUserWalletsListManager : UserWalletsListManager { ?.takeIf { it.walletId == userWalletId } ?: walletNotFound() - state.updateAndGet { prevState -> - prevState.copy( - userWallet = update(wallet), - ) - }.userWallet!! + requireNotNull( + state.updateAndGet { prevState -> + prevState.copy( + userWallet = update(wallet), + ) + }.userWallet, + ) { "User wallet is null after update" } } override suspend fun delete(userWalletIds: List): CompletionResult = clear() diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt index b4019602d9..bc5d0c26ac 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt @@ -21,6 +21,7 @@ internal data class UserWalletSensitiveInformation( val mobileWallets: List? = null, ) +@Suppress("BooleanPropertyNaming") @JsonClass(generateAdapter = true) internal data class UserWalletPublicInformation( // Common diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/DefaultUserWalletsListRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/DefaultUserWalletsListRepository.kt index c4a0b716f7..92f7bb6ac9 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/DefaultUserWalletsListRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/DefaultUserWalletsListRepository.kt @@ -125,7 +125,7 @@ internal class DefaultUserWalletsListRepository( // update the userWallets state and add if it doesn't exist updateWallets { currentWallets -> - val wallets = currentWallets ?: emptyList() + val wallets = currentWallets.orEmpty() if (wallets.any { it.walletId == userWallet.walletId }) { wallets.map { if (it.walletId == userWallet.walletId) userWallet else it } } else { @@ -332,12 +332,12 @@ internal class DefaultUserWalletsListRepository( raise(LockWalletsError.NothingToLock) } - updateWallets { - it?.map { - if (it.walletId !in unsecuredWalletIds) { - it.lock() + updateWallets { wallets -> + wallets?.map { wallet -> + if (wallet.walletId !in unsecuredWalletIds) { + wallet.lock() } else { - it + wallet } } } @@ -395,17 +395,17 @@ internal class DefaultUserWalletsListRepository( } private suspend fun hasBiometry(): Boolean { - val useBiometricAuthentication = appPreferencesStore.getSyncOrDefault( + val isBiometricAuthenticationUsed = appPreferencesStore.getSyncOrDefault( key = PreferencesKeys.USE_BIOMETRIC_AUTHENTICATION_KEY, default = false, ) - return tangemSdkManagerProvider.invoke().canUseBiometry && useBiometricAuthentication + return tangemSdkManagerProvider.invoke().canUseBiometry && isBiometricAuthenticationUsed } private fun updateWallets(block: (List?) -> List?) { - userWallets.update { - val updated = block(it) + userWallets.update { wallets -> + val updated = block(wallets) selectedUserWallet.update { currentSelected -> if (currentSelected == null) return@update null updated?.find { it.walletId == currentSelected.walletId } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletEncryptionKeysRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletEncryptionKeysRepository.kt index 104cfc0945..faf5553d90 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletEncryptionKeysRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/UserWalletEncryptionKeysRepository.kt @@ -137,8 +137,7 @@ internal class UserWalletEncryptionKeysRepository( private suspend fun UserWalletEncryptionKey.encode(): ByteArray { return withContext(dispatchers.default) { - this@encode - .let(encryptionKeyAdapter::toJson) + encryptionKeyAdapter.toJson(this@encode) .encodeToByteArray(throwOnInvalidSequence = true) } } @@ -153,8 +152,7 @@ internal class UserWalletEncryptionKeysRepository( private suspend fun List.encode(): ByteArray { return withContext(dispatchers.default) { - this@encode - .let(userWalletsIdsListAdapter::toJson) + userWalletsIdsListAdapter.toJson(this@encode) .encodeToByteArray(throwOnInvalidSequence = true) } } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt index 1a3d1c3b38..6f82167edd 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt @@ -164,8 +164,7 @@ internal class BiometricUserWalletsKeysRepository( private suspend fun UserWalletEncryptionKey.encode(): ByteArray { return withContext(Dispatchers.Default) { - this@encode - .let(encryptionKeyAdapter::toJson) + encryptionKeyAdapter.toJson(this@encode) .encodeToByteArray(throwOnInvalidSequence = true) } } @@ -180,8 +179,7 @@ internal class BiometricUserWalletsKeysRepository( private suspend fun List.encode(): ByteArray { return withContext(Dispatchers.Default) { - this@encode - .let(userWalletsIdsListAdapter::toJson) + userWalletsIdsListAdapter.toJson(this@encode) .encodeToByteArray(throwOnInvalidSequence = true) } } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt index a66ba5bdbb..c3e8f86072 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsPublicInformationRepository.kt @@ -80,8 +80,7 @@ internal class DefaultUserWalletsPublicInformationRepository( @JvmName("saveWithPublicInformation") private suspend fun save(publicInformation: List): CompletionResult = catching { withContext(Dispatchers.IO) { - publicInformation - .let(publicInformationAdapter::toJson) + publicInformationAdapter.toJson(publicInformation) .encodeToByteArray(throwOnInvalidSequence = true) .also { secureStorage.store(it, StorageKey.UserWalletPublicInformation.name) } } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt index 23d1e3e069..f4a2c32083 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/DefaultUserWalletsSensitiveInformationRepository.kt @@ -110,18 +110,18 @@ internal class DefaultUserWalletsSensitiveInformationRepository( private suspend fun ByteArray.decodeToEncryptedSensitiveInformation(): Map? { return withContext(Dispatchers.Default) { - this@decodeToEncryptedSensitiveInformation - .decodeToString(throwOnInvalidSequence = true) - .let(encryptedSensitiveInformationMapAdapter::fromJson) + encryptedSensitiveInformationMapAdapter.fromJson( + this@decodeToEncryptedSensitiveInformation.decodeToString(throwOnInvalidSequence = true), + ) } } private suspend fun ByteArray.decodeToSensitiveInformation(): UserWalletSensitiveInformation? { return withContext(Dispatchers.Default) { try { - this@decodeToSensitiveInformation - .decodeToString(throwOnInvalidSequence = true) - .let(sensitiveInformationAdapter::fromJson) + sensitiveInformationAdapter.fromJson( + this@decodeToSensitiveInformation.decodeToString(throwOnInvalidSequence = true), + ) } catch (e: CharacterCodingException) { Timber.e(e, "Unable to decode sensitive information") @@ -132,16 +132,14 @@ internal class DefaultUserWalletsSensitiveInformationRepository( private suspend fun UserWalletSensitiveInformation.encode(): ByteArray { return withContext(Dispatchers.Default) { - this@encode - .let(sensitiveInformationAdapter::toJson) + sensitiveInformationAdapter.toJson(this@encode) .encodeToByteArray(throwOnInvalidSequence = true) } } private suspend fun Map.encode(): ByteArray { return withContext(Dispatchers.Default) { - this@encode - .let(encryptedSensitiveInformationMapAdapter::toJson) + encryptedSensitiveInformationMapAdapter.toJson(this@encode) .encodeToByteArray(throwOnInvalidSequence = true) } } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt index ec627a4e34..ea08934377 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/utils/Mapper.kt @@ -54,14 +54,14 @@ internal fun UserWalletPublicInformation.toUserWallet(): UserWallet { walletId = walletId, hotWalletId = hotWalletId, wallets = null, - backedUp = backedUp!!, + backedUp = requireNotNull(backedUp), ) } else { UserWallet.Cold( name = name, walletId = walletId, cardsInWallet = cardsInWallet, - scanResponse = scanResponse!!, + scanResponse = requireNotNull(scanResponse), isMultiCurrency = isMultiCurrency, hasBackupError = hasBackupError, ) @@ -78,7 +78,7 @@ internal fun UserWallet.updateWith(sensitiveInformation: UserWalletSensitiveInfo copy( scanResponse = scanResponse.copy( card = scanResponse.card.copy( - wallets = sensitiveInformation.wallets!!, + wallets = requireNotNull(sensitiveInformation.wallets), ), visaCardActivationStatus = sensitiveInformation.visaCardActivationStatus, ), diff --git a/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt b/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt index d074006981..931d258b38 100644 --- a/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt +++ b/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt @@ -87,9 +87,9 @@ internal class VisaCardScanHandler @Inject constructor( cardId = card.cardId, // This is the wallet public key, not the address and it's alright, as the API expects it in this format cardWalletAddress = wallet.publicKey.toHexString(), - ).getOrElse { + ).getOrElse { error -> Timber.i("Failed to get Access token for Wallet public key authorization") - return CompletionResult.Failure(it.tangemError) + return CompletionResult.Failure(error.tangemError) } val signChallengeResult = signChallengeWithWallet( @@ -123,16 +123,16 @@ internal class VisaCardScanHandler @Inject constructor( signedChallenge: VisaAuthSignedChallenge, ): CompletionResult { val authorizationTokensResponse = visaAuthRemoteDataSource.getAccessTokens(signedChallenge = signedChallenge) - .getOrElse { + .getOrElse { error -> Timber.i("Failed to get Access token for Wallet public key authorization.") return if ( - it is VisaApiError.ProductInstanceIsNotActivated || - it is VisaApiError.ProductInstanceNotFoundActivationRequired + error is VisaApiError.ProductInstanceIsNotActivated || + error is VisaApiError.ProductInstanceNotFoundActivationRequired ) { Timber.i("Proceeding with card authorization.") handleCardAuthorization(cardWalletAddress = cardWalletAddress) } else { - CompletionResult.Failure(it.tangemError) + CompletionResult.Failure(error.tangemError) } } @@ -152,9 +152,9 @@ internal class VisaCardScanHandler @Inject constructor( val challengeResponse = visaAuthRemoteDataSource.getCardAuthChallenge( cardId = card.cardId, cardPublicKey = card.cardPublicKey.toHexString(), - ).getOrElse { - Timber.e("Failed to get challenge for Card authorization. Plain error: ${it.errorCode}") - return CompletionResult.Failure(it.tangemError) + ).getOrElse { error -> + Timber.e("Failed to get challenge for Card authorization. Plain error: ${error.errorCode}") + return CompletionResult.Failure(error.tangemError) } Timber.i("Received challenge to sign: ${challengeResponse.challenge}") @@ -179,9 +179,9 @@ internal class VisaCardScanHandler @Inject constructor( signedChallenge = attestCardKeyResponse.cardSignature.toHexString(), salt = attestCardKeyResponse.salt.toHexString(), ), - ).getOrElse { - Timber.e("Failed to sign challenge with Card public key. Plain error: ${it.errorCode}") - return CompletionResult.Failure(it.tangemError) + ).getOrElse { error -> + Timber.e("Failed to sign challenge with Card public key. Plain error: ${error.errorCode}") + return CompletionResult.Failure(error.tangemError) } visaAuthTokenStorage.store( @@ -189,9 +189,9 @@ internal class VisaCardScanHandler @Inject constructor( tokens = authorizationTokensResponse, ) - val activationRemoteState = visaActivationRepository.getActivationRemoteState().getOrElse { - Timber.e("Failed to sign challenge with Card public key. Plain error: ${it.errorCode}") - return CompletionResult.Failure(it.tangemError) + val activationRemoteState = visaActivationRepository.getActivationRemoteState().getOrElse { error -> + Timber.e("Failed to sign challenge with Card public key. Plain error: ${error.errorCode}") + return CompletionResult.Failure(error.tangemError) } val error = when (activationRemoteState) { diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt index d398da42c9..0c647de6c4 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt @@ -6,6 +6,7 @@ import com.tangem.domain.models.scan.ScanResponse import kotlinx.coroutines.CoroutineScope import org.rekotlin.Action +@Suppress("BooleanPropertyNaming") sealed class DetailsAction : Action { data class PrepareScreen( @@ -32,7 +33,7 @@ sealed class DetailsAction : Action { data object EnrollBiometrics : AppSettings() data class BiometricsStatusChanged( - val needEnrollBiometrics: Boolean, + val isEnrollBiometricsNeeded: Boolean, ) : AppSettings() data class ChangeAppThemeMode( @@ -40,7 +41,7 @@ sealed class DetailsAction : Action { ) : AppSettings() data class ChangeBalanceHiding( - val hideBalance: Boolean, + val shouldHideBalance: Boolean, ) : AppSettings() data class ChangeAppCurrency( diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt index 2ebe0494ab..d42bb74f37 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt @@ -86,7 +86,7 @@ class DetailsMiddleware { changeAppThemeMode(action.appThemeMode) } is DetailsAction.AppSettings.ChangeBalanceHiding -> { - changeBalanceHiding(action.hideBalance) + changeBalanceHiding(action.shouldHideBalance) } is DetailsAction.AppSettings.ChangeAppCurrency -> { store.dispatch(GlobalAction.ChangeAppCurrency(action.currency)) @@ -153,9 +153,9 @@ class DetailsMiddleware { private suspend fun setBiometricLockForAllWallets() { val userWalletsListRepository = store.inject(DaggerGraphState::userWalletsListRepository) val userWallets = userWalletsListRepository.userWalletsSync() - userWallets.forEach { + userWallets.forEach { wallet -> userWalletsListRepository.setLock( - userWalletId = it.walletId, + userWalletId = wallet.walletId, lockMethod = LockMethod.Biometric, changeUnsecured = false, ) @@ -174,11 +174,11 @@ class DetailsMiddleware { deleteSavedAccessCodes() val userWalletsListRepository = store.inject(DaggerGraphState::userWalletsListRepository) val tangemHotSdk = store.inject(DaggerGraphState::tangemHotSdk) - userWalletsListRepository.userWalletsSync().forEach { - if (it is UserWallet.Hot) { + userWalletsListRepository.userWalletsSync().forEach { wallet -> + if (wallet is UserWallet.Hot) { userWalletsListRepository.saveWithoutLock( - userWallet = it.copy( - hotWalletId = tangemHotSdk.removeBiometryAuthIfPresented(it.hotWalletId), + userWallet = wallet.copy( + hotWalletId = tangemHotSdk.removeBiometryAuthIfPresented(wallet.hotWalletId), ), ) } @@ -188,10 +188,10 @@ class DetailsMiddleware { private fun observeBiometricsStatusChanges(scope: CoroutineScope) { val needEnrollBiometricsFlow = flow { do { - val needEnrollBiometrics = runCatching(tangemSdkManager::needEnrollBiometrics).getOrNull() + val isEnrollBiometricsNeeded = runCatching(tangemSdkManager::needEnrollBiometrics).getOrNull() - if (needEnrollBiometrics != null) { - emit(needEnrollBiometrics) + if (isEnrollBiometricsNeeded != null) { + emit(isEnrollBiometricsNeeded) } delay(timeMillis = 200) diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt index e783c18e37..5b219a6c22 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt @@ -84,7 +84,7 @@ private fun handlePrivacyAction(action: DetailsAction.AppSettings, state: Detail ) is DetailsAction.AppSettings.BiometricsStatusChanged -> state.copy( appSettingsState = state.appSettingsState.copy( - needEnrollBiometrics = action.needEnrollBiometrics, + needEnrollBiometrics = action.isEnrollBiometricsNeeded, ), ) is DetailsAction.AppSettings.ChangeAppThemeMode -> state.copy( @@ -99,7 +99,7 @@ private fun handlePrivacyAction(action: DetailsAction.AppSettings, state: Detail ) is DetailsAction.AppSettings.ChangeBalanceHiding -> state.copy( appSettingsState = state.appSettingsState.copy( - isHidingEnabled = action.hideBalance, + isHidingEnabled = action.shouldHideBalance, ), ) // state should be copied to avoid concurrent modifications from different sources diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt index 980cacb286..f7e7eaa6dc 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt @@ -11,6 +11,7 @@ data class DetailsState( val appSettingsState: AppSettingsState = AppSettingsState(), ) : StateType +@Suppress("BooleanPropertyNaming") data class AppSettingsState( @Deprecated("Delete after hot wallet release") val saveWallets: Boolean = false, diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/appcurrency/AppCurrencySelectorScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/appcurrency/AppCurrencySelectorScreen.kt index c4cfcfd7ff..db3ba98922 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/appcurrency/AppCurrencySelectorScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/appcurrency/AppCurrencySelectorScreen.kt @@ -341,16 +341,16 @@ private class AppCurrencySelectorStateProvider : CollectionPreviewParameterProvi .mapIndexed { index, s -> Currency(index.toString(), s) } .toPersistentList() - AppCurrencySelectorState.Loading(onBackClick = {}).let(::add) - AppCurrencySelectorState.Default( + add(AppCurrencySelectorState.Loading(onBackClick = {})) + add(AppCurrencySelectorState.Default( selectedId = "0", items = items, scrollToSelected = consumedEvent(), onCurrencyClick = {}, onBackClick = {}, onTopBarActionClick = {}, - ).let(::add) - AppCurrencySelectorState.Search( + )) + add(AppCurrencySelectorState.Search( selectedId = "0", items = items, scrollToSelected = consumedEvent(), @@ -358,7 +358,7 @@ private class AppCurrencySelectorStateProvider : CollectionPreviewParameterProvi onBackClick = {}, onSearchInputChange = {}, onTopBarActionClick = {}, - ).let(::add) + )) }, ) // endregion Preview \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt index f3d0b721c9..0a8191b506 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/AppSettingsScreen.kt @@ -27,16 +27,16 @@ import kotlinx.collections.immutable.persistentListOf @Composable internal fun AppSettingsScreen(state: AppSettingsScreenState, onBackClick: () -> Unit, modifier: Modifier = Modifier) { SettingsScreensScaffold( + onBackClick = onBackClick, modifier = modifier, + titleRes = R.string.app_settings_title, + addBottomInsets = false, content = { when (state) { is AppSettingsScreenState.Content -> AppSettings(state = state) is AppSettingsScreenState.Loading -> Unit } }, - titleRes = R.string.app_settings_title, - onBackClick = onBackClick, - addBottomInsets = false, ) } @@ -103,10 +103,10 @@ private class AppSettingsScreenStateProvider : CollectionPreviewParameterProvide itemsFactory.createSelectThemeModeButton(AppThemeMode.DEFAULT, {}), ) - AppSettingsScreenState.Content( + add(AppSettingsScreenState.Content( items = items, dialog = null, - ).let(::add) + )) }, ) // endregion Preview \ No newline at end of file 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 29290619e6..327cb900a1 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 @@ -47,8 +47,8 @@ private class AlertDialogProvider : CollectionPreviewParameterProvider( collection = buildList { val itemsFactory = AppSettingsItemsFactory() - itemsFactory.createEnrollBiometricsCard( + add(itemsFactory.createEnrollBiometricsCard( onClick = { /* no-op */ }, - ).let(::add) + )) }, ) // endregion Preview \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsSwitchItem.kt b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsSwitchItem.kt index 9ad210cbef..f907600ddd 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsSwitchItem.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/appsettings/components/SettingsSwitchItem.kt @@ -85,26 +85,26 @@ private class SwitchItemProvider : CollectionPreviewParameterProvider { - val items = buildList { + val items = buildList { if (state.needEnrollBiometrics) { - itemsFactory.createEnrollBiometricsCard( - onClick = ::enrollBiometrics, - ).let(::add) + add( + itemsFactory.createEnrollBiometricsCard( + onClick = ::enrollBiometrics, + ), + ) } - itemsFactory.createSelectAppCurrencyButton( - currentAppCurrencyName = state.selectedAppCurrency.name, - onClick = ::showAppCurrencySelector, - ).let(::add) + add( + itemsFactory.createSelectAppCurrencyButton( + currentAppCurrencyName = state.selectedAppCurrency.name, + onClick = ::showAppCurrencySelector, + ), + ) if (hotWalletFeatureToggles.isHotWalletEnabled) { val canUseBiometrics = !state.needEnrollBiometrics && !state.isInProgress - itemsFactory.createUseBiometricsSwitch( - isChecked = state.useBiometricAuthentication, - isEnabled = canUseBiometrics, - onCheckedChange = ::onBiometricAuthenticationToggled, - ).let(::add) + add( + itemsFactory.createUseBiometricsSwitch( + isChecked = state.useBiometricAuthentication, + isEnabled = canUseBiometrics, + onCheckedChange = ::onBiometricAuthenticationToggled, + ), + ) - itemsFactory.createRequireAccessCodeSwitch( - isChecked = state.requireAccessCode, - isEnabled = canUseBiometrics && state.useBiometricAuthentication, - onCheckedChange = ::onRequireAccessCodeToggled, - ).let(::add) + add( + itemsFactory.createRequireAccessCodeSwitch( + isChecked = state.requireAccessCode, + isEnabled = canUseBiometrics && state.useBiometricAuthentication, + onCheckedChange = ::onRequireAccessCodeToggled, + ), + ) } else { if (state.isBiometricsAvailable) { val canUseBiometrics = !state.needEnrollBiometrics && !state.isInProgress - itemsFactory.createSaveWalletsSwitch( - isChecked = state.saveWallets, - isEnabled = canUseBiometrics, - onCheckedChange = ::onSaveWalletsToggled, - ).let(::add) + add( + itemsFactory.createSaveWalletsSwitch( + isChecked = state.saveWallets, + isEnabled = canUseBiometrics, + onCheckedChange = ::onSaveWalletsToggled, + ), + ) - itemsFactory.createSaveAccessCodeSwitch( - isChecked = state.saveAccessCodes, - isEnabled = canUseBiometrics, - onCheckedChange = ::onSaveAccessCodesToggled, - ).let(::add) + add( + itemsFactory.createSaveAccessCodeSwitch( + isChecked = state.saveAccessCodes, + isEnabled = canUseBiometrics, + onCheckedChange = ::onSaveAccessCodesToggled, + ), + ) } } - itemsFactory.createFlipToHideBalanceSwitch( - isChecked = state.isHidingEnabled, - isEnabled = true, - onCheckedChange = ::onFlipToHideBalanceToggled, - ).let(::add) + add( + itemsFactory.createFlipToHideBalanceSwitch( + isChecked = state.isHidingEnabled, + isEnabled = true, + onCheckedChange = ::onFlipToHideBalanceToggled, + ), + ) - itemsFactory.createSelectThemeModeButton( - currentThemeMode = state.selectedThemeMode, - onClick = { showThemeModeSelector(state.selectedThemeMode) }, - ).let(::add) + add( + itemsFactory.createSelectThemeModeButton( + currentThemeMode = state.selectedThemeMode, + onClick = { showThemeModeSelector(state.selectedThemeMode) }, + ), + ) } return items.toImmutableList() @@ -280,7 +296,7 @@ internal class AppSettingsModel @Inject constructor( val param = AnalyticsParam.OnOffState(enable) analyticsEventHandler.send(Settings.AppSettings.HideBalanceChanged(param)) - store.dispatch(DetailsAction.AppSettings.ChangeBalanceHiding(hideBalance = enable)) + store.dispatch(DetailsAction.AppSettings.ChangeBalanceHiding(shouldHideBalance = enable)) } private fun dismissDialog() { @@ -290,10 +306,10 @@ internal class AppSettingsModel @Inject constructor( private fun bootstrapAppCurrencyUpdates() { appCurrencyRepository .getSelectedAppCurrency() - .onEach { - if (it.code == store.state.globalState.appCurrency.code) return@onEach + .onEach { appCurrency -> + if (appCurrency.code == store.state.globalState.appCurrency.code) return@onEach - store.dispatchWithMain(DetailsAction.AppSettings.ChangeAppCurrency(it)) + store.dispatchWithMain(DetailsAction.AppSettings.ChangeAppCurrency(appCurrency)) } .launchIn(scope) .saveIn(appCurrencyUpdatesJobHolder) diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt index eb76dc0b7a..a81c2bdbd1 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt @@ -26,19 +26,19 @@ import com.tangem.wallet.R @Composable internal fun CardSettingsScreen(state: CardSettingsScreenState, modifier: Modifier = Modifier) { - val needReadCard = state.cardDetails == null + val isCardReadingNeeded = state.cardDetails == null SettingsScreensScaffold( + onBackClick = state.onBackClick, modifier = modifier, + titleRes = R.string.card_settings_title, content = { - if (needReadCard) { + if (isCardReadingNeeded) { CardSettingsReadCard(state.onScanCardClick) } else { CardSettings(state = state) } }, - titleRes = R.string.card_settings_title, - onBackClick = state.onBackClick, ) } @@ -123,8 +123,8 @@ private fun CardSettings(state: CardSettingsScreenState) { .fillMaxWidth() .testTag(DeviceSettingsScreenTestTags.LAZY_LIST), ) { - items(state.cardDetails) { - val paddingBottom = when (it) { + items(state.cardDetails) { cardInfo -> + val paddingBottom = when (cardInfo) { is CardInfo.CardId, is CardInfo.Issuer -> TangemTheme.dimens.spacing12 is CardInfo.SignedHashes -> TangemTheme.dimens.spacing14 is CardInfo.SecurityMode -> TangemTheme.dimens.spacing16 @@ -132,7 +132,7 @@ private fun CardSettings(state: CardSettingsScreenState) { is CardInfo.AccessCodeRecovery -> TangemTheme.dimens.spacing16 is CardInfo.ResetToFactorySettings -> TangemTheme.dimens.spacing28 } - val paddingTop = when (it) { + val paddingTop = when (cardInfo) { is CardInfo.CardId -> TangemTheme.dimens.spacing0 is CardInfo.Issuer -> TangemTheme.dimens.spacing12 is CardInfo.SignedHashes -> TangemTheme.dimens.spacing12 @@ -145,8 +145,8 @@ private fun CardSettings(state: CardSettingsScreenState) { modifier = Modifier .fillMaxWidth() .clickable( - enabled = it.clickable, - onClick = { state.onElementClick(it) }, + enabled = cardInfo.isClickable, + onClick = { state.onElementClick(cardInfo) }, ) .padding( start = TangemTheme.dimens.spacing20, @@ -155,25 +155,25 @@ private fun CardSettings(state: CardSettingsScreenState) { top = paddingTop, ), ) { - val titleColor = if (it.clickable) { + val titleColor = if (cardInfo.isClickable) { TangemTheme.colors.text.primary1 } else { TangemTheme.colors.text.tertiary } - val subtitleColor = if (it.clickable) { + val subtitleColor = if (cardInfo.isClickable) { TangemTheme.colors.text.secondary } else { TangemTheme.colors.text.tertiary } Text( - text = it.titleRes.resolveReference(), + text = cardInfo.titleRes.resolveReference(), color = titleColor, style = TangemTheme.typography.subtitle1, modifier = Modifier.testTag(DeviceSettingsScreenTestTags.ITEM_TITLE), ) Spacer(modifier = Modifier.size(TangemTheme.dimens.size4)) Text( - text = it.subtitle.resolveReference(), + text = cardInfo.subtitle.resolveReference(), color = subtitleColor, style = TangemTheme.typography.body2, modifier = Modifier.testTag(DeviceSettingsScreenTestTags.ITEM_SUBTITLE), diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreenState.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreenState.kt index cbf005de4c..5f4415c577 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreenState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreenState.kt @@ -18,7 +18,7 @@ internal data class CardSettingsScreenState( internal sealed class CardInfo( val titleRes: TextReference, val subtitle: TextReference, - val clickable: Boolean = false, + val isClickable: Boolean = false, ) { class CardId(subtitle: String) : CardInfo( titleRes = TextReference.Res(R.string.details_row_title_cid), @@ -38,29 +38,29 @@ internal sealed class CardInfo( class SecurityMode(securityOption: SecurityOption, clickable: Boolean) : CardInfo( titleRes = TextReference.Res(R.string.card_settings_security_mode), subtitle = TextReference.Res(securityOption.toTitleRes()), - clickable = clickable, + isClickable = clickable, ) data object ChangeAccessCode : CardInfo( titleRes = TextReference.Res(R.string.card_settings_change_access_code), subtitle = TextReference.Res(R.string.card_settings_change_access_code_footer), - clickable = true, + isClickable = true, ) - class AccessCodeRecovery(val enabled: Boolean) : CardInfo( + class AccessCodeRecovery(val isEnabled: Boolean) : CardInfo( titleRes = TextReference.Res(R.string.card_settings_access_code_recovery_title), - subtitle = if (enabled) { + subtitle = if (isEnabled) { TextReference.Res(R.string.common_enabled) } else { TextReference.Res(R.string.common_disabled) }, - clickable = true, + isClickable = true, ) class ResetToFactorySettings(description: TextReference) : CardInfo( titleRes = TextReference.Res(R.string.card_settings_reset_card_to_factory), subtitle = description, - clickable = true, + isClickable = true, ) } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreen.kt index 8315639120..c40418cc3d 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreen.kt @@ -16,8 +16,8 @@ import com.tangem.wallet.R @Composable fun AccessCodeRecoveryScreen(state: AccessCodeRecoveryScreenState, onBackClick: () -> Unit) { SettingsScreensScaffold( - content = { AccessCodeRecoveryOptions(state = state) }, onBackClick = onBackClick, + content = { AccessCodeRecoveryOptions(state = state) }, ) } @@ -38,13 +38,13 @@ fun AccessCodeRecoveryOptions(state: AccessCodeRecoveryScreenState) { DetailsRadioButtonElement( title = stringResourceSafe(id = R.string.common_enabled), subtitle = stringResourceSafe(id = R.string.card_settings_access_code_recovery_enabled_description), - selected = state.enabledSelection, + isSelected = state.isEnabledSelection, onClick = { state.onOptionClick(true) }, ) DetailsRadioButtonElement( title = stringResourceSafe(id = R.string.common_disabled), subtitle = stringResourceSafe(id = R.string.card_settings_access_code_recovery_disabled_description), - selected = !state.enabledSelection, + isSelected = !state.isEnabledSelection, onClick = { state.onOptionClick(false) }, ) diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreenState.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreenState.kt index b4b6c68535..2d2301ab70 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreenState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/AccessCodeRecoveryScreenState.kt @@ -1,15 +1,15 @@ package com.tangem.tap.features.details.ui.cardsettings.coderecovery /** - * @property enabledOnCard Indicates whether access code recovery is enabled on the card - * @property enabledSelection Represents the currently selected option in the app (not yet saved on the card) + * @property isEnabledOnCard Indicates whether access code recovery is enabled on the card + * @property isEnabledSelection Represents the currently selected option in the app (not yet saved on the card) * @property isSaveChangesEnabled Determines if the user is allowed to save their selection to the card * @property onSaveChangesClick Callback function called when the user wants to apply the selected option * @property onOptionClick Callback function called when the user selects an option * */ data class AccessCodeRecoveryScreenState( - val enabledOnCard: Boolean, - val enabledSelection: Boolean, + val isEnabledOnCard: Boolean, + val isEnabledSelection: Boolean, val isSaveChangesEnabled: Boolean, val onSaveChangesClick: () -> Unit, val onOptionClick: (Boolean) -> Unit, diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt index 298d2ac7d7..ac083db4c6 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt @@ -43,8 +43,8 @@ internal class AccessCodeRecoveryModel @Inject constructor( ) return AccessCodeRecoveryScreenState( - enabledOnCard = isEnabled, - enabledSelection = isEnabled, + isEnabledOnCard = isEnabled, + isEnabledSelection = isEnabled, isSaveChangesEnabled = false, onSaveChangesClick = ::saveChanges, onOptionClick = ::selectOption, @@ -52,7 +52,7 @@ internal class AccessCodeRecoveryModel @Inject constructor( } private fun saveChanges() = modelScope.launch { - val isEnabled = screenState.value.enabledSelection + val isEnabled = screenState.value.isEnabledSelection tangemSdkManager .setAccessCodeRecoveryEnabled(scannedScanResponse.card.cardId, isEnabled) @@ -78,10 +78,10 @@ internal class AccessCodeRecoveryModel @Inject constructor( } private fun selectOption(isEnabled: Boolean) { - screenState.update { - it.copy( - enabledSelection = isEnabled, - isSaveChangesEnabled = isEnabled != it.enabledOnCard, + screenState.update { state -> + state.copy( + isEnabledSelection = isEnabled, + isSaveChangesEnabled = isEnabled != state.isEnabledOnCard, ) } } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/domain/CardSettingsInteractor.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/domain/CardSettingsInteractor.kt index 73bbf10991..09eb4199ef 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/domain/CardSettingsInteractor.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/domain/CardSettingsInteractor.kt @@ -23,9 +23,9 @@ internal class CardSettingsInteractor @Inject constructor() { } fun update(transform: (ScanResponse) -> ScanResponse) { - _scannedScanResponse.update { - requireNotNull(it) - transform(it) + _scannedScanResponse.update { scanResponse -> + requireNotNull(scanResponse) + transform(scanResponse) } } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt index 1d5b58407d..74ed156439 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt @@ -57,7 +57,7 @@ internal class CardSettingsModel @Inject constructor( private val params = paramsContainer.require() - private var previousBiometricsRequestPolicy: Boolean = false + private var isBiometricsRequestPolicyPrevious: Boolean = false private val userWalletId = params.userWalletId @@ -77,13 +77,13 @@ internal class CardSettingsModel @Inject constructor( // Reset card scanned data cardSettingsInteractor.clear() // Restore the previous value of access code request policy - cardSdkConfigRepository.isBiometricsRequestPolicy = previousBiometricsRequestPolicy + cardSdkConfigRepository.isBiometricsRequestPolicy = isBiometricsRequestPolicyPrevious } private fun updateAccessCodeRequestPolicy() { runBlocking { // !!!IMPORTANT!!!: Do not forget to restore the previous value in onCleared() method - previousBiometricsRequestPolicy = cardSdkConfigRepository.isBiometricsRequestPolicy + isBiometricsRequestPolicyPrevious = cardSdkConfigRepository.isBiometricsRequestPolicy val userWallet = getUserWalletUseCase(userWalletId) .getOrElse { error("User wallet $userWalletId not found") } @@ -135,34 +135,38 @@ internal class CardSettingsModel @Inject constructor( ) val isResetCardAllowed = isResetToFactoryAllowedByCard(card, cardTypesResolver) - val cardDetails = buildList { - CardInfo.CardId(cardId).let(::add) - CardInfo.Issuer(card.issuer.name).let(::add) + val cardDetails = buildList { + add(CardInfo.CardId(cardId)) + add(CardInfo.Issuer(card.issuer.name)) if (!cardTypesResolver.isTangemTwins()) { - CardInfo.SignedHashes(card.signedHashesCount().toString()).let(::add) + add(CardInfo.SignedHashes(card.signedHashesCount().toString())) } - CardInfo.SecurityMode( - currentSecurityOption, - clickable = allowedSecurityOptions.size > 1, - ).let(::add) + add( + CardInfo.SecurityMode( + currentSecurityOption, + clickable = allowedSecurityOptions.size > 1, + ), + ) if (card.backupStatus?.isActive == true && card.isAccessCodeSet) { - CardInfo.ChangeAccessCode.let(::add) + add(CardInfo.ChangeAccessCode) } if (isAccessCodeRecoveryAllowed(cardTypesResolver)) { - CardInfo.AccessCodeRecovery(isAccessCodeRecoveryEnabled(cardTypesResolver, card)).let(::add) + add(CardInfo.AccessCodeRecovery(isAccessCodeRecoveryEnabled(cardTypesResolver, card))) } if (isResetCardAllowed) { - CardInfo.ResetToFactorySettings( - description = getResetToFactoryDescription( - isActiveBackupStatus = card.backupStatus?.isActive == true, - typesResolver = cardTypesResolver, + add( + CardInfo.ResetToFactorySettings( + description = getResetToFactoryDescription( + isActiveBackupStatus = card.backupStatus?.isActive == true, + typesResolver = cardTypesResolver, + ), ), - ).let(::add) + ) } } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt b/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt index 98c792c2ef..19afbf0689 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt @@ -19,11 +19,11 @@ import com.tangem.wallet.R @Composable internal fun SettingsScreensScaffold( onBackClick: () -> Unit, - content: @Composable () -> Unit, modifier: Modifier = Modifier, @StringRes titleRes: Int? = null, - snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, addBottomInsets: Boolean = true, + snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, + content: @Composable () -> Unit, fab: @Composable () -> Unit = {}, ) { val backgroundColor = TangemTheme.colors.background.secondary @@ -129,18 +129,18 @@ internal fun DetailsMainButton( } @Composable -internal fun DetailsRadioButtonElement(title: String, subtitle: String, selected: Boolean, onClick: () -> Unit) { +internal fun DetailsRadioButtonElement(title: String, subtitle: String, isSelected: Boolean, onClick: () -> Unit) { Row( modifier = Modifier .fillMaxWidth() .selectable( - selected = selected, + selected = isSelected, onClick = { onClick() }, ) .padding(start = 20.dp, end = 20.dp, top = 16.dp, bottom = 16.dp), ) { RadioButton( - selected = selected, + selected = isSelected, onClick = null, modifier = Modifier.padding(end = 20.dp), colors = RadioButtonDefaults.colors( diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt index 73af54606b..6d6a21df15 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt @@ -7,7 +7,7 @@ internal fun isAccessCodeRecoveryAllowed(typeResolver: CardTypesResolver): Boole internal fun isAccessCodeRecoveryEnabled(typeResolver: CardTypesResolver, card: CardDTO): Boolean = if (typeResolver.isWallet2()) { - card.userSettings?.isUserCodeRecoveryAllowed ?: false + card.userSettings?.isUserCodeRecoveryAllowed == true } else { false } \ No newline at end of file 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 e81602a4d2..b6557e7f4c 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 @@ -27,11 +27,11 @@ import com.tangem.tap.features.details.ui.resetcard.ResetCardScreenState.Dialog @Composable internal fun ResetCardScreen(state: ResetCardScreenState, onBackClick: () -> Unit, modifier: Modifier = Modifier) { SettingsScreensScaffold( + onBackClick = onBackClick, modifier = modifier, content = { ResetCardView(state = state) }, - onBackClick = onBackClick, ) when (val dialog = state.dialog) { @@ -65,7 +65,7 @@ private fun ResetCardView(state: ResetCardScreenState) { Conditions(state) DynamicSpacer(scrollState = scrollState) SpacerH16() - ResetButton(enabled = state.resetButtonEnabled, onResetButtonClick = state.onResetButtonClick) + ResetButton(enabled = state.isResetButtonEnabled, onResetButtonClick = state.onResetButtonClick) SpacerH16() } } @@ -113,18 +113,18 @@ private fun Description(text: TextReference) { @Composable private fun Conditions(state: ResetCardScreenState) { - state.warningsToShow.forEach { - when (it) { + state.warningsToShow.forEach { warning -> + when (warning) { ResetCardScreenState.WarningsToReset.LOST_WALLET_ACCESS -> { ConditionCheckBox( - checkedState = state.acceptCondition1Checked, + checkedState = state.isAcceptCondition1Checked, onCheckedChange = state.onAcceptCondition1ToggleClick, description = TextReference.Res(R.string.reset_card_to_factory_condition_1), ) } ResetCardScreenState.WarningsToReset.LOST_PASSWORD_RESTORE -> { ConditionCheckBox( - checkedState = state.acceptCondition2Checked, + checkedState = state.isAcceptCondition2Checked, onCheckedChange = state.onAcceptCondition2ToggleClick, description = TextReference.Res(R.string.reset_card_to_factory_condition_2), ) @@ -238,12 +238,12 @@ private fun ResetCardScreenSample(modifier: Modifier = Modifier) { ) { ResetCardScreen( state = ResetCardScreenState( - resetButtonEnabled = true, - showResetPasswordButton = false, + isResetButtonEnabled = true, + isResetPasswordButtonShown = false, warningsToShow = listOf(ResetCardScreenState.WarningsToReset.LOST_WALLET_ACCESS), descriptionText = TextReference.Res(R.string.reset_card_with_backup_to_factory_message), - acceptCondition1Checked = false, - acceptCondition2Checked = false, + isAcceptCondition1Checked = false, + isAcceptCondition2Checked = false, onAcceptCondition1ToggleClick = {}, onAcceptCondition2ToggleClick = {}, onResetButtonClick = {}, diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreenState.kt b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreenState.kt index 27dacf387f..32eb289aec 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreenState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/ResetCardScreenState.kt @@ -5,12 +5,12 @@ import com.tangem.tap.features.details.ui.cardsettings.TextReference import com.tangem.wallet.R internal data class ResetCardScreenState( - val resetButtonEnabled: Boolean, + val isResetButtonEnabled: Boolean, val descriptionText: TextReference, val warningsToShow: List, - val showResetPasswordButton: Boolean, - val acceptCondition1Checked: Boolean, - val acceptCondition2Checked: Boolean, + val isResetPasswordButtonShown: Boolean, + val isAcceptCondition1Checked: Boolean, + val isAcceptCondition2Checked: Boolean, val onAcceptCondition1ToggleClick: (Boolean) -> Unit, val onAcceptCondition2ToggleClick: (Boolean) -> Unit, val onResetButtonClick: () -> Unit, diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt index 6cab06fac6..eaa4ce0a9f 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt @@ -97,15 +97,15 @@ internal class ResetCardModel @Inject constructor( } return ResetCardScreenState( - resetButtonEnabled = false, + isResetButtonEnabled = false, descriptionText = getResetToFactoryDescription( isActiveBackupStatus = isActiveBackupPrimaryCard, typesResolver = currentCardTypesResolver, ), warningsToShow = warningsToShow, - showResetPasswordButton = shouldShowResetPasswordButton, - acceptCondition1Checked = false, - acceptCondition2Checked = false, + isResetPasswordButtonShown = shouldShowResetPasswordButton, + isAcceptCondition1Checked = false, + isAcceptCondition2Checked = false, onAcceptCondition1ToggleClick = ::toggleFirstCondition, onAcceptCondition2ToggleClick = ::toggleSecondCondition, onResetButtonClick = { showDialog(ResetCardDialog.StartResetDialog) }, @@ -121,26 +121,26 @@ internal class ResetCardModel @Inject constructor( private fun toggleFirstCondition(isAccepted: Boolean) { screenState.update { prevState -> - val resetButtonEnabled = if (prevState.showResetPasswordButton) { - isAccepted && prevState.acceptCondition2Checked + val isResetButtonEnabled = if (prevState.isResetPasswordButtonShown) { + isAccepted && prevState.isAcceptCondition2Checked } else { isAccepted } prevState.copy( - acceptCondition1Checked = isAccepted, - resetButtonEnabled = resetButtonEnabled, + isAcceptCondition1Checked = isAccepted, + isResetButtonEnabled = isResetButtonEnabled, ) } } private fun toggleSecondCondition(isAccepted: Boolean) { screenState.update { prevState -> - val resetButtonEnabled = prevState.acceptCondition1Checked && isAccepted + val isResetButtonEnabled = prevState.isAcceptCondition1Checked && isAccepted prevState.copy( - acceptCondition2Checked = isAccepted, - resetButtonEnabled = resetButtonEnabled, + isAcceptCondition2Checked = isAccepted, + isResetButtonEnabled = isResetButtonEnabled, ) } } @@ -183,14 +183,14 @@ internal class ResetCardModel @Inject constructor( modelScope.launch { resetCardUseCase(cardId = primaryCardId, params = currentUserCodeParams).onRight { deleteSavedAccessCodesUseCase(cardId = primaryCardId) - val hasUserWallets = deleteWalletUseCase(userWalletId = currentUserWalletId).getOrElse { - Timber.e("Unable to delete user wallet: $it") + val hasUserWallets = deleteWalletUseCase(userWalletId = currentUserWalletId).getOrElse { error -> + Timber.e("Unable to delete user wallet: $error") return@launch } if (hasUserWallets) { - val newSelectedWallet = getSelectedWalletSyncUseCase().getOrElse { - error("Failed to get selected wallet: $it") + val newSelectedWallet = getSelectedWalletSyncUseCase().getOrElse { error -> + error("Failed to get selected wallet: $error") } store.onUserWalletSelected(newSelectedWallet) @@ -269,7 +269,7 @@ internal class ResetCardModel @Inject constructor( if (hotWalletFeatureToggles.isHotWalletEnabled) { store.dispatchNavigationAction { replaceAll(AppRoute.Home()) } } else { - val isLocked = runCatching { userWalletsListManager.asLockable()?.isLockedSync }.isSuccess + val isLocked = runCatching { userWalletsListManager.asLockable()?.isLocked }.isSuccess if (isLocked && userWalletsListManager.hasUserWallets) { store.dispatchNavigationAction { popTo() } } else { diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/SecurityModeScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/SecurityModeScreen.kt index 3a86a4f67c..981cd1c76a 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/SecurityModeScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/SecurityModeScreen.kt @@ -22,10 +22,10 @@ internal fun SecurityModeScreen( modifier: Modifier = Modifier, ) { SettingsScreensScaffold( + onBackClick = onBackClick, modifier = modifier, content = { SecurityModeOptions(state = state) }, // titleRes = R.string.card_settings_security_mode, - onBackClick = onBackClick, ) } @@ -57,7 +57,7 @@ private fun SecurityModeOptions(state: SecurityModeScreenState) { @Composable private fun SecurityOption(option: SecurityOption, state: SecurityModeScreenState) { - val selected = option == state.selectedSecurityMode + val isSelected = option == state.selectedSecurityMode val title = option.toTitleRes() @@ -70,7 +70,7 @@ private fun SecurityOption(option: SecurityOption, state: SecurityModeScreenStat DetailsRadioButtonElement( title = stringResourceSafe(id = title), subtitle = stringResourceSafe(id = subtitle), - selected = selected, + isSelected = isSelected, onClick = { state.onNewModeSelected(option) }, ) } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt index ee9cf3dd51..36fdf29787 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt @@ -77,9 +77,9 @@ internal class SecurityModeModel @Inject constructor( SecurityOption.AccessCode -> tangemSdkManager.setAccessCode(cardId) } - cardSettingsInteractor.update { - it.copy( - card = it.card.copy( + cardSettingsInteractor.update { scanResponse -> + scanResponse.copy( + card = scanResponse.card.copy( isAccessCodeSet = selectedOption == SecurityOption.AccessCode, isPasscodeSet = selectedOption == SecurityOption.PassCode, ), 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 1734b45276..1753406d30 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 @@ -150,7 +150,7 @@ internal class MainViewModel @Inject constructor( prepareSelectedWalletFeedback() // await while initial route stack is initialized - appRouterConfig.isInitialized.first { it } + appRouterConfig.initializedState.first { it } isSplashScreenShown = false } @@ -179,11 +179,9 @@ internal class MainViewModel @Inject constructor( private fun prepareSelectedWalletFeedback() { getSelectedWalletUseCase.invoke() .mapLeft { emptyFlow() } - .onRight { - it.distinctUntilChanged() - .onEach { userWallet -> - Analytics.setContext(userWallet) - } + .onRight { wallet -> + wallet.distinctUntilChanged() + .onEach { Analytics.setContext(it) } .flowOn(dispatchers.io) .launchIn(viewModelScope) } @@ -208,7 +206,7 @@ internal class MainViewModel @Inject constructor( return MoonPayService( apiKey = environmentConfig.moonPayApiKey, secretKey = environmentConfig.moonPayApiSecretKey, - logEnabled = LogConfig.network.moonPayService, + isLogEnabled = LogConfig.network.moonPayService, userWalletProvider = { getSelectedWalletUseCase.sync().getOrNull() }, ) } @@ -224,8 +222,8 @@ internal class MainViewModel @Inject constructor( .filter { it.isBalanceHidingNotificationEnabled && it.isBalanceHidden } - .onEach { - if (!it.isUpdateFromToast) { + .onEach { settings -> + if (!settings.isUpdateFromToast) { listenToFlipsUseCase.changeUpdateEnabled(false) val message = BottomSheetMessage.invoke( @@ -354,6 +352,7 @@ internal class MainViewModel @Inject constructor( listenToFlipsUseCase.changeUpdateEnabled(isUpdateEnabled = true) } + @Suppress("NullableToStringCall") private fun sendKeyboardIdentifierEvent() { viewModelScope.launch { val keyboardId = keyboardValidator.getKeyboardId() diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt b/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt index 231ce5256e..ec4e9e12ab 100644 --- a/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt +++ b/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt @@ -34,11 +34,11 @@ object OnboardingHelper { } response.cardTypesResolver.isWallet2() || response.cardTypesResolver.isShibaWallet() -> { - val emptyWallets = response.card.wallets.isEmpty() - val activationInProgress = cardRepository.isActivationInProgress(cardId) + val areWalletsEmpty = response.card.wallets.isEmpty() + val isActivationInProgress = cardRepository.isActivationInProgress(cardId) val isNoBackup = response.card.backupStatus == CardDTO.BackupStatus.NoBackup && !DemoHelper.isDemoCard(response) - emptyWallets || activationInProgress || isNoBackup + areWalletsEmpty || isActivationInProgress || isNoBackup } response.card.wallets.isNotEmpty() -> cardRepository.isActivationInProgress(cardId) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/TradeCryptoMiddleware.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/TradeCryptoMiddleware.kt index 2aa7a3ef24..6cbc795c53 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/TradeCryptoMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/TradeCryptoMiddleware.kt @@ -50,8 +50,8 @@ object TradeCryptoMiddleware { fiatCurrencyName = action.appCurrencyCode, walletAddress = networkAddress, isDarkTheme = MutableAppThemeModeHolder.isDarkThemeActive, - )?.let { - store.dispatchOpenUrl(it) + )?.let { url -> + store.dispatchOpenUrl(url) Analytics.send(Token.Withdraw.ScreenOpened()) } } diff --git a/app/src/main/java/com/tangem/tap/features/welcome/model/WelcomeModel.kt b/app/src/main/java/com/tangem/tap/features/welcome/model/WelcomeModel.kt index ae5afc8d33..f6e882e5fb 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/model/WelcomeModel.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/model/WelcomeModel.kt @@ -72,8 +72,8 @@ internal class WelcomeModel @Inject constructor( this.state.update { prevState -> prevState.copy( - showUnlockWithBiometricsProgress = state.isUnlockWithBiometricsInProgress, - showUnlockWithCardProgress = state.isUnlockWithCardInProgress, + isUnlockWithBiometricsProgressVisible = state.isUnlockWithBiometricsInProgress, + isUnlockWithCardProgressVisible = state.isUnlockWithCardInProgress, warning = warning, error = state.error ?.takeIf { !it.silent && warning == null } diff --git a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeAction.kt b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeAction.kt index 78fb0451e0..6d0e6b6183 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeAction.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeAction.kt @@ -13,7 +13,7 @@ internal sealed interface WelcomeAction : Action { object ProceedWithCard : WelcomeAction { object Success : WelcomeAction data class Error(val error: TangemError) : WelcomeAction - data class ChangeProgress(val showProgress: Boolean) : WelcomeAction + data class ChangeProgress(val isProgress: Boolean) : WelcomeAction } object CloseError : WelcomeAction diff --git a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt index af60602c2b..be2955e491 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt @@ -141,13 +141,13 @@ internal class WelcomeMiddleware { onSuccess = { scanResponse -> scope.launch { onCardScanned(scanResponse) } }, - onFailure = { - when (it) { + onFailure = { error -> + when (error) { is TangemSdkError.ExceptionError -> { store.dispatchOnMain(WelcomeAction.ProceedWithCard.Success) } else -> { - store.dispatchOnMain(WelcomeAction.ProceedWithCard.Error(it)) + store.dispatchOnMain(WelcomeAction.ProceedWithCard.Error(error)) } } }, diff --git a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeReducer.kt b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeReducer.kt index 0d9645dea6..f324887d0a 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeReducer.kt @@ -25,7 +25,7 @@ internal object WelcomeReducer { isUnlockWithCardInProgress = false, ) is WelcomeAction.ProceedWithCard.ChangeProgress -> state.copy( - isUnlockWithCardInProgress = action.showProgress, + isUnlockWithCardInProgress = action.isProgress, ) is WelcomeAction.ProceedWithBiometrics.Success -> state.copy(isUnlockWithBiometricsInProgress = false) is WelcomeAction.ProceedWithCard.Success -> state.copy(isUnlockWithCardInProgress = false) diff --git a/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeScreenState.kt b/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeScreenState.kt index 3ede2ae446..7c7e43f2b5 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeScreenState.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeScreenState.kt @@ -5,8 +5,8 @@ import com.tangem.tap.features.welcome.ui.model.WarningModel internal data class WelcomeScreenState( val onPopBack: () -> Unit = {}, - val showUnlockWithBiometricsProgress: Boolean = false, - val showUnlockWithCardProgress: Boolean = false, + val isUnlockWithBiometricsProgressVisible: Boolean = false, + val isUnlockWithCardProgressVisible: Boolean = false, val warning: WarningModel? = null, val error: TextReference? = null, val onUnlockClick: () -> Unit = {}, diff --git a/app/src/main/java/com/tangem/tap/features/welcome/ui/components/WelcomeScreen.kt b/app/src/main/java/com/tangem/tap/features/welcome/ui/components/WelcomeScreen.kt index ee1a00bb48..de791e45da 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/ui/components/WelcomeScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/ui/components/WelcomeScreen.kt @@ -39,8 +39,8 @@ internal fun WelcomeScreen(state: WelcomeScreenState, modifier: Modifier = Modif .systemBarsPadding(), ) { WelcomeScreenContent( - showUnlockProgress = state.showUnlockWithBiometricsProgress, - showScanCardProgress = state.showUnlockWithCardProgress, + showUnlockProgress = state.isUnlockWithBiometricsProgressVisible, + showScanCardProgress = state.isUnlockWithCardProgressVisible, onUnlockClick = state.onUnlockClick, onScanCardClick = state.onScanCardClick, ) @@ -57,8 +57,8 @@ internal fun WelcomeScreen(state: WelcomeScreenState, modifier: Modifier = Modif WarningDialog(warning) LaunchedEffect(errorMessage, state.onCloseError) { - errorMessage?.let { - snackbarHostState.showSnackbar(it) + errorMessage?.let { message -> + snackbarHostState.showSnackbar(message) state.onCloseError() } } @@ -82,8 +82,8 @@ private class WelcomeComponentPreviewProvider : PreviewParameterProvider { - return if (useNewListRepository) { + return if (shouldUseNewListRepository) { userWalletsListRepository.userWalletsSync() } else { userWalletsListManager.userWalletsSync @@ -47,7 +47,7 @@ internal class DefaultAuthProvider( } private suspend fun getSelectedWallet(): UserWallet? { - return if (useNewListRepository) { + return if (shouldUseNewListRepository) { userWalletsListRepository.selectedUserWalletSync() } else { userWalletsListManager.selectedUserWalletSync diff --git a/app/src/main/java/com/tangem/tap/network/auth/DefaultExpressAuthProvider.kt b/app/src/main/java/com/tangem/tap/network/auth/DefaultExpressAuthProvider.kt index 15e74c5498..47188c465b 100644 --- a/app/src/main/java/com/tangem/tap/network/auth/DefaultExpressAuthProvider.kt +++ b/app/src/main/java/com/tangem/tap/network/auth/DefaultExpressAuthProvider.kt @@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicReference internal class DefaultExpressAuthProvider : ExpressAuthProvider { - private var uuid = AtomicReference(UUID.randomUUID()) + private val uuid = AtomicReference(UUID.randomUUID()) override fun getSessionId(): String { return uuid.get().toString() diff --git a/app/src/main/java/com/tangem/tap/network/auth/di/AuthModule.kt b/app/src/main/java/com/tangem/tap/network/auth/di/AuthModule.kt index 95004c11d8..d29722ec81 100644 --- a/app/src/main/java/com/tangem/tap/network/auth/di/AuthModule.kt +++ b/app/src/main/java/com/tangem/tap/network/auth/di/AuthModule.kt @@ -32,7 +32,7 @@ internal class AuthModule { return DefaultAuthProvider( userWalletsListManager = userWalletsListManager, userWalletsListRepository = userWalletsListRepository, - useNewListRepository = hotWalletFeatureToggles.isHotWalletEnabled, + shouldUseNewListRepository = hotWalletFeatureToggles.isHotWalletEnabled, ) } diff --git a/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt b/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt index 6c4c20e0cc..5cf37e3a1c 100644 --- a/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt +++ b/app/src/main/java/com/tangem/tap/network/exchangeServices/DefaultRampManager.kt @@ -54,7 +54,7 @@ internal class DefaultRampManager( sendUnavailabilityReason: ScenarioUnavailabilityReason?, ): Either { return either { - val sellSupportedByService = catch( + val isSellSupportedByService = catch( block = { val serviceCurrency = cryptoCurrencyConverter.convertBack(status.currency) @@ -78,7 +78,7 @@ internal class DefaultRampManager( } } - ensure(condition = sellSupportedByService) { + ensure(condition = isSellSupportedByService) { ScenarioUnavailabilityReason.NotSupportedBySellService(status.currency.name) } diff --git a/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayApi.kt b/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayApi.kt index c8235a8f74..554a0b4265 100644 --- a/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayApi.kt +++ b/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayApi.kt @@ -34,6 +34,7 @@ data class MoonPayUserStatus( val stateCode: String, ) +@Suppress("BooleanPropertyNaming") @JsonClass(generateAdapter = true) data class MoonPayCurrencies( @Json(name = "type") val type: String, diff --git a/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt b/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt index 02bc4321ae..1f291b109b 100644 --- a/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt +++ b/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt @@ -26,7 +26,7 @@ import javax.crypto.spec.SecretKeySpec class MoonPayService( private val apiKey: String, private val secretKey: String, - private val logEnabled: Boolean, + private val isLogEnabled: Boolean, private val userWalletProvider: () -> UserWallet?, ) : ExchangeService { @@ -39,7 +39,7 @@ class MoonPayService( private val api: MoonPayApi by lazy { createRetrofitInstance( baseUrl = MoonPayApi.MOOONPAY_BASE_URL, - logEnabled = logEnabled, + logEnabled = isLogEnabled, ).create(MoonPayApi::class.java) } @@ -104,24 +104,35 @@ class MoonPayService( override fun availableForSell(currency: Currency): Boolean { val userWallet = userWalletProvider() ?: return false - val checkCardExchange = userWallet !is UserWallet.Cold || !userWallet.scanResponse.card.isStart2Coin + val isExchangeSupported = userWallet !is UserWallet.Cold || !userWallet.scanResponse.card.isStart2Coin - if (!checkCardExchange) return false + if (!isExchangeSupported) return false if (!isSellAllowed()) return false val availableForSell = status?.availableForSell ?: return false val supportedCurrency = currency.blockchain.moonPaySupportedCurrency ?: return false - return availableForSell.any { + return availableForSell.any { availableCurrency -> when (currency) { is Currency.Blockchain -> { - it.networkCode.equals(other = supportedCurrency.networkCode, ignoreCase = true) && - it.currencyCode.equals(other = supportedCurrency.currencyCode, ignoreCase = true) + availableCurrency.networkCode.equals( + other = supportedCurrency.networkCode, + ignoreCase = true, + ) && availableCurrency.currencyCode.equals( + other = supportedCurrency.currencyCode, + ignoreCase = true, + ) } is Currency.Token -> { - it.networkCode.equals(other = supportedCurrency.networkCode, ignoreCase = true) && - it.contractAddress.equals(other = currency.token.contractAddress, ignoreCase = true) + availableCurrency.networkCode.equals( + other = supportedCurrency.networkCode, + ignoreCase = true, + ) && + availableCurrency.contractAddress.equals( + other = currency.token.contractAddress, + ignoreCase = true, + ) } } } @@ -137,15 +148,18 @@ class MoonPayService( if (blockchain.isTestnet()) return blockchain.getTestnetTopUpUrl() val supportedCurrency = blockchain.moonPaySupportedCurrency ?: return null - val moonpayCurrency = status?.availableForSell?.firstOrNull { + val moonpayCurrency = status?.availableForSell?.firstOrNull { availableCurrency -> when (cryptoCurrency) { is CryptoCurrency.Coin -> { - it.networkCode.equals(other = supportedCurrency.networkCode, ignoreCase = true) && - it.currencyCode.equals(other = supportedCurrency.currencyCode, ignoreCase = true) + availableCurrency.networkCode.equals(other = supportedCurrency.networkCode, ignoreCase = true) && + availableCurrency.currencyCode.equals(other = supportedCurrency.currencyCode, ignoreCase = true) } is CryptoCurrency.Token -> { - it.networkCode.equals(other = supportedCurrency.networkCode, ignoreCase = true) && - it.contractAddress.equals(other = cryptoCurrency.contractAddress, ignoreCase = true) + availableCurrency.networkCode.equals(other = supportedCurrency.networkCode, ignoreCase = true) && + availableCurrency.contractAddress.equals( + other = cryptoCurrency.contractAddress, + ignoreCase = true, + ) } } } ?: return null @@ -184,7 +198,7 @@ class MoonPayService( } private fun isSellAllowed(): Boolean { - return status?.responseUserStatus?.isSellAllowed ?: false + return status?.responseUserStatus?.isSellAllowed == true } private companion object { diff --git a/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt b/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt index d11526b9f4..f8350e77a9 100644 --- a/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt +++ b/app/src/main/java/com/tangem/tap/proxy/UserWalletManagerImpl.kt @@ -48,13 +48,13 @@ class UserWalletManagerImpl( override suspend fun getNativeTokenBalance(networkId: String, derivationPath: String?): ProxyAmount? { val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" } val walletManager = getActualWalletManager(blockchain, derivationPath) - return walletManager.wallet.amounts.firstNotNullOfOrNull { - it.takeIf { it.key is AmountType.Coin } - }?.value?.let { + return walletManager.wallet.amounts.firstNotNullOfOrNull { amountEntry -> + amountEntry.takeIf { amountEntry.key is AmountType.Coin } + }?.value?.let { amount -> ProxyAmount( - it.currencySymbol, - it.value ?: BigDecimal.ZERO, - it.decimals, + amount.currencySymbol, + amount.value ?: BigDecimal.ZERO, + amount.decimals, ) } } diff --git a/app/src/main/java/com/tangem/tap/routing/RootContent.kt b/app/src/main/java/com/tangem/tap/routing/RootContent.kt index 5c009849bc..2d158062cb 100644 --- a/app/src/main/java/com/tangem/tap/routing/RootContent.kt +++ b/app/src/main/java/com/tangem/tap/routing/RootContent.kt @@ -34,17 +34,17 @@ import com.tangem.core.ui.res.TangemTheme import com.tangem.tap.routing.component.RoutingComponent import com.tangem.tap.routing.transitions.RoutingTransitionAnimationFactory -@Suppress("LongParameterList") +@Suppress("LongParameterList", "ReusedModifierInstance") @OptIn(ExperimentalDecomposeApi::class) @Composable internal fun RootContent( stack: Value>, backHandler: BackHandler, uiDependencies: UiDependencies, - wcContent: @Composable (modifier: Modifier) -> Unit, - hotAccessCodeContent: @Composable (modifier: Modifier) -> Unit, onBack: () -> Unit, modifier: Modifier = Modifier, + wcContent: @Composable (modifier: Modifier) -> Unit, + hotAccessCodeContent: @Composable (modifier: Modifier) -> Unit, ) { val context = LocalContext.current diff --git a/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt b/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt index 8030c44f97..8be5a8edea 100644 --- a/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt +++ b/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt @@ -133,7 +133,7 @@ internal class DefaultRoutingComponent @AssistedInject constructor( AppRoute.Wallet } }.also { - appRouterConfig.isInitialized.value = true + appRouterConfig.initializedState.value = true checkForUnfinishedBackup() } } @@ -141,13 +141,13 @@ internal class DefaultRoutingComponent @AssistedInject constructor( @Composable override fun Content(modifier: Modifier) { RootContent( - modifier = modifier, stack = stack, + backHandler = backHandler, uiDependencies = uiDependencies, + onBack = router::pop, + modifier = modifier, wcContent = { wcRoutingComponent.Content(it) }, hotAccessCodeContent = { hotAccessCodeRequestComponent.Content(it) }, - backHandler = backHandler, - onBack = router::pop, ) } diff --git a/app/src/main/java/com/tangem/tap/routing/configurator/AppRouterConfig.kt b/app/src/main/java/com/tangem/tap/routing/configurator/AppRouterConfig.kt index 393ab3a7df..a5ee03adad 100644 --- a/app/src/main/java/com/tangem/tap/routing/configurator/AppRouterConfig.kt +++ b/app/src/main/java/com/tangem/tap/routing/configurator/AppRouterConfig.kt @@ -11,7 +11,7 @@ internal interface AppRouterConfig { var routerScope: CoroutineScope? var componentRouter: Router? var stack: List? - val isInitialized: MutableStateFlow + val initializedState: MutableStateFlow // TODO: Replace with UI message handler: [REDACTED_JIRA] var snackbarHandler: SnackbarHandler? diff --git a/app/src/main/java/com/tangem/tap/routing/configurator/MutableAppRouterConfig.kt b/app/src/main/java/com/tangem/tap/routing/configurator/MutableAppRouterConfig.kt index 776802e429..7831308228 100644 --- a/app/src/main/java/com/tangem/tap/routing/configurator/MutableAppRouterConfig.kt +++ b/app/src/main/java/com/tangem/tap/routing/configurator/MutableAppRouterConfig.kt @@ -11,5 +11,5 @@ internal class MutableAppRouterConfig : AppRouterConfig { override var componentRouter: Router? = null override var stack: List? = null override var snackbarHandler: SnackbarHandler? = null - override val isInitialized: MutableStateFlow = MutableStateFlow(false) + override val initializedState: MutableStateFlow = MutableStateFlow(false) } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/routing/transitions/RoutingTransitionAnimationFactory.kt b/app/src/main/java/com/tangem/tap/routing/transitions/RoutingTransitionAnimationFactory.kt index b1332ff1c8..a28e2ff15e 100644 --- a/app/src/main/java/com/tangem/tap/routing/transitions/RoutingTransitionAnimationFactory.kt +++ b/app/src/main/java/com/tangem/tap/routing/transitions/RoutingTransitionAnimationFactory.kt @@ -4,13 +4,10 @@ import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.FiniteAnimationSpec import androidx.compose.animation.core.tween import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.scale import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.layout import com.arkivanov.decompose.extensions.compose.stack.animation.* import com.tangem.common.routing.AppRoute -import kotlin.compareTo -import kotlin.times object RoutingTransitionAnimationFactory { @@ -58,7 +55,7 @@ object RoutingTransitionAnimationFactory { @Suppress("MagicNumber") private fun slideAndFade(directions: Set? = null): StackAnimator { - val easing = CubicBezierEasing(0.55f, 0.0f, 0.0f, 1f) + val easing = CubicBezierEasing(a = 0.55f, b = 0.0f, c = 0.0f, d = 1f) return stackAnimator( animationSpec = tween(durationMillis = 400, easing = easing), 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 4f4eca31b6..04197aacb2 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 @@ -183,10 +183,10 @@ internal class ChildFactory @Inject constructor( token = route.token, appCurrency = route.appCurrency, showPortfolio = route.showPortfolio, - analyticsParams = route.analyticsParams?.let { + analyticsParams = route.analyticsParams?.let { params -> MarketsTokenDetailsComponent.AnalyticsParams( - blockchain = it.blockchain, - source = it.source, + blockchain = params.blockchain, + source = params.source, ) }, ), 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 992380b05e..e0eafb470d 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 @@ -311,7 +311,6 @@ private fun MarketChartPreview( } val coroutineScope = rememberCoroutineScope() - val look by dataProducer.lookState.collectAsState() TangemThemePreview { val growingColor = TangemTheme.colors.icon.accent diff --git a/common/ui/src/main/java/com/tangem/common/ui/expressStatus/state/ExpressStatusUM.kt b/common/ui/src/main/java/com/tangem/common/ui/expressStatus/state/ExpressStatusUM.kt index 6fcb02cc30..b49384c027 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/expressStatus/state/ExpressStatusUM.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/expressStatus/state/ExpressStatusUM.kt @@ -50,5 +50,4 @@ enum class ExpressStatusItemState { Done, Warning, Error, - ; } \ No newline at end of file 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 f0de0bfdda..08703b2212 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 @@ -26,10 +26,10 @@ internal class DevApiConfigsManager( ) : MutableApiConfigsManager() { override val configs: StateFlow> - field = MutableStateFlow(value = getInitialConfigs()) + field = MutableStateFlow(value = getInitialConfigs()) override val isInitialized: StateFlow - field = MutableStateFlow(value = false) + field = MutableStateFlow(value = false) override fun initialize() { isInitialized.value = false 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 5df19d76e6..c423afc4c3 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 @@ -22,7 +22,7 @@ internal class MockApiConfigsManager( ) : MutableApiConfigsManager() { override val configs: StateFlow> - field = MutableStateFlow(value = getInitialConfigs()) + field = MutableStateFlow(value = getInitialConfigs()) override val isInitialized: StateFlow = MutableStateFlow(value = true) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MutableApiConfigsManager.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MutableApiConfigsManager.kt index cdd9a6b0a2..d0998c8395 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MutableApiConfigsManager.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/managers/MutableApiConfigsManager.kt @@ -20,7 +20,7 @@ abstract class MutableApiConfigsManager : ApiConfigsManager { * These listeners are notified whenever an environment change occurs. */ protected val registerListeners: Set - field = mutableSetOf() + field = mutableSetOf() /** Change api environment [environment] by [id] */ abstract suspend fun changeEnvironment(id: String, environment: ApiEnvironment) 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 b58c058063..b3cef83f29 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 @@ -198,6 +198,7 @@ data class YieldDTO( enum class RewardTypeDTO { @Json(name = "apy") APY, // compound rate + @Json(name = "apr") APR, // simple rate, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SeedPhraseNotificationDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SeedPhraseNotificationDTO.kt index 3184e87ead..3ef25cc80f 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SeedPhraseNotificationDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SeedPhraseNotificationDTO.kt @@ -24,7 +24,5 @@ data class SeedPhraseNotificationDTO(val status: Status) { @Json(name = "accepted") ACCEPTED, - - ; } } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/Cards.kt b/core/ui/src/main/java/com/tangem/core/ui/components/Cards.kt index 27c758f8b7..c5807f7912 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/Cards.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/Cards.kt @@ -68,9 +68,9 @@ fun CardWithIcon( internal fun IconWithTitleAndDescription( title: String, description: String?, + iconBackground: Color = TangemTheme.colors.background.secondary, icon: @Composable () -> Unit, additionalContent: @Composable () -> Unit = {}, - iconBackground: Color = TangemTheme.colors.background.secondary, ) { Row( modifier = Modifier 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 03d9ba11c0..fcf6361bca 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 @@ -75,7 +75,7 @@ fun Modifier.bottomFade( ) enum class FadePosition { - TOP, BOTTOM, LEFT, RIGHT; + TOP, BOTTOM, LEFT, RIGHT } @Stable diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlock.kt b/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlock.kt index e5c28bf0a6..e42d2ad4fc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlock.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlock.kt @@ -169,12 +169,12 @@ private fun Preview_Tree() { }, content = { ArrowRowItems( - itemPadding = PaddingValues(vertical = TangemTheme.dimens.spacing4), items = persistentListOf( stringReference("Fist item"), stringReference("Second item"), stringReference("Third item"), ), + itemPadding = PaddingValues(vertical = TangemTheme.dimens.spacing4), rootContent = { PreviewItem(stringReference("Root")) }, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlockContent.kt b/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlockContent.kt index 423100d2e9..a39c6b7783 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlockContent.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/block/information/InformationBlockContent.kt @@ -16,11 +16,11 @@ import kotlinx.collections.immutable.toImmutableList @Composable inline fun InformationBlockContentScope.ListItems( items: ImmutableList, - itemContent: @Composable BoxScope.(T) -> Unit, modifier: Modifier = Modifier, itemPadding: PaddingValues = PaddingValues(all = TangemTheme.dimens.spacing0), horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally, verticalArragement: Arrangement.Vertical = Arrangement.Top, + itemContent: @Composable BoxScope.(T) -> Unit, ) { Column( modifier = modifier.fillMaxWidth(), @@ -42,10 +42,10 @@ inline fun InformationBlockContentScope.ListItems( @Composable inline fun InformationBlockContentScope.GridItems( items: ImmutableList, - itemContent: @Composable BoxScope.(T) -> Unit, modifier: Modifier = Modifier, verticalAlignment: Alignment.Vertical = Alignment.Top, horizontalArragement: Arrangement.Horizontal = Arrangement.Start, + itemContent: @Composable BoxScope.(T) -> Unit, ) { val rowItems by remember(items) { derivedStateOf { @@ -81,10 +81,10 @@ inline fun InformationBlockContentScope.GridItems( @Composable inline fun InformationBlockContentScope.ArrowRowItems( items: ImmutableList, - rootContent: @Composable BoxScope.() -> Unit, - itemContent: @Composable BoxScope.(T) -> Unit, modifier: Modifier = Modifier, itemPadding: PaddingValues = PaddingValues(all = TangemTheme.dimens.spacing0), + rootContent: @Composable BoxScope.() -> Unit, + itemContent: @Composable BoxScope.(T) -> Unit, ) { Column( modifier = modifier.fillMaxWidth(), 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 196a5f2012..b239dfc92b 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 @@ -48,10 +48,10 @@ const val MODAL_SHEET_MAX_HEIGHT = 0.8f inline fun TangemModalBottomSheet( config: TangemBottomSheetConfig, containerColor: Color = TangemTheme.colors.background.primary, + noinline onBack: (() -> Unit)? = null, skipPartiallyExpanded: Boolean = true, dismissOnClickOutside: Boolean = true, scrollableContent: Boolean = true, - noinline onBack: (() -> Unit)? = null, crossinline title: @Composable BoxScope.(T) -> Unit = {}, crossinline content: @Composable ColumnScope.(T) -> Unit, ) { @@ -202,9 +202,9 @@ inline fun BsContent( inline fun BasicModalBottomSheet( config: TangemBottomSheetConfig, sheetState: SheetState, + modifier: Modifier = Modifier, noinline onBack: (() -> Unit)? = null, noinline bsContent: @Composable ColumnScope.() -> Unit, - modifier: Modifier = Modifier, ) { if (onBack != null) { ModalBottomSheetWithBackHandling( diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt index 3826cc503f..6506a16d14 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt @@ -143,11 +143,11 @@ inline fun BasicModalBottomSheetWit config: TangemBottomSheetConfig, sheetState: SheetState, containerColor: Color, + modifier: Modifier = Modifier, noinline onBack: (() -> Unit)? = null, crossinline title: @Composable BoxScope.(T) -> Unit, crossinline content: @Composable (T) -> Unit, noinline footer: @Composable (BoxScope.(T) -> Unit)?, - modifier: Modifier = Modifier, ) { val model = config.content as? T ?: return 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 1ecce16ab7..26ad428e58 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 @@ -152,10 +152,10 @@ inline fun BasicBottomSheet( sheetState: SheetState, containerColor: Color, addBottomInsets: Boolean, + modifier: Modifier = Modifier, noinline onBack: (() -> Unit)? = null, crossinline title: @Composable (BoxScope.(T) -> Unit), crossinline content: @Composable (ColumnScope.(T) -> Unit), - modifier: Modifier = Modifier, ) { val model = config.content as? T ?: return 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 a7fa9386f9..090b82dc91 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 @@ -111,10 +111,10 @@ fun ActionButton( fun ActionBaseButton( config: ActionButtonConfig, shape: RoundedCornerShape, - content: @Composable (modifier: Modifier) -> Unit, modifier: Modifier = Modifier, color: Color = TangemTheme.colors.button.secondary, containerColor: Color = TangemTheme.colors.background.secondary, + content: @Composable (modifier: Modifier) -> Unit, ) { val context = LocalContext.current val backgroundColor by animateColorAsState( @@ -163,9 +163,9 @@ fun ActionBaseButton( @Composable fun ActionButtonContent( config: ActionButtonConfig, - text: @Composable (Color) -> Unit, modifier: Modifier = Modifier, paddingBetweenIconAndText: Dp = 8.dp, + text: @Composable (Color) -> Unit, ) { Row( modifier = modifier diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/DefaultCurrencyIcon.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/DefaultCurrencyIcon.kt index bc9b5f2707..630bd4cc12 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/DefaultCurrencyIcon.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/DefaultCurrencyIcon.kt @@ -24,8 +24,8 @@ internal inline fun DefaultCurrencyIcon( size: Dp, alpha: Float, colorFilter: ColorFilter?, - crossinline errorIcon: @Composable () -> Unit, modifier: Modifier = Modifier, + crossinline errorIcon: @Composable () -> Unit, ) { var iconBackgroundColor by remember { mutableStateOf(Color.Transparent) } var isBackgroundColorDefined by remember { mutableStateOf(false) } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/ContentIcon.kt b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/ContentIcon.kt index 02e42068d6..e8fa3055bf 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/ContentIcon.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/currency/icon/ContentIcon.kt @@ -113,8 +113,8 @@ private fun TokenIcon( url: String?, alpha: Float, colorFilter: ColorFilter?, - errorIcon: @Composable () -> Unit, modifier: Modifier = Modifier, + errorIcon: @Composable () -> Unit, ) { if (url == null) { errorIcon() 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 94f6b64e78..f7ec1628af 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 @@ -103,11 +103,11 @@ fun SearchBar( @OptIn(ExperimentalMaterial3Api::class) private fun DecorationBox( state: SearchBarUM, - innerTextField: @Composable () -> Unit, interactionSource: MutableInteractionSource, colors: TextFieldColors, focusManager: FocusManager, keyboardController: SoftwareKeyboardController?, + innerTextField: @Composable () -> Unit, ) { TextFieldDefaults.DecorationBox( value = state.query, 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 1616968df4..e5c732ea8c 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 @@ -121,12 +121,12 @@ fun SimpleTextField( @Composable private fun SimpleTextPlaceholder( - placeholder: TextReference?, value: String, textStyle: TextStyle, centered: Boolean, - textValue: @Composable () -> Unit, + placeholder: TextReference?, color: Color = TangemTheme.colors.text.disabled, + textValue: @Composable () -> Unit, ) { Box(contentAlignment = if (centered) Alignment.Center else Alignment.TopStart) { if (value.isBlank() && placeholder != null) { diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/icons/identicon/Blockies.kt b/core/ui/src/main/java/com/tangem/core/ui/components/icons/identicon/Blockies.kt index f1ba4a748e..83d46d09e3 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/icons/identicon/Blockies.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/icons/identicon/Blockies.kt @@ -58,8 +58,8 @@ internal data class Blockies( } private fun dataFromSeed(seed: MutableList) = MutableList(SIZE * SIZE) { DEFAULT_VALUE_F }.apply { - (0 until SIZE).forEach { row -> - (0 until HALF_SIZE).forEach { column -> + for (row in 0 until SIZE) { + for (column in 0 until HALF_SIZE) { val value = floor(nextSeed(seed) * PROBABILITY_COLOR) this[row * SIZE + column] = value this[(row + 1) * SIZE - column - 1] = value diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ArrowRow.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ArrowRow.kt index 67ef1ac47d..36d9892d0d 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/rows/ArrowRow.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/ArrowRow.kt @@ -21,9 +21,9 @@ import com.tangem.core.ui.utils.* @Composable inline fun ArrowRow( isLastItem: Boolean, - content: @Composable() (BoxScope.() -> Unit), modifier: Modifier = Modifier, contentPadding: PaddingValues = PaddingValues(all = TangemTheme.dimens.spacing0), + content: @Composable() (BoxScope.() -> Unit), ) { val density = LocalDensity.current.density val defaultRowHeight = TangemTheme.dimens.size0 diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/BlockchainRow.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/BlockchainRow.kt index df2cdf37a9..d89d6710c1 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/rows/BlockchainRow.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/BlockchainRow.kt @@ -27,7 +27,7 @@ private const val DISABLED_ICON_ALPHA = 0.4f * [Figma Component](https://www.figma.com/design/14ISV23YB1yVW1uNVwqrKv/Android?node-id=2737-2800&t=ewlXfWwbDnRhjw4B-4) * */ @Composable -fun BlockchainRow(model: BlockchainRowUM, action: @Composable BoxScope.() -> Unit, modifier: Modifier = Modifier) { +fun BlockchainRow(model: BlockchainRowUM, modifier: Modifier = Modifier, action: @Composable BoxScope.() -> Unit) { RowContentContainer( modifier = modifier .heightIn(min = TangemTheme.dimens.size52) 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 a9020f35ae..ffe4aae9e2 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 @@ -53,10 +53,10 @@ fun ChainRow(model: ChainRowUM, modifier: Modifier = Modifier, action: @Composab @Composable inline fun ChainRowContainer( + modifier: Modifier = Modifier, icon: @Composable BoxScope.() -> Unit, text: @Composable BoxScope.() -> Unit, action: @Composable BoxScope.() -> Unit, - modifier: Modifier = Modifier, ) { RowContentContainer( modifier = modifier diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/NetworkTitle.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/NetworkTitle.kt index 383854fd65..590e93ddb5 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/rows/NetworkTitle.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/NetworkTitle.kt @@ -29,8 +29,8 @@ import com.tangem.core.ui.res.TangemThemePreview */ @Composable fun NetworkTitle( - title: @Composable BoxScope.() -> Unit, modifier: Modifier = Modifier, + title: @Composable BoxScope.() -> Unit, action: (@Composable BoxScope.() -> Unit)? = null, ) { val minHeight = if (action == null) TangemTheme.dimens.size36 else TangemTheme.dimens.size40 diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/rows/RowComponents.kt b/core/ui/src/main/java/com/tangem/core/ui/components/rows/RowComponents.kt index f07edb1802..2c55637c6e 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/rows/RowComponents.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/rows/RowComponents.kt @@ -13,11 +13,11 @@ import com.tangem.core.ui.res.TangemTheme @Composable inline fun RowContentContainer( + modifier: Modifier = Modifier, + horizontalArrangement: Arrangement.Horizontal = Arrangement.spacedBy(TangemTheme.dimens.spacing8), icon: @Composable BoxScope.() -> Unit, text: @Composable BoxScope.() -> Unit, action: @Composable BoxScope.() -> Unit, - modifier: Modifier = Modifier, - horizontalArrangement: Arrangement.Horizontal = Arrangement.spacedBy(TangemTheme.dimens.spacing8), ) { Row( modifier = modifier.fillMaxWidth(), diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/tooltip/TangemTooltip.kt b/core/ui/src/main/java/com/tangem/core/ui/components/tooltip/TangemTooltip.kt index 395b09aed0..7a54751d4b 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/tooltip/TangemTooltip.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/tooltip/TangemTooltip.kt @@ -24,9 +24,9 @@ import kotlinx.coroutines.launch @Composable fun TangemTooltip( text: String, - content: @Composable (Modifier) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, + content: @Composable (Modifier) -> Unit, ) { InternalTangemTooltip( modifier = modifier, @@ -46,9 +46,9 @@ fun TangemTooltip( @Composable fun TangemTooltip( text: AnnotatedString, - content: @Composable (Modifier) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, + content: @Composable (Modifier) -> Unit, ) { InternalTangemTooltip( modifier = modifier, @@ -68,10 +68,10 @@ fun TangemTooltip( @OptIn(ExperimentalMaterial3Api::class) @Composable private fun InternalTangemTooltip( - tooltipContent: @Composable () -> Unit, - content: @Composable (Modifier) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, + tooltipContent: @Composable () -> Unit, + content: @Composable (Modifier) -> Unit, ) { val tooltipState = rememberTooltipState(isPersistent = true) val coroutineScope = rememberCoroutineScope() diff --git a/core/ui/src/main/java/com/tangem/core/ui/res/TangemTheme.kt b/core/ui/src/main/java/com/tangem/core/ui/res/TangemTheme.kt index 696d1619ee..85baa41281 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/res/TangemTheme.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/res/TangemTheme.kt @@ -52,10 +52,10 @@ fun TangemTheme( @Composable fun TangemTheme( - isDark: Boolean = false, windowSize: WindowSize, typography: TangemTypography = TangemTheme.typography, dimens: TangemDimens = TangemTheme.dimens, + isDark: Boolean = false, vibratorHapticManager: VibratorHapticManager? = null, eventMessageHandler: EventMessageHandler = remember { EventMessageHandler() }, snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, 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 ebce7baf36..06d5fe6b63 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 @@ -64,9 +64,7 @@ fun DecimalFormat.getValidatedNumberWithFixedDecimals(text: String, decimals: In val beforeDecimal = filteredChars.substringBefore(decimalSeparator) val afterDecimal = filteredChars.substringAfter(decimalSeparator) decimals.getWithIntegerDecimals(beforeDecimal, decimalSeparator, afterDecimal) - } - // If there is no dot, just take all digits - else { + } else { // If there is no dot, just take all digits filteredChars } } @@ -87,9 +85,7 @@ fun DecimalFormat.formatWithThousands(text: String, decimals: Int): String { .reversed() val afterDecimal = localizedText.substringAfter(decimalSeparator) decimals.getWithIntegerDecimals(beforeDecimal, decimalSeparator, afterDecimal) - } - // If there is no dot, just take all digits - else { + } else { // If there is no dot, just take all digits localizedText.reversed() .chunked(TEXT_CHUNK_THOUSAND) .joinToString(thousandsSeparator.toString()) diff --git a/core/ui/src/main/java/com/tangem/core/ui/utils/InputNumberFormatter.kt b/core/ui/src/main/java/com/tangem/core/ui/utils/InputNumberFormatter.kt index 7873012994..7d1c7e7c2c 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/utils/InputNumberFormatter.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/utils/InputNumberFormatter.kt @@ -44,9 +44,7 @@ class InputNumberFormatter( val beforeDecimal = filteredChars.substringBefore(decimalSeparator) val afterDecimal = filteredChars.substringAfter(decimalSeparator) beforeDecimal + decimalSeparator + afterDecimal.take(decimals) - } - // If there is no dot, just take all digits - else { + } else { // If there is no dot, just take all digits filteredChars } } @@ -62,9 +60,7 @@ class InputNumberFormatter( .reversed() val afterDecimal = text.substringAfter(decimalSeparator) beforeDecimal + decimalSeparator + afterDecimal.take(decimals) - } - // If there is no dot, just take all digits - else { + } else { // If there is no dot, just take all digits text.reversed() .chunked(TEXT_CHUNK_THOUSAND) .joinToString(thousandsSeparator.toString()) diff --git a/data/common/src/main/kotlin/com/tangem/data/common/cache/etag/ETagsStore.kt b/data/common/src/main/kotlin/com/tangem/data/common/cache/etag/ETagsStore.kt index 430e9a0290..bae6820a73 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/cache/etag/ETagsStore.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/cache/etag/ETagsStore.kt @@ -29,6 +29,5 @@ interface ETagsStore { enum class Key { WalletAccounts, UserTokens, - ; } } \ No newline at end of file diff --git a/data/common/src/main/kotlin/com/tangem/data/common/quote/QuotesFetcher.kt b/data/common/src/main/kotlin/com/tangem/data/common/quote/QuotesFetcher.kt index 4f1e8b92ce..bc89150de8 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/quote/QuotesFetcher.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/quote/QuotesFetcher.kt @@ -47,7 +47,6 @@ interface QuotesFetcher { value = setOf(PRICE, PRICE_CHANGE_24H, PRICE_CHANGE_1W, PRICE_CHANGE_30D).combine(), ), LAST_UPDATED_AT(value = "lastUpdatedAt"), - ; } sealed interface Error { diff --git a/data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt b/data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt index 4c5c929262..94d6776409 100644 --- a/data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt +++ b/data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt @@ -250,7 +250,9 @@ internal class UpdateWalletManagerResultFactoryTest { ), ), currenciesAmounts = setOf( - UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO), // default for demo + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin( + value = BigDecimal.ZERO, + ), // default for demo ), currentTransactions = emptySet(), ), @@ -272,7 +274,9 @@ internal class UpdateWalletManagerResultFactoryTest { ), ), currenciesAmounts = setOf( - UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), // used demo amount + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin( + value = BigDecimal.ONE, + ), // used demo amount ), currentTransactions = emptySet(), ), diff --git a/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt b/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt index d8edb5dc18..56a5f027a2 100644 --- a/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt +++ b/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt @@ -415,6 +415,6 @@ internal class DefaultWalletsRepository( else -> ActivatePromoCodeError.ActivationFailed } return@fold error.left() - },) + }) } } \ No newline at end of file diff --git a/data/wallets/src/test/java/com/tangem/data/wallets/DefaultWalletsRepositoryTest.kt b/data/wallets/src/test/java/com/tangem/data/wallets/DefaultWalletsRepositoryTest.kt index f305beb722..d2e030bc54 100644 --- a/data/wallets/src/test/java/com/tangem/data/wallets/DefaultWalletsRepositoryTest.kt +++ b/data/wallets/src/test/java/com/tangem/data/wallets/DefaultWalletsRepositoryTest.kt @@ -114,62 +114,64 @@ class DefaultWalletsRepositoryTest { } @Test - fun `GIVEN API returns wallets WHEN getWalletsInfo THEN should return converted wallets and update cache if requested`() = runTest { - // GIVEN - val applicationId = "test_app_id" - val wallet1Id = "1234567890abcdef" - val wallet2Id = "fedcba0987654321" - val walletResponses = listOf( - WalletResponse( - id = wallet1Id, - notifyStatus = true, - ), - WalletResponse( - id = wallet2Id, - notifyStatus = false, - ), - ) - coEvery { tangemTechApi.getWallets(applicationId) } returns ApiResponse.Success(walletResponses) - coEvery { preferencesDataStore.updateData(any()) } returns mockk() + fun `GIVEN API returns wallets WHEN getWalletsInfo THEN should return converted wallets and update cache if requested`() = + runTest { + // GIVEN + val applicationId = "test_app_id" + val wallet1Id = "1234567890abcdef" + val wallet2Id = "fedcba0987654321" + val walletResponses = listOf( + WalletResponse( + id = wallet1Id, + notifyStatus = true, + ), + WalletResponse( + id = wallet2Id, + notifyStatus = false, + ), + ) + coEvery { tangemTechApi.getWallets(applicationId) } returns ApiResponse.Success(walletResponses) + coEvery { preferencesDataStore.updateData(any()) } returns mockk() - // WHEN - val result = repository.getWalletsInfo(applicationId, updateCache = true) + // WHEN + val result = repository.getWalletsInfo(applicationId, updateCache = true) - // THEN - assertThat(result).hasSize(2) - assertThat(result[0].walletId.stringValue).isEqualTo(wallet1Id) - assertThat(result[0].isNotificationsEnabled).isTrue() - assertThat(result[1].walletId.stringValue).isEqualTo(wallet2Id) - assertThat(result[1].isNotificationsEnabled).isFalse() + // THEN + assertThat(result).hasSize(2) + assertThat(result[0].walletId.stringValue).isEqualTo(wallet1Id) + assertThat(result[0].isNotificationsEnabled).isTrue() + assertThat(result[1].walletId.stringValue).isEqualTo(wallet2Id) + assertThat(result[1].isNotificationsEnabled).isFalse() - coVerify(exactly = 1) { tangemTechApi.getWallets(applicationId) } - coVerify(exactly = 2) { preferencesDataStore.updateData(any()) } - } + coVerify(exactly = 1) { tangemTechApi.getWallets(applicationId) } + coVerify(exactly = 2) { preferencesDataStore.updateData(any()) } + } @Test - fun `GIVEN API returns wallets WHEN getWalletsInfo with updateCache false THEN should return converted wallets without updating cache`() = runTest { - // GIVEN - val applicationId = "test_app_id" - val wallet1Id = "1234567890abcdef" - val walletResponses = listOf( - WalletResponse( - id = wallet1Id, - notifyStatus = true, - ), - ) - coEvery { tangemTechApi.getWallets(applicationId) } returns ApiResponse.Success(walletResponses) + fun `GIVEN API returns wallets WHEN getWalletsInfo with updateCache false THEN should return converted wallets without updating cache`() = + runTest { + // GIVEN + val applicationId = "test_app_id" + val wallet1Id = "1234567890abcdef" + val walletResponses = listOf( + WalletResponse( + id = wallet1Id, + notifyStatus = true, + ), + ) + coEvery { tangemTechApi.getWallets(applicationId) } returns ApiResponse.Success(walletResponses) - // WHEN - val result = repository.getWalletsInfo(applicationId, updateCache = false) + // WHEN + val result = repository.getWalletsInfo(applicationId, updateCache = false) - // THEN - assertThat(result).hasSize(1) - assertThat(result[0].walletId.stringValue).isEqualTo(wallet1Id) - assertThat(result[0].isNotificationsEnabled).isTrue() + // THEN + assertThat(result).hasSize(1) + assertThat(result[0].walletId.stringValue).isEqualTo(wallet1Id) + assertThat(result[0].isNotificationsEnabled).isTrue() - coVerify(exactly = 1) { tangemTechApi.getWallets(applicationId) } - coVerify(exactly = 0) { preferencesDataStore.updateData(any()) } - } + coVerify(exactly = 1) { tangemTechApi.getWallets(applicationId) } + coVerify(exactly = 0) { preferencesDataStore.updateData(any()) } + } @Test fun `GIVEN user wallets and application ID WHEN associateWallets THEN should convert and send to API`() = runTest { @@ -271,8 +273,8 @@ class DefaultWalletsRepositoryTest { // GIVEN coEvery { tangemTechApi.activatePromoCode(any()) } returns ApiResponse.Error( - HttpException(code = HttpException.Code.NOT_FOUND, message = null, errorBody = null), - ) as ApiResponse + HttpException(code = HttpException.Code.NOT_FOUND, message = null, errorBody = null), + ) as ApiResponse // WHEN val result = repository.activatePromoCode(promoCode = "PROMO", bitcoinAddress = "addr") @@ -288,8 +290,8 @@ class DefaultWalletsRepositoryTest { // GIVEN coEvery { tangemTechApi.activatePromoCode(any()) } returns ApiResponse.Error( - HttpException(code = HttpException.Code.CONFLICT, message = null, errorBody = null), - ) as ApiResponse + HttpException(code = HttpException.Code.CONFLICT, message = null, errorBody = null), + ) as ApiResponse // WHEN val result = repository.activatePromoCode(promoCode = "PROMO", bitcoinAddress = "addr") diff --git a/domain/legacy/src/main/java/com/tangem/domain/redux/StateDialog.kt b/domain/legacy/src/main/java/com/tangem/domain/redux/StateDialog.kt index 120604ae39..9d5084361d 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/redux/StateDialog.kt +++ b/domain/legacy/src/main/java/com/tangem/domain/redux/StateDialog.kt @@ -7,6 +7,6 @@ interface StateDialog { data class ScanFailsDialog(val source: ScanFailsSource, val onTryAgain: (() -> Unit)? = null) : StateDialog enum class ScanFailsSource { - MAIN, SIGN_IN, SETTINGS, INTRO; + MAIN, SIGN_IN, SETTINGS, INTRO } } \ No newline at end of file diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/TokensGroupType.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/TokensGroupType.kt index 23982e6f41..735b112edf 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/TokensGroupType.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/TokensGroupType.kt @@ -15,5 +15,4 @@ enum class TokensGroupType { /** Grouping by network */ NETWORK, - ; } \ No newline at end of file diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/TokensSortType.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/TokensSortType.kt index 0e85408187..3a68f0be35 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/TokensSortType.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/TokensSortType.kt @@ -15,5 +15,4 @@ enum class TokensSortType { /** Sorted by their balance */ BALANCE, - ; } \ No newline at end of file diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/account/CryptoPortfolioIcon.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/account/CryptoPortfolioIcon.kt index 15b906020b..681a6d940e 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/account/CryptoPortfolioIcon.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/account/CryptoPortfolioIcon.kt @@ -44,7 +44,6 @@ data class CryptoPortfolioIcon private constructor( Clock, Package, Gift, - ; } /** @@ -64,7 +63,6 @@ data class CryptoPortfolioIcon private constructor( Pattypan, UFOGreen, VitalGreen, - ; } companion object { diff --git a/domain/notifications/src/test/java/com/tangem/domain/notifications/GetApplicationIdUseCaseTest.kt b/domain/notifications/src/test/java/com/tangem/domain/notifications/GetApplicationIdUseCaseTest.kt index e3a191f205..83fae860be 100644 --- a/domain/notifications/src/test/java/com/tangem/domain/notifications/GetApplicationIdUseCaseTest.kt +++ b/domain/notifications/src/test/java/com/tangem/domain/notifications/GetApplicationIdUseCaseTest.kt @@ -114,39 +114,40 @@ class GetApplicationIdUseCaseTest { } @Test - fun `GIVEN no local application ID WHEN multiple concurrent invokes with delay THEN create only one application ID`() = runTest { - // GIVEN - val newApplicationId = ApplicationId("new-app-id") - var isIdCreated = false + fun `GIVEN no local application ID WHEN multiple concurrent invokes with delay THEN create only one application ID`() = + runTest { + // GIVEN + val newApplicationId = ApplicationId("new-app-id") + var isIdCreated = false - coEvery { pushNotificationsRepository.getApplicationId() } answers { - if (!isIdCreated) null else newApplicationId - } - coEvery { pushNotificationsRepository.createApplicationId() } answers { - isIdCreated = true - newApplicationId - } - coEvery { pushNotificationsRepository.saveApplicationId(newApplicationId) } returns Unit + coEvery { pushNotificationsRepository.getApplicationId() } answers { + if (!isIdCreated) null else newApplicationId + } + coEvery { pushNotificationsRepository.createApplicationId() } answers { + isIdCreated = true + newApplicationId + } + coEvery { pushNotificationsRepository.saveApplicationId(newApplicationId) } returns Unit - // WHEN - val results = coroutineScope { - List(PARALLEL_COUNT) { - async { - delay(100) - useCase() - } - }.awaitAll() - } + // WHEN + val results = coroutineScope { + List(PARALLEL_COUNT) { + async { + delay(100) + useCase() + } + }.awaitAll() + } - // THEN - results.forEach { result -> - assertThat(result).isInstanceOf(Either.Right::class.java) - assertThat((result as Either.Right).value).isEqualTo(newApplicationId) + // THEN + results.forEach { result -> + assertThat(result).isInstanceOf(Either.Right::class.java) + assertThat((result as Either.Right).value).isEqualTo(newApplicationId) + } + coVerify(exactly = PARALLEL_COUNT + 1) { pushNotificationsRepository.getApplicationId() } + coVerify(exactly = 1) { pushNotificationsRepository.createApplicationId() } + coVerify(exactly = 1) { pushNotificationsRepository.saveApplicationId(newApplicationId) } } - coVerify(exactly = PARALLEL_COUNT + 1) { pushNotificationsRepository.getApplicationId() } - coVerify(exactly = 1) { pushNotificationsRepository.createApplicationId() } - coVerify(exactly = 1) { pushNotificationsRepository.saveApplicationId(newApplicationId) } - } companion object { private const val PARALLEL_COUNT = 100 diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt index 68491232aa..cccba8a293 100644 --- a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt @@ -102,21 +102,21 @@ interface UserWalletsListManager { /** * Indicates that all [UserWallet]s is locked * - * @see [isLockedSync] + * @see [isLocked] * @see [UserWallet.isLocked] */ - val isLocked: Flow + val lockedState: Flow /** * Indicates that all [UserWallet]s is locked. Sync version. * - * @see [isLocked] + * @see [lockedState] * @see [UserWallet.isLocked] */ - val isLockedSync: Boolean + val isLocked: Boolean /** - * Receive saved [UserWallet]s, populate [userWallets] flow with it and set [isLocked] as false. + * Receive saved [UserWallet]s, populate [userWallets] flow with it and set [lockedState] as false. * * @param type Defines the behavior of the operation. * @@ -125,7 +125,7 @@ interface UserWalletsListManager { */ suspend fun unlock(type: UnlockType): CompletionResult - /** Remove [UserWallet]s from [userWallets] and set [isLocked] as true */ + /** Remove [UserWallet]s from [userWallets] and set [lockedState] as true */ fun lock() /** diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManagerExtensions.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManagerExtensions.kt index 8436bea168..cb47f21996 100644 --- a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManagerExtensions.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManagerExtensions.kt @@ -12,20 +12,20 @@ import kotlinx.coroutines.flow.flowOf * @return If [UserWalletsListManager] not implements [UserWalletsListManager.Lockable] returns [Flow] which * produces only one false value * - * @see UserWalletsListManager.Lockable.isLockedSync + * @see UserWalletsListManager.Lockable.isLocked * */ val UserWalletsListManager.isLocked: Flow - get() = asLockable()?.isLocked ?: flowOf(false) + get() = asLockable()?.lockedState ?: flowOf(false) /** * Indicates that the [UserWalletsListManager] is locked * * @return If [UserWalletsListManager] not implements [UserWalletsListManager.Lockable] returns false * - * @see UserWalletsListManager.Lockable.isLockedSync + * @see UserWalletsListManager.Lockable.isLocked * */ val UserWalletsListManager.isLockedSync: Boolean - get() = asLockable()?.isLockedSync == true + get() = asLockable()?.isLocked == true /** * Call [UserWalletsListManager.Lockable.unlock] if [UserWalletsListManager] implements [UserWalletsListManager.Lockable] diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 871b050803..209f923828 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -19,9 +19,11 @@ platform :android do desc "Run detekt" lane :detekt do + FileUtils.cp("../app/src/main/assets/tangem-app-config/android/google-services/dev/google-services.json", "../app") FileUtils.cp("../tangem-android-tools/CI/gradle_properties/tests_ci_gradle.properties", "../gradle.properties") puts File.read("../gradle.properties") gradle(task: "detekt") + gradle(task: "detektGoogleDebug") end desc "Run tests" 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 c7c15c062f..bf9e0762a5 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 @@ -60,7 +60,7 @@ internal class AccountCreateEditModel @Inject constructor( private val umBuilder = AccountCreateEditUMBuilder(params) val uiState: StateFlow - field = MutableStateFlow(value = getInitialState()) + field = MutableStateFlow(value = getInitialState()) init { if (params is AccountCreateEditComponent.Params.Create) { diff --git a/features/account/impl/src/main/java/com/tangem/features/account/selector/AccountSelectorModel.kt b/features/account/impl/src/main/java/com/tangem/features/account/selector/AccountSelectorModel.kt index 5012e93d14..8f3998c375 100644 --- a/features/account/impl/src/main/java/com/tangem/features/account/selector/AccountSelectorModel.kt +++ b/features/account/impl/src/main/java/com/tangem/features/account/selector/AccountSelectorModel.kt @@ -36,7 +36,7 @@ internal class AccountSelectorModel @Inject constructor( private val selectorController get() = params.controller internal val state: StateFlow - field = MutableStateFlow(emptyState()) + field = MutableStateFlow(emptyState()) init { balanceFetcher.data diff --git a/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/CreateWalletSelectionModel.kt b/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/CreateWalletSelectionModel.kt index d5c27dd004..17357cc5c3 100644 --- a/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/CreateWalletSelectionModel.kt +++ b/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/CreateWalletSelectionModel.kt @@ -61,14 +61,14 @@ internal class CreateWalletSelectionModel @Inject constructor( ) : Model() { internal val uiState: StateFlow - field = MutableStateFlow( - CreateWalletSelectionUM( - onBackClick = { router.pop() }, - onMobileWalletClick = ::onMobileWalletClick, - onHardwareWalletClick = ::onHardwareWalletClick, - onScanClick = ::onScanClick, - ), - ) + field = MutableStateFlow( + CreateWalletSelectionUM( + onBackClick = { router.pop() }, + onMobileWalletClick = ::onMobileWalletClick, + onHardwareWalletClick = ::onHardwareWalletClick, + onScanClick = ::onScanClick, + ), + ) init { showAlreadyHaveWalletWithDelay() diff --git a/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/ui/CreateWalletSelectionContent.kt b/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/ui/CreateWalletSelectionContent.kt index cc4e15fb2a..1df0b5eff7 100644 --- a/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/ui/CreateWalletSelectionContent.kt +++ b/features/create-wallet-selection/impl/src/main/kotlin/com/tangem/features/createwalletselection/ui/CreateWalletSelectionContent.kt @@ -140,11 +140,11 @@ internal fun CreateWalletSelectionContent(state: CreateWalletSelectionUM, modifi @Composable private fun WalletBlock( - modifier: Modifier = Modifier, title: String, description: String, - badge: @Composable () -> Unit, onClick: () -> Unit, + modifier: Modifier = Modifier, + badge: @Composable () -> Unit, ) { Column( modifier = modifier diff --git a/features/home/impl/src/main/kotlin/com/tangem/features/home/impl/ui/compose/StoriesAnimation.kt b/features/home/impl/src/main/kotlin/com/tangem/features/home/impl/ui/compose/StoriesAnimation.kt index 3bf071d96a..1056d363be 100644 --- a/features/home/impl/src/main/kotlin/com/tangem/features/home/impl/ui/compose/StoriesAnimation.kt +++ b/features/home/impl/src/main/kotlin/com/tangem/features/home/impl/ui/compose/StoriesAnimation.kt @@ -95,11 +95,11 @@ fun StoriesTextAnimation( @Composable fun StoriesBottomImageAnimation( + firstStepDuration: Int, + totalDuration: Int, initialScale: Float = 2.5f, secondStageScale: Float = SCALE_SWITCH_BARRIER, targetScale: Float = 1.0f, - firstStepDuration: Int, - totalDuration: Int, content: @Composable (Modifier) -> Unit, ) { val secondStepDuration = totalDuration - firstStepDuration diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt index 40ef51ebc0..6f078713cb 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt @@ -56,7 +56,7 @@ internal class AccessCodeModel @Inject constructor( private val params = paramsContainer.require() internal val uiState: StateFlow - field = MutableStateFlow(getInitialState()) + field = MutableStateFlow(getInitialState()) private fun getInitialState() = AccessCodeUM( accessCode = "", diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscoderequest/HotAccessCodeRequestModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscoderequest/HotAccessCodeRequestModel.kt index 4a75ad8438..2e24f436b9 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscoderequest/HotAccessCodeRequestModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscoderequest/HotAccessCodeRequestModel.kt @@ -43,7 +43,7 @@ internal class HotAccessCodeRequestModel @Inject constructor( ) val uiState: StateFlow - field = MutableStateFlow(getInitialState()) + field = MutableStateFlow(getInitialState()) suspend fun show(attemptRequest: HotWalletPasswordRequester.AttemptRequest) { if (userWalletExists(attemptRequest.hotWalletId).not()) { diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt index 60f3305500..add57c93fa 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt @@ -80,7 +80,7 @@ internal class AddExistingWalletImportModel @Inject constructor( } internal val uiState: StateFlow - field = MutableStateFlow(importSeedPhraseUiStateBuilder.getState()) + field = MutableStateFlow(importSeedPhraseUiStateBuilder.getState()) @Suppress("UnusedPrivateMember") private fun importWallet(mnemonic: Mnemonic, passphrase: String?) { diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/start/AddExistingWalletStartModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/start/AddExistingWalletStartModel.kt index e8d5c52060..854ebf49bd 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/start/AddExistingWalletStartModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/start/AddExistingWalletStartModel.kt @@ -63,16 +63,16 @@ internal class AddExistingWalletStartModel @Inject constructor( private val params: AddExistingWalletStartComponent.Params = paramsContainer.require() internal val uiState: StateFlow - field = MutableStateFlow( - AddExistingWalletStartUM( - showWantToPurchaseBlock = false, - isScanInProgress = false, - onBackClick = params.callbacks::onBackClick, - onImportPhraseClick = params.callbacks::onImportPhraseClick, - onScanCardClick = ::onScanClick, - onBuyCardClick = ::onShopClick, - ), - ) + field = MutableStateFlow( + AddExistingWalletStartUM( + showWantToPurchaseBlock = false, + isScanInProgress = false, + onBackClick = params.callbacks::onBackClick, + onImportPhraseClick = params.callbacks::onImportPhraseClick, + onScanCardClick = ::onScanClick, + onBuyCardClick = ::onShopClick, + ), + ) init { showWantToPurchaseBlockWithDelay() diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/createmobilewallet/CreateMobileWalletModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/createmobilewallet/CreateMobileWalletModel.kt index 0b3261b4f3..c254e87c69 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/createmobilewallet/CreateMobileWalletModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/createmobilewallet/CreateMobileWalletModel.kt @@ -28,13 +28,13 @@ internal class CreateMobileWalletModel @Inject constructor( ) : Model() { internal val uiState: StateFlow - field = MutableStateFlow( - CreateMobileWalletUM( - onBackClick = { router.pop() }, - onCreateClick = ::onCreateClick, - createButtonLoading = false, - ), - ) + field = MutableStateFlow( + CreateMobileWalletUM( + onBackClick = { router.pop() }, + onCreateClick = ::onCreateClick, + createButtonLoading = false, + ), + ) private fun onCreateClick() { modelScope.launch { diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/check/model/ManualBackupCheckModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/check/model/ManualBackupCheckModel.kt index e0778baa69..b68069c4fe 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/check/model/ManualBackupCheckModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/check/model/ManualBackupCheckModel.kt @@ -44,7 +44,7 @@ internal class ManualBackupCheckModel @Inject constructor( private val callbacks = params.callbacks internal val uiState: StateFlow - field = MutableStateFlow(getInitialUIState()) + field = MutableStateFlow(getInitialUIState()) init { modelScope.launch { diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/completed/ManualBackupCompletedModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/completed/ManualBackupCompletedModel.kt index d0fcfe7333..9abbb6caff 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/completed/ManualBackupCompletedModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/completed/ManualBackupCompletedModel.kt @@ -18,9 +18,9 @@ internal class ManualBackupCompletedModel @Inject constructor( private val params: ManualBackupCompletedComponent.Params = paramsContainer.require() internal val uiState: StateFlow - field = MutableStateFlow( - ManualBackupCompletedUM( - onContinueClick = { params.callbacks.onContinueClick(params.userWalletId) }, - ), - ) + field = MutableStateFlow( + ManualBackupCompletedUM( + onContinueClick = { params.callbacks.onContinueClick(params.userWalletId) }, + ), + ) } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/phrase/model/ManualBackupPhraseModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/phrase/model/ManualBackupPhraseModel.kt index 0c99cd5606..abb3ea0654 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/phrase/model/ManualBackupPhraseModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/phrase/model/ManualBackupPhraseModel.kt @@ -35,11 +35,11 @@ internal class ManualBackupPhraseModel @Inject constructor( private val callbacks = params.callbacks internal val uiState: StateFlow - field = MutableStateFlow( - ManualBackupPhraseUM( - onContinueClick = callbacks::onContinueClick, - ), - ) + field = MutableStateFlow( + ManualBackupPhraseUM( + onContinueClick = callbacks::onContinueClick, + ), + ) init { modelScope.launch { diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/start/ManualBackupStartModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/start/ManualBackupStartModel.kt index ef4f85294b..c847e052a6 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/start/ManualBackupStartModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/manualbackup/start/ManualBackupStartModel.kt @@ -18,9 +18,9 @@ internal class ManualBackupStartModel @Inject constructor( private val params: ManualBackupStartComponent.Params = paramsContainer.require() internal val uiState: StateFlow - field = MutableStateFlow( - ManualBackupStartUM( - onContinueClick = params.callbacks::onContinueClick, - ), - ) + field = MutableStateFlow( + ManualBackupStartUM( + onContinueClick = params.callbacks::onContinueClick, + ), + ) } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt index 40ba81c5b3..d94e79c3ce 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt @@ -18,9 +18,9 @@ internal class MobileWalletSetupFinishedModel @Inject constructor( private val params: MobileWalletSetupFinishedComponent.Params = paramsContainer.require() internal val uiState: StateFlow - field = MutableStateFlow( - MobileWalletSetupFinishedUM( - onContinueClick = params.callbacks::onContinueClick, - ), - ) + field = MutableStateFlow( + MobileWalletSetupFinishedUM( + onContinueClick = params.callbacks::onContinueClick, + ), + ) } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/stepper/impl/HotWalletStepperModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/stepper/impl/HotWalletStepperModel.kt index ed64c2fb93..513718e705 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/stepper/impl/HotWalletStepperModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/stepper/impl/HotWalletStepperModel.kt @@ -20,7 +20,7 @@ internal class HotWalletStepperModel @Inject constructor( val params = paramsContainer.require() val uiState: StateFlow - field = MutableStateFlow(params.initState) + field = MutableStateFlow(params.initState) fun updateState(newState: HotWalletStepperComponent.StepperUM) { uiState.value = newState diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/viewphrase/model/ViewPhraseModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/viewphrase/model/ViewPhraseModel.kt index ede4241680..a0b991c0a4 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/viewphrase/model/ViewPhraseModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/viewphrase/model/ViewPhraseModel.kt @@ -35,11 +35,11 @@ internal class ViewPhraseModel @Inject constructor( private val params = paramsContainer.require() internal val uiState: StateFlow - field = MutableStateFlow( - ViewPhraseUM( - onBackClick = { router.pop() }, - ), - ) + field = MutableStateFlow( + ViewPhraseUM( + onBackClick = { router.pop() }, + ), + ) init { loadSeedPhrase() diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt index b7357044d5..b399977f24 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt @@ -33,24 +33,24 @@ internal class WalletBackupModel @Inject constructor( private val params: WalletBackupComponent.Params = paramsContainer.require() val uiState: StateFlow - field = MutableStateFlow( - WalletBackupUM( - onBackClick = { router.pop() }, - recoveryPhraseOption = LabelUM( - text = resourceReference(R.string.hw_backup_no_backup), - style = LabelStyle.WARNING, + field = MutableStateFlow( + WalletBackupUM( + onBackClick = { router.pop() }, + recoveryPhraseOption = LabelUM( + text = resourceReference(R.string.hw_backup_no_backup), + style = LabelStyle.WARNING, + ), + googleDriveOption = LabelUM( + text = resourceReference(R.string.common_coming_soon), + style = LabelStyle.REGULAR, + ), + googleDriveStatus = BackupStatus.ComingSoon, + onRecoveryPhraseClick = ::onRecoveryPhraseClick, + onGoogleDriveClick = { }, + onHardwareWalletClick = ::onHardwareWalletClick, + backedUp = false, ), - googleDriveOption = LabelUM( - text = resourceReference(R.string.common_coming_soon), - style = LabelStyle.REGULAR, - ), - googleDriveStatus = BackupStatus.ComingSoon, - onRecoveryPhraseClick = ::onRecoveryPhraseClick, - onGoogleDriveClick = { }, - onHardwareWalletClick = ::onHardwareWalletClick, - backedUp = false, - ), - ) + ) init { getWalletUseCase.invoke(params.userWalletId) 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 a9c9f03c8f..8d8d5b6cbc 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 @@ -81,7 +81,7 @@ internal class ChooseManagedTokensModel @Inject constructor( val bottomSheetNavigation: SlotNavigation = SlotNavigation() val uiState: StateFlow - field = MutableStateFlow(createReadContentModel()) + field = MutableStateFlow(createReadContentModel()) init { manageTokensListManager.uiItems diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt index 6b22d2f6e3..7ffb94a1db 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt @@ -58,8 +58,8 @@ internal fun MarketsTokenDetailsContent( onBackClick: () -> Unit, onHeaderSizeChange: (Dp) -> Unit, backButtonEnabled: Boolean, - portfolioBlock: @Composable ((Modifier) -> Unit)?, modifier: Modifier = Modifier, + portfolioBlock: @Composable ((Modifier) -> Unit)?, ) { Content( modifier = modifier, @@ -88,8 +88,8 @@ private fun Content( onBackClick: () -> Unit, onHeaderSizeChange: (Dp) -> Unit, backButtonEnabled: Boolean, - portfolioBlock: @Composable ((Modifier) -> Unit)?, modifier: Modifier = Modifier, + portfolioBlock: @Composable ((Modifier) -> Unit)?, ) { val density = LocalDensity.current val bottomBarHeight = with(density) { WindowInsets.systemBars.getBottom(this).toDp() } diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/ui/NFTDetailsBlocksGroup.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/ui/NFTDetailsBlocksGroup.kt index 049d91b0cd..9c81a868da 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/ui/NFTDetailsBlocksGroup.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/details/ui/NFTDetailsBlocksGroup.kt @@ -185,9 +185,9 @@ internal fun NFTDetailsGroupBlock( @Composable internal fun NFTBlocksGroupAction( text: TextReference, - startIcon: @Composable RowScope.() -> Unit, onClick: () -> Unit, modifier: Modifier = Modifier, + startIcon: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/entity/DefaultNFTSendSuccessTrigger.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/entity/DefaultNFTSendSuccessTrigger.kt index fa1bb86d49..b3f0254a51 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/entity/DefaultNFTSendSuccessTrigger.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/entity/DefaultNFTSendSuccessTrigger.kt @@ -17,7 +17,7 @@ interface NFTSendSuccessListener { internal class DefaultNFTSendSuccessTrigger @Inject constructor() : NFTSendSuccessTrigger, NFTSendSuccessListener { override val nftSendSuccessFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override suspend fun triggerSuccessNFTSend() { nftSendSuccessFlow.emit(Unit) diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt index ff0ace4c4a..94bff159f9 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt @@ -219,7 +219,7 @@ internal class OnboardingEntryModel @Inject constructor( // legacy flow if (userWalletsListManager.hasUserWallets) { - val isLocked = runCatching { userWalletsListManager.asLockable()?.isLockedSync!! }.getOrElse { false } + val isLocked = runCatching { userWalletsListManager.asLockable()?.isLocked!! }.getOrElse { false } if (isLocked) { router.replaceAll(AppRoute.Welcome()) diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/ui/OnboardingEntry.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/ui/OnboardingEntry.kt index c8a1c938fd..c7845cae52 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/ui/OnboardingEntry.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/ui/OnboardingEntry.kt @@ -14,8 +14,8 @@ import com.tangem.features.onboarding.v2.entry.impl.routing.OnboardingRoute @Composable internal inline fun OnboardingEntry( - modifier: Modifier = Modifier, childStack: ChildStack, + modifier: Modifier = Modifier, stepperContent: @Composable (Modifier) -> Unit, ) { Column( diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/OnrampOperation.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/OnrampOperation.kt index dea01060e5..fdeba229d0 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/OnrampOperation.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/OnrampOperation.kt @@ -9,5 +9,4 @@ internal enum class OnrampOperation { BUY, SELL, SWAP, - ; } \ No newline at end of file diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/DefaultFeeSelectorReloadTrigger.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/DefaultFeeSelectorReloadTrigger.kt index 71b251f889..6d082b2615 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/DefaultFeeSelectorReloadTrigger.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/DefaultFeeSelectorReloadTrigger.kt @@ -18,16 +18,16 @@ internal class DefaultFeeSelectorReloadTrigger @Inject constructor() : FeeSelectorCheckReloadListener { override val reloadTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val loadingStateTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val checkReloadTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val checkReloadResultFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override suspend fun triggerUpdate(feeData: FeeSelectorData) { reloadTriggerFlow.emit(feeData) diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/model/FeeSelectorModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/model/FeeSelectorModel.kt index 8b04dae993..958449221b 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/model/FeeSelectorModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/feeselector/model/FeeSelectorModel.kt @@ -62,7 +62,7 @@ internal class FeeSelectorModel @Inject constructor( val feeSelectorBottomSheet = SlotNavigation() val uiState: StateFlow - field = MutableStateFlow(params.state) + field = MutableStateFlow(params.state) init { initAppCurrency() diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt index 49efa0b9db..94e92ba3eb 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt @@ -127,7 +127,7 @@ internal class SendConfirmModel @Inject constructor( val uiState = _uiState.asStateFlow() val isBalanceHiddenFlow: StateFlow - field = MutableStateFlow(false) + field = MutableStateFlow(false) private val amountState get() = uiState.value.amountUM as? AmountState.Data diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt index a6fec59187..5f82216ede 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt @@ -106,10 +106,10 @@ internal class SendModel @Inject constructor( val analyticCategoryName = CommonSendAnalyticEvents.SEND_CATEGORY val uiState: StateFlow - field = MutableStateFlow(initialState()) + field = MutableStateFlow(initialState()) val isBalanceHiddenFlow: StateFlow - field = MutableStateFlow(false) + field = MutableStateFlow(false) val initialRoute = if (params.amount == null) { if (uiState.value.isRedesignEnabled) { diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt index 9660b61db5..ce217d1184 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt @@ -88,10 +88,10 @@ internal class NFTSendModel @Inject constructor( private val nftAsset = params.nftAsset val uiState: StateFlow - field = MutableStateFlow(initialState()) + field = MutableStateFlow(initialState()) val isBalanceHiddenFlow: StateFlow - field = MutableStateFlow(false) + field = MutableStateFlow(false) var cryptoCurrency: CryptoCurrency by Delegates.notNull() var userWallet: UserWallet by Delegates.notNull() diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/amount/model/SendAmountModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/amount/model/SendAmountModel.kt index 3a215bc03b..b4456a6a90 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/amount/model/SendAmountModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/amount/model/SendAmountModel.kt @@ -79,7 +79,7 @@ internal class SendAmountModel @Inject constructor( private var isAvailableForSwap: Boolean = false val isSendWithSwapAvailable: StateFlow - field = MutableStateFlow(false) + field = MutableStateFlow(false) private val analyticsCategoryName = params.analyticsCategoryName private var cryptoCurrencyStatus: CryptoCurrencyStatus = CryptoCurrencyStatus( diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/DefaultSwapAmountUpdateTrigger.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/DefaultSwapAmountUpdateTrigger.kt index 33f79518f4..29162606e3 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/DefaultSwapAmountUpdateTrigger.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/amount/DefaultSwapAmountUpdateTrigger.kt @@ -45,19 +45,19 @@ internal class DefaultSwapAmountUpdateTrigger @Inject constructor() : SwapAmountReduceListener { override val updateAmountTriggerFlow: SharedFlow> - field = MutableSharedFlow>() + field = MutableSharedFlow>() override val reduceToTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val reduceByTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val ignoreReduceTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val reloadQuotesTriggerFlow: Flow - field = MutableSharedFlow() + field = MutableSharedFlow() override suspend fun triggerUpdateAmount(amountValue: String, isEnterInFiatSelected: Boolean) { updateAmountTriggerFlow.emit(amountValue to isEnterInFiatSelected) 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 53c158cd76..837fcc57f9 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 @@ -114,7 +114,7 @@ internal class SwapAmountModel @Inject constructor( private var showBestRateAnimation: Boolean = false val uiState: StateFlow - field = MutableStateFlow(params.amountUM) + field = MutableStateFlow(params.amountUM) private val amountDebouncer = Debouncer() private val quoteTaskScheduler = SingleTaskScheduler() diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/model/SwapChooseProviderModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/model/SwapChooseProviderModel.kt index 08511759a0..0ac41aea88 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/model/SwapChooseProviderModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/chooseprovider/model/SwapChooseProviderModel.kt @@ -37,7 +37,7 @@ internal class SwapChooseProviderModel @Inject constructor( } val uiState: StateFlow - field: MutableStateFlow = MutableStateFlow(getInitialState()) + field: MutableStateFlow = MutableStateFlow(getInitialState()) fun onProviderClick(quoteUM: SwapQuoteUM) { params.callback.onProviderResult(quoteUM) diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/DefaultSwapChooseTokenNetworkTrigger.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/DefaultSwapChooseTokenNetworkTrigger.kt index 7a0ffa5011..844e5aa49d 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/DefaultSwapChooseTokenNetworkTrigger.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/DefaultSwapChooseTokenNetworkTrigger.kt @@ -16,7 +16,7 @@ internal class DefaultSwapChooseTokenNetworkTrigger @Inject constructor() : SwapChooseTokenNetworkListener { override val swapChooseTokenNetworkResultFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override suspend fun trigger( swapCurrencies: SwapCurrencies, diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/model/SwapChooseTokenNetworkModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/model/SwapChooseTokenNetworkModel.kt index 0acbedc911..8d2c61caf1 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/model/SwapChooseTokenNetworkModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/choosetoken/fromSupported/model/SwapChooseTokenNetworkModel.kt @@ -46,20 +46,20 @@ internal class SwapChooseTokenNetworkModel @Inject constructor( private val params: SwapChooseTokenNetworkComponent.Params = paramsContainer.require() val uiState: StateFlow - field: MutableStateFlow = MutableStateFlow( - SwapChooseTokenNetworkUM( - TangemBottomSheetConfig( - isShown = true, - onDismissRequest = params.onDismiss, - content = SwapChooseTokenNetworkContentUM.Loading( - messageContent = getErrorMessage( - tokenName = params.token.name, - onDismiss = params.onDismiss, + field: MutableStateFlow = MutableStateFlow( + SwapChooseTokenNetworkUM( + TangemBottomSheetConfig( + isShown = true, + onDismissRequest = params.onDismiss, + content = SwapChooseTokenNetworkContentUM.Loading( + messageContent = getErrorMessage( + tokenName = params.token.name, + onDismiss = params.onDismiss, + ), ), ), ), - ), - ) + ) init { initContent() diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/SwapNotificationsUpdateTrigger.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/SwapNotificationsUpdateTrigger.kt index e595eb19a1..e1d036fad4 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/SwapNotificationsUpdateTrigger.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/SwapNotificationsUpdateTrigger.kt @@ -30,10 +30,10 @@ internal class DefaultSwapNotificationsUpdateTrigger @Inject constructor() : SwapNotificationsUpdateTrigger { override val updateTriggerFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override val hasErrorFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override suspend fun callbackHasError(hasError: Boolean) { hasErrorFlow.emit(hasError) diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/model/SwapNotificationsModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/model/SwapNotificationsModel.kt index 2f4e43e68a..e2be8113cd 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/model/SwapNotificationsModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/notifications/model/SwapNotificationsModel.kt @@ -38,7 +38,7 @@ internal class SwapNotificationsModel @Inject constructor( private var notificationData = params.swapNotificationData val uiState: StateFlow> - field = MutableStateFlow>(persistentListOf()) + field = MutableStateFlow>(persistentListOf()) init { subscribeToNotificationUpdateTrigger() diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt index 82ddd80851..1ed9498e65 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt @@ -91,7 +91,7 @@ internal class SendWithSwapConfirmModel @Inject constructor( private val params: SendWithSwapConfirmComponent.Params = paramsContainer.require() val uiState: StateFlow - field = MutableStateFlow(params.sendWithSwapUM) + field = MutableStateFlow(params.sendWithSwapUM) val primaryCurrencyStatus: CryptoCurrencyStatus = params.primaryCryptoCurrencyStatusFlow.value val secondaryCurrencyStatus: CryptoCurrencyStatus? = amountUM?.secondaryCryptoCurrencyStatus diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt index a92ea2bbff..6b342ab0ba 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt @@ -67,26 +67,26 @@ internal class SendWithSwapModel @Inject constructor( var appCurrency: AppCurrency = AppCurrency.Default val uiState: StateFlow - field = MutableStateFlow(initialState()) + field = MutableStateFlow(initialState()) val isBalanceHiddenFlow: StateFlow - field = MutableStateFlow(false) + field = MutableStateFlow(false) val primaryCryptoCurrencyStatusFlow: StateFlow - field = MutableStateFlow( - CryptoCurrencyStatus( - currency = params.currency, - value = CryptoCurrencyStatus.Loading, - ), - ) + field = MutableStateFlow( + CryptoCurrencyStatus( + currency = params.currency, + value = CryptoCurrencyStatus.Loading, + ), + ) val primaryFeePaidCurrencyStatusFlow: StateFlow - field = MutableStateFlow( - CryptoCurrencyStatus( - currency = params.currency, - value = CryptoCurrencyStatus.Loading, - ), - ) + field = MutableStateFlow( + CryptoCurrencyStatus( + currency = params.currency, + value = CryptoCurrencyStatus.Loading, + ), + ) init { initUserWallet() diff --git a/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt b/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt index a05a0f0b26..2f34e89a84 100644 --- a/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt +++ b/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt @@ -203,8 +203,7 @@ internal class DefaultSwapRepository( override suspend fun getExchangeStatus( userWallet: UserWallet, txId: String, - ): Either { + ): Either { return withContext(coroutineDispatcher.io) { either { catch( diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt index a39519d4a9..827905ea66 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt @@ -30,7 +30,7 @@ internal class TangemPayDetailsModel @Inject constructor( ) : Model() { val uiState: StateFlow - field = MutableStateFlow(getInitialState()) + field = MutableStateFlow(getInitialState()) private val refreshStateJobHolder = JobHolder() diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayTxHistoryModel.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayTxHistoryModel.kt index e8532b5dbe..1916f32e69 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayTxHistoryModel.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayTxHistoryModel.kt @@ -30,7 +30,7 @@ internal class TangemPayTxHistoryModel @Inject constructor( private val params: DefaultTangemPayTxHistoryComponent.Params = paramsContainer.require() val uiState: StateFlow - field = MutableStateFlow(getInitialState()) + field = MutableStateFlow(getInitialState()) init { handleBalanceHiding() diff --git a/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayOnboardingModel.kt b/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayOnboardingModel.kt index 482864d146..10c89f97a8 100644 --- a/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayOnboardingModel.kt +++ b/features/tangempay/onboarding/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayOnboardingModel.kt @@ -22,5 +22,5 @@ internal class TangemPayOnboardingModel @Inject constructor( private val params = paramsContainer.require() val screenState: StateFlow - field = MutableStateFlow(TangemPayOnboardingScreenState()) + field = MutableStateFlow(TangemPayOnboardingScreenState()) } \ No newline at end of file diff --git a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/menu/state/TesterMenuUM.kt b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/menu/state/TesterMenuUM.kt index 5815a07d58..5c27d1f688 100644 --- a/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/menu/state/TesterMenuUM.kt +++ b/features/tester/impl/src/main/java/com/tangem/feature/tester/presentation/menu/state/TesterMenuUM.kt @@ -24,6 +24,5 @@ data class TesterMenuUM( BLOCKCHAIN_PROVIDERS(R.string.blockchain_providers), TESTER_ACTIONS(R.string.tester_actions), TEST_PUSHES(R.string.test_push), - ; } } \ No newline at end of file diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt index e3f6ccdf6e..134be8aa43 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveAssetsModel.kt @@ -37,21 +37,21 @@ internal class TokenReceiveAssetsModel @Inject constructor( } internal val state: StateFlow - field = MutableStateFlow( - ReceiveAssetsUM( - onCopyClick = { - params.callback.onCopyClick( - address = it, - source = TokenReceiveCopyActionSource.Receive, - ) - }, - onOpenQrCodeClick = params.callback::onQrCodeClick, - addresses = params.addresses, - showMemoDisclaimer = params.showMemoDisclaimer, - isEnsResultLoading = false, - notificationConfigs = params.notificationConfigs, - ), - ) + field = MutableStateFlow( + ReceiveAssetsUM( + onCopyClick = { + params.callback.onCopyClick( + address = it, + source = TokenReceiveCopyActionSource.Receive, + ) + }, + onOpenQrCodeClick = params.callback::onQrCodeClick, + addresses = params.addresses, + showMemoDisclaimer = params.showMemoDisclaimer, + isEnsResultLoading = false, + notificationConfigs = params.notificationConfigs, + ), + ) private fun configureEnsStatus(): AnalyticsParam.EnsStatus { val hasEnsAddress = params.addresses.any { it.type == ReceiveAddress.Type.Ens } diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt index a2729de835..4229545563 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveModel.kt @@ -56,7 +56,7 @@ internal class TokenReceiveModel @Inject constructor( val stackNavigation = StackNavigation() internal val state: StateFlow - field = MutableStateFlow(tokenReceiveStateFactory.getInitialState(getTokenName())) + field = MutableStateFlow(tokenReceiveStateFactory.getInitialState(getTokenName())) init { modelScope.launch { diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt index 71f202d02b..6f10eea53a 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveQrCodeModel.kt @@ -23,18 +23,18 @@ internal class TokenReceiveQrCodeModel @Inject constructor( private val params = paramsContainer.require() internal val state: StateFlow - field = MutableStateFlow( - QrCodeUM( - network = params.cryptoCurrency.network.name, - addressValue = params.address.value, - addressName = TextReference.Str("${params.cryptoCurrency.name} (${params.cryptoCurrency.symbol})"), - onCopyClick = { - params.callback.onCopyClick( - address = params.address, - source = TokenReceiveCopyActionSource.QR, - ) - }, - onShareClick = params.callback::onShareClick, - ), - ) + field = MutableStateFlow( + QrCodeUM( + network = params.cryptoCurrency.network.name, + addressValue = params.address.value, + addressName = TextReference.Str("${params.cryptoCurrency.name} (${params.cryptoCurrency.symbol})"), + onCopyClick = { + params.callback.onCopyClick( + address = params.address, + source = TokenReceiveCopyActionSource.QR, + ) + }, + onShareClick = params.callback::onShareClick, + ), + ) } \ No newline at end of file diff --git a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveWarningModel.kt b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveWarningModel.kt index 7d57f2d60d..8a22d33f92 100644 --- a/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveWarningModel.kt +++ b/features/token-recieve/impl/src/main/java/com/tangem/features/tokenreceive/model/TokenReceiveWarningModel.kt @@ -21,11 +21,11 @@ internal class TokenReceiveWarningModel @Inject constructor( private val params = paramsContainer.require() internal val state: StateFlow - field = MutableStateFlow( - WarningUM( - iconState = params.iconState, - onWarningAcknowledged = params.callback::onWarningAcknowledged, - network = params.network.name, - ), - ) + field = MutableStateFlow( + WarningUM( + iconState = params.iconState, + onWarningAcknowledged = params.callback::onWarningAcknowledged, + network = params.network.name, + ), + ) } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/TokenDetailsDeepLinkActionTrigger.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/TokenDetailsDeepLinkActionTrigger.kt index 05bddf4542..9cc8ba1051 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/TokenDetailsDeepLinkActionTrigger.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/TokenDetailsDeepLinkActionTrigger.kt @@ -19,7 +19,7 @@ internal class DefaultTokenDetailsDeepLinkActionTrigger @Inject constructor() : TokenDetailsDeepLinkActionListener { override val tokenDetailsActionFlow: SharedFlow - field = MutableSharedFlow() + field = MutableSharedFlow() override suspend fun trigger(txId: String) { tokenDetailsActionFlow.emit(txId) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenIcon.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenIcon.kt index c0b325c9e4..f52e15610f 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenIcon.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/TokenIcon.kt @@ -86,11 +86,11 @@ private fun CoinIcon( @Composable private fun TokenIcon( - url: String?, alpha: Float, + url: String?, colorFilter: ColorFilter?, - errorIcon: @Composable () -> Unit, modifier: Modifier = Modifier, + errorIcon: @Composable () -> Unit, ) { if (url == null) { errorIcon() @@ -129,8 +129,8 @@ private inline fun DefaultCurrencyIcon( iconData: Any, alpha: Float, colorFilter: ColorFilter?, - crossinline errorIcon: @Composable () -> Unit, modifier: Modifier = Modifier, + crossinline errorIcon: @Composable () -> Unit, ) { var iconBackgroundColor by remember { mutableStateOf(Color.Transparent) } var isBackgroundColorDefined by remember { mutableStateOf(false) } 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 c0d5e0cd86..83c17f40d8 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 @@ -52,8 +52,8 @@ import com.tangem.feature.walletsettings.impl.R @Composable internal fun WalletSettingsScreen( state: WalletSettingsUM, - dialog: @Composable () -> Unit, modifier: Modifier = Modifier, + dialog: @Composable () -> Unit, ) { val backgroundColor = TangemTheme.colors.background.secondary diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountTransformer.kt index ef1b1961e2..ccc3c60815 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountTransformer.kt @@ -59,8 +59,8 @@ internal class SetTxHistoryCountTransformer( private fun createLoadingItems(): List { return buildList { add(TxHistoryState.TxHistoryItemState.Title(onExploreClick = clickIntents::onExploreClick)) - (1..transactionsCount).forEach { - add(TxHistoryState.TxHistoryItemState.Transaction(state = TransactionState.Loading(it.toString()))) + for (i in 1..transactionsCount) { + add(TxHistoryState.TxHistoryItemState.Transaction(state = TransactionState.Loading(i.toString()))) } } } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt index 133702c815..28adcb811c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt @@ -291,10 +291,10 @@ private inline fun BaseScaffoldWithMarkets( listState: LazyListState, selectedWallet: WalletState, snackbarHostState: SnackbarHostState, - bottomSheetHeaderHeightProvider: () -> Dp, - crossinline bottomSheetContent: @Composable () -> Unit, alertConfig: WalletAlertState?, + bottomSheetHeaderHeightProvider: () -> Dp, noinline onBottomSheetStateChange: (BottomSheetState) -> Unit, + crossinline bottomSheetContent: @Composable () -> Unit, crossinline content: @Composable (PaddingValues) -> Unit, ) { val bottomSheetState = rememberTangemStandardBottomSheetState() diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBlock.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBlock.kt index a37bf1f17f..869d61f559 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBlock.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBlock.kt @@ -68,11 +68,11 @@ private fun BalancesAndLimitsBlock(state: BalancesAndLimitsBlockState, modifier: @Composable private inline fun ContentContainer( enabled: Boolean, + modifier: Modifier = Modifier, noinline onClick: () -> Unit, crossinline title: @Composable () -> Unit, crossinline content: @Composable () -> Unit, crossinline endIcon: @Composable () -> Unit, - modifier: Modifier = Modifier, ) { Card( modifier = modifier.fillMaxWidth(), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBottomSheet.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBottomSheet.kt index 24b21a963a..c4830fb851 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBottomSheet.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/BalancesAndLimitsBottomSheet.kt @@ -133,10 +133,10 @@ private fun InfoButton(onClick: () -> Unit, modifier: Modifier = Modifier) { @Composable private inline fun ContentContainer( + modifier: Modifier = Modifier, title: @Composable BoxScope.() -> Unit, firstBlock: @Composable ColumnScope.() -> Unit, secondBlock: @Composable ColumnScope.() -> Unit, - modifier: Modifier = Modifier, ) { Column( modifier = modifier.background(TangemTheme.colors.background.secondary), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/Blocks.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/Blocks.kt index 723fabf3bc..8a2a5d7635 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/Blocks.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/Blocks.kt @@ -19,8 +19,8 @@ private const val BLOCK_ITEM_VALUE_WEIGHT = .55f @Composable internal inline fun BlockContent( title: TextReference, - content: @Composable ColumnScope.() -> Unit, modifier: Modifier = Modifier, + content: @Composable ColumnScope.() -> Unit, description: @Composable RowScope.() -> Unit = {}, ) { Column( diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectedAppInfoModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectedAppInfoModel.kt index 6b0bb827d2..4d36530516 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectedAppInfoModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectedAppInfoModel.kt @@ -45,7 +45,7 @@ internal class WcConnectedAppInfoModel @Inject constructor( private val params = paramsContainer.require() val uiState: StateFlow - field = MutableStateFlow(null) + field = MutableStateFlow(null) val stackNavigation = StackNavigation() diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectionsModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectionsModel.kt index 666eb2eb8f..578b261be3 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectionsModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcConnectionsModel.kt @@ -55,7 +55,7 @@ internal class WcConnectionsModel @Inject constructor( private val params = paramsContainer.require() val uiState: StateFlow - field = MutableStateFlow(getInitialState()) + field = MutableStateFlow(getInitialState()) val bottomSheetNavigation: SlotNavigation = SlotNavigation() init { diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt index bf416fe8f2..5dab9f0577 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcPairModel.kt @@ -80,7 +80,7 @@ internal class WcPairModel @Inject constructor( private val dAppVerifiedStateConverter = WcDAppVerifiedStateConverter(onVerifiedClick = ::showVerifiedAlert) val appInfoUiState: StateFlow - field = MutableStateFlow(createLoadingState()) + field = MutableStateFlow(createLoadingState()) init { loadDAppInfo() diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectNetworksModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectNetworksModel.kt index 06a987c536..f87b309971 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectNetworksModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectNetworksModel.kt @@ -37,7 +37,7 @@ internal class WcSelectNetworksModel @Inject constructor( ) val state: StateFlow - field = MutableStateFlow(getInitialState()) + field = MutableStateFlow(getInitialState()) private fun onCheckedChange(isChecked: Boolean, network: Network) { additionallyEnabledNetworks.update { diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectWalletModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectWalletModel.kt index 1b79e19e65..e9f6c92a3b 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectWalletModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/model/WcSelectWalletModel.kt @@ -32,12 +32,12 @@ internal class WcSelectWalletModel @Inject constructor( private val params = paramsContainer.require() internal val state: StateFlow - field = MutableStateFlow( - WcAppInfoWalletUM( - wallets = persistentListOf(), - selectedUserWalletId = params.selectedWalletId, - ), - ) + field = MutableStateFlow( + WcAppInfoWalletUM( + wallets = persistentListOf(), + selectedUserWalletId = params.selectedWalletId, + ), + ) private val userWalletsFetcher = WcUserWalletsFetcher( userWalletsFetcherFactory = userWalletsFetcherFactory, diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/components/chain/WcSwitchNetworkComponent.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/components/chain/WcSwitchNetworkComponent.kt index 9bf945bd89..086bd0578e 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/components/chain/WcSwitchNetworkComponent.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/components/chain/WcSwitchNetworkComponent.kt @@ -13,6 +13,7 @@ internal class WcSwitchNetworkComponent( params: WcTransactionModelParams, ) : AppComponentContext by appComponentContext, ComposableContentComponent { + @Suppress("UnusedPrivateProperty") private val model: WcSwitchNetworkModel = getOrCreateModel(params = params) @Composable diff --git a/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt b/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt index 4b7bdf5496..c627aa45fc 100644 --- a/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt +++ b/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt @@ -50,7 +50,7 @@ internal class WelcomeModel @Inject constructor( ) : Model() { val uiState: StateFlow - field = MutableStateFlow(WelcomeUM.Plain) + field = MutableStateFlow(WelcomeUM.Plain) private val walletsFetcher = userWalletsFetcherFactory.create( messageSender = uiMessageSender, diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt index 698ba4b032..38365e52c6 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/active/model/YieldSupplyActiveModel.kt @@ -29,22 +29,22 @@ internal class YieldSupplyActiveModel @Inject constructor( private val cryptoCurrency = cryptoCurrencyStatusFlow.value.currency val uiState: StateFlow - field = MutableStateFlow( - YieldSupplyActiveContentUM( - totalEarnings = stringReference("0"), - availableBalance = stringReference( - cryptoCurrencyStatusFlow.value.value.amount.format { - crypto(cryptoCurrency = cryptoCurrencyStatusFlow.value.currency) - }, - ), - providerTitle = resourceReference(R.string.yield_module_provider), - subtitle = combinedReference( - resourceReference( - id = R.string.yield_module_earn_sheet_provider_description, - formatArgs = wrappedList(cryptoCurrency.symbol, cryptoCurrency.symbol), + field = MutableStateFlow( + YieldSupplyActiveContentUM( + totalEarnings = stringReference("0"), + availableBalance = stringReference( + cryptoCurrencyStatusFlow.value.value.amount.format { + crypto(cryptoCurrency = cryptoCurrencyStatusFlow.value.currency) + }, + ), + providerTitle = resourceReference(R.string.yield_module_provider), + subtitle = combinedReference( + resourceReference( + id = R.string.yield_module_earn_sheet_provider_description, + formatArgs = wrappedList(cryptoCurrency.symbol, cryptoCurrency.symbol), + ), + resourceReference(R.string.common_read_more), ), - resourceReference(R.string.common_read_more), ), - ), - ) + ) } \ No newline at end of file diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt index dd5fee8a5e..40180b5882 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt @@ -57,37 +57,37 @@ internal class YieldSupplyStartEarningModel @Inject constructor( private var userWallet: UserWallet by Delegates.notNull() private val cryptoCurrencyStatusFlow: StateFlow - field = MutableStateFlow( - CryptoCurrencyStatus( - currency = cryptoCurrency, - value = CryptoCurrencyStatus.Loading, - ), - ) + field = MutableStateFlow( + CryptoCurrencyStatus( + currency = cryptoCurrency, + value = CryptoCurrencyStatus.Loading, + ), + ) private val feeCryptoCurrencyStatusFlow: StateFlow - field = MutableStateFlow( - CryptoCurrencyStatus( - currency = cryptoCurrency, - value = CryptoCurrencyStatus.Loading, - ), - ) + field = MutableStateFlow( + CryptoCurrencyStatus( + currency = cryptoCurrency, + value = CryptoCurrencyStatus.Loading, + ), + ) val uiState: StateFlow - field: MutableStateFlow