Updated on 2026-08-14
This commit is contained in:
parent
bc8a0ba20d
commit
a733dd0e52
13 changed files with 158 additions and 25 deletions
|
|
@ -11,6 +11,10 @@ import com.tangem.datasource.local.onramp.paymentmethods.DefaultOnrampPaymentMet
|
|||
import com.tangem.datasource.local.onramp.paymentmethods.OnrampPaymentMethodsStore
|
||||
import com.tangem.datasource.local.onramp.quotes.DefaultOnrampQuotesStore
|
||||
import com.tangem.datasource.local.onramp.quotes.OnrampQuotesStore
|
||||
import com.tangem.datasource.local.onramp.sepa.DefaultOnrampCurrentCountryByIPStore
|
||||
import com.tangem.datasource.local.onramp.sepa.DefaultOnrampSepaAvailabilityStore
|
||||
import com.tangem.datasource.local.onramp.sepa.OnrampCurrentCountryByIPStore
|
||||
import com.tangem.datasource.local.onramp.sepa.OnrampSepaAvailabilityStore
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
|
|
@ -50,4 +54,16 @@ internal object OnrampStoreModule {
|
|||
fun provideOnrampCurrencies(): OnrampCurrenciesStore {
|
||||
return DefaultOnrampCurrenciesStore(dataStore = RuntimeDataStore())
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideOnrampSepaAvailableStore(): OnrampSepaAvailabilityStore {
|
||||
return DefaultOnrampSepaAvailabilityStore(dataStore = RuntimeDataStore())
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideOnrampCurrentCountryByIPStore(): OnrampCurrentCountryByIPStore {
|
||||
return DefaultOnrampCurrentCountryByIPStore(dataStore = RuntimeDataStore())
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.tangem.datasource.local.onramp.sepa
|
||||
|
||||
import com.tangem.datasource.local.datastore.core.StringKeyDataStore
|
||||
import com.tangem.datasource.local.datastore.core.StringKeyDataStoreDecorator
|
||||
import com.tangem.domain.onramp.model.OnrampCountry
|
||||
|
||||
internal class DefaultOnrampCurrentCountryByIPStore(
|
||||
val dataStore: StringKeyDataStore<OnrampCountry>,
|
||||
) : OnrampCurrentCountryByIPStore, StringKeyDataStoreDecorator<Unit, OnrampCountry>(
|
||||
wrappedDataStore = dataStore,
|
||||
) {
|
||||
|
||||
override suspend fun getSyncOrNull(): OnrampCountry? {
|
||||
return getSyncOrNull(Unit)
|
||||
}
|
||||
|
||||
override suspend fun store(value: OnrampCountry) {
|
||||
return store(Unit, value)
|
||||
}
|
||||
|
||||
override fun provideStringKey(key: Unit) = "KEY"
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.tangem.datasource.local.onramp.sepa
|
||||
|
||||
import com.tangem.datasource.local.datastore.core.StringKeyDataStore
|
||||
import com.tangem.datasource.local.datastore.core.StringKeyDataStoreDecorator
|
||||
|
||||
internal class DefaultOnrampSepaAvailabilityStore(
|
||||
val dataStore: StringKeyDataStore<Boolean>,
|
||||
) : OnrampSepaAvailabilityStore, StringKeyDataStoreDecorator<OnrampSepaAvailabilityStoreKey, Boolean>(
|
||||
wrappedDataStore = dataStore,
|
||||
) {
|
||||
override fun provideStringKey(key: OnrampSepaAvailabilityStoreKey) = with(key) {
|
||||
buildString {
|
||||
append(userWallet.walletId.toString())
|
||||
append("_")
|
||||
append(country.code)
|
||||
append("_")
|
||||
append(cryptoCurrency.id.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.tangem.datasource.local.onramp.sepa
|
||||
|
||||
import com.tangem.domain.onramp.model.OnrampCountry
|
||||
|
||||
interface OnrampCurrentCountryByIPStore {
|
||||
suspend fun getSyncOrNull(): OnrampCountry?
|
||||
suspend fun store(value: OnrampCountry)
|
||||
suspend fun clear()
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.tangem.datasource.local.onramp.sepa
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface OnrampSepaAvailabilityStore {
|
||||
suspend fun getSyncOrNull(key: OnrampSepaAvailabilityStoreKey): Boolean?
|
||||
fun get(key: OnrampSepaAvailabilityStoreKey): Flow<Boolean>
|
||||
suspend fun store(key: OnrampSepaAvailabilityStoreKey, value: Boolean)
|
||||
suspend fun clear()
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.tangem.datasource.local.onramp.sepa
|
||||
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.onramp.model.OnrampCountry
|
||||
|
||||
data class OnrampSepaAvailabilityStoreKey(
|
||||
val userWallet: UserWallet,
|
||||
val country: OnrampCountry,
|
||||
val cryptoCurrency: CryptoCurrency,
|
||||
)
|
||||
|
|
@ -27,10 +27,12 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.*
|
||||
import com.tangem.core.ui.components.buttons.common.TangemButtonSize
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveAnnotatedReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
|
@ -216,7 +218,7 @@ internal fun TextsBlock(
|
|||
SpacerH(height = TangemTheme.dimens.spacing2)
|
||||
}
|
||||
|
||||
val subtitleText = subtitle.resolveReference()
|
||||
val subtitleText = subtitle.resolveAnnotatedReference()
|
||||
if (subtitleText.isNotEmpty()) {
|
||||
Text(
|
||||
text = subtitleText,
|
||||
|
|
@ -459,5 +461,15 @@ private class NotificationConfigProvider : CollectionPreviewParameterProvider<No
|
|||
subtitle = resourceReference(id = R.string.information_generated_with_ai),
|
||||
iconResId = R.drawable.ic_magic_28,
|
||||
),
|
||||
NotificationConfig(
|
||||
title = resourceReference(R.string.notification_sepa_title),
|
||||
subtitle = resourceReference(R.string.notification_sepa_text),
|
||||
iconResId = R.drawable.img_notification_sepa,
|
||||
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
|
||||
text = resourceReference(R.string.notification_sepa_button),
|
||||
onClick = { },
|
||||
),
|
||||
iconSize = 54.dp,
|
||||
),
|
||||
),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue