diff --git a/app/build.gradle b/app/build.gradle
index 70f6e3df99..aa1b8e24b1 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -38,7 +38,7 @@ android {
}
debug_beta {
initWith release
- debuggable false
+ debuggable true
versionNameSuffix "-beta"
applicationIdSuffix ".debug"
buildConfigField 'String', 'CONFIG_ENVIRONMENT', '\"prod\"'
@@ -78,8 +78,8 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'com.tangem:blockchain:develop-64'
- implementation 'com.tangem.tangem-sdk-kotlin:core:develop-131'
- implementation 'com.tangem.tangem-sdk-kotlin:android:develop-131'
+ implementation 'com.tangem.tangem-sdk-kotlin:core:develop-132'
+ implementation 'com.tangem.tangem-sdk-kotlin:android:develop-132'
// WebView
implementation "androidx.browser:browser:1.3.0"
@@ -129,6 +129,15 @@ dependencies {
// animation
implementation "com.airbnb.android:lottie:3.4.0"
+ // Shopify
+ implementation('com.shopify.mobilebuysdk:buy3:12.0.0') {
+ exclude group: "com.shopify.graphql.support"
+ exclude module: 'joda-time'
+ }
+
+ // Google Pay
+ implementation 'com.google.android.gms:play-services-wallet:19.1.0'
+
testImplementation 'junit:junit:4.13.2'
testImplementation "com.google.truth:truth:1.1.3"
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f358215715..b38eacf816 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -39,6 +39,9 @@
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:fullBackupContent">
+ {
+ store.dispatch(
+ ShopAction.BuyWithGooglePay.HandleGooglePayResponse(resultCode, data)
+ )
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/TapApplication.kt b/app/src/main/java/com/tangem/tap/TapApplication.kt
index 1d84bd399c..74e957f6c3 100644
--- a/app/src/main/java/com/tangem/tap/TapApplication.kt
+++ b/app/src/main/java/com/tangem/tap/TapApplication.kt
@@ -12,6 +12,7 @@ import com.tangem.tap.common.images.PicassoHelper
import com.tangem.tap.common.redux.AppState
import com.tangem.tap.common.redux.appReducer
import com.tangem.tap.common.redux.global.GlobalAction
+import com.tangem.tap.common.shop.TangemShopService
import com.tangem.tap.domain.configurable.config.ConfigManager
import com.tangem.tap.domain.configurable.config.FeaturesLocalLoader
import com.tangem.tap.domain.configurable.config.FeaturesRemoteLoader
@@ -37,6 +38,7 @@ val store = Store(
lateinit var preferencesStorage: PreferencesStorage
lateinit var currenciesRepository: CurrenciesRepository
lateinit var walletConnectRepository: WalletConnectRepository
+lateinit var shopService: TangemShopService
class TapApplication : Application() {
override fun onCreate() {
@@ -72,7 +74,10 @@ class TapApplication : Application() {
val localLoader = FeaturesLocalLoader(this, moshi)
val remoteLoader = FeaturesRemoteLoader(moshi)
val configManager = ConfigManager(localLoader, remoteLoader)
- configManager.load { store.dispatch(GlobalAction.SetConfigManager(configManager)) }
+ configManager.load {
+ store.dispatch(GlobalAction.SetConfigManager(configManager))
+ shopService = TangemShopService(this, configManager.config.shopify!!)
+ }
val warningsManager = WarningMessagesManager(RemoteWarningLoader(moshi))
warningsManager.load { store.dispatch(GlobalAction.SetWarningManager(warningsManager)) }
}
diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt b/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt
index 30d8e1b18a..5fdd3a9279 100644
--- a/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt
+++ b/app/src/main/java/com/tangem/tap/common/extensions/Navigation.kt
@@ -19,6 +19,7 @@ import com.tangem.tap.features.onboarding.products.otherCards.OnboardingOtherCar
import com.tangem.tap.features.onboarding.products.twins.ui.TwinsCardsFragment
import com.tangem.tap.features.onboarding.products.wallet.ui.OnboardingWalletFragment
import com.tangem.tap.features.send.ui.SendFragment
+import com.tangem.tap.features.shop.ui.ShopFragment
import com.tangem.tap.features.tokens.ui.AddTokensFragment
import com.tangem.tap.features.wallet.ui.WalletDetailsFragment
import com.tangem.tap.features.wallet.ui.WalletFragment
@@ -69,6 +70,7 @@ fun FragmentActivity.addOnBackPressedDispatcher(
private fun fragmentFactory(screen: AppScreen): Fragment {
return when (screen) {
AppScreen.Home -> HomeFragment()
+ AppScreen.Shop -> ShopFragment()
AppScreen.OnboardingNote -> OnboardingNoteFragment()
AppScreen.OnboardingWallet -> OnboardingWalletFragment()
AppScreen.OnboardingTwins -> TwinsCardsFragment()
diff --git a/app/src/main/java/com/tangem/tap/common/extensions/UI.kt b/app/src/main/java/com/tangem/tap/common/extensions/UI.kt
index e468ec2203..182461aa4c 100644
--- a/app/src/main/java/com/tangem/tap/common/extensions/UI.kt
+++ b/app/src/main/java/com/tangem/tap/common/extensions/UI.kt
@@ -68,9 +68,16 @@ fun View.hide(invokeBeforeStateChanged: (() -> Unit)? = null) {
this.visibility = View.GONE
}
-fun View.makeInvisible() {
- if (this.visibility == View.INVISIBLE) return
- this.visibility = View.INVISIBLE
+fun View.invisible(invisible: Boolean = true, invokeBeforeStateChanged: (() -> Unit)? = null) {
+ if (invisible) {
+ if (this.visibility == View.INVISIBLE) return
+
+ invokeBeforeStateChanged?.invoke()
+ this.visibility = View.INVISIBLE
+ } else {
+ this.show(invokeBeforeStateChanged)
+ }
+
}
fun Context.dpToPixels(dp: Int): Int =
diff --git a/app/src/main/java/com/tangem/tap/common/extensions/ViewGroup.kt b/app/src/main/java/com/tangem/tap/common/extensions/ViewGroup.kt
index 81be964cb1..50c90e1133 100644
--- a/app/src/main/java/com/tangem/tap/common/extensions/ViewGroup.kt
+++ b/app/src/main/java/com/tangem/tap/common/extensions/ViewGroup.kt
@@ -29,6 +29,10 @@ fun ViewGroup.beginDelayedTransition(transition: Transition = AutoTransition())
TransitionManager.beginDelayedTransition(this, transition)
}
+fun View.beginDelayedTransition(transition: Transition = AutoTransition()) {
+ (this as? ViewGroup)?.beginDelayedTransition(transition)
+}
+
fun ChipGroup.fitChipsByGroupWidth() {
val layoutStateHandler = GlobalLayoutStateHandler(this)
layoutStateHandler.onStateChanged = stateHandler@{
diff --git a/app/src/main/java/com/tangem/tap/common/redux/AppReducer.kt b/app/src/main/java/com/tangem/tap/common/redux/AppReducer.kt
index d797ff9010..cbfa2565fb 100644
--- a/app/src/main/java/com/tangem/tap/common/redux/AppReducer.kt
+++ b/app/src/main/java/com/tangem/tap/common/redux/AppReducer.kt
@@ -11,6 +11,7 @@ import com.tangem.tap.features.onboarding.products.otherCards.redux.OnboardingOt
import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsReducer
import com.tangem.tap.features.onboarding.products.wallet.redux.OnboardingWalletReducer
import com.tangem.tap.features.send.redux.reducers.SendScreenReducer
+import com.tangem.tap.features.shop.redux.ShopReducer
import com.tangem.tap.features.tokens.redux.TokensReducer
import com.tangem.tap.features.wallet.redux.reducers.WalletReducer
import org.rekotlin.Action
@@ -32,7 +33,8 @@ fun appReducer(action: Action, state: AppState?): AppState {
detailsState = DetailsReducer.reduce(action, state),
disclaimerState = DisclaimerReducer.reduce(action, state),
tokensState = TokensReducer.reduce(action, state),
- walletConnectState = WalletConnectReducer.reduce(action, state.walletConnectState)
+ walletConnectState = WalletConnectReducer.reduce(action, state.walletConnectState),
+ shopState = ShopReducer.reduce(action, state.shopState),
)
}
diff --git a/app/src/main/java/com/tangem/tap/common/redux/AppState.kt b/app/src/main/java/com/tangem/tap/common/redux/AppState.kt
index d3c6f3656b..719386cad9 100644
--- a/app/src/main/java/com/tangem/tap/common/redux/AppState.kt
+++ b/app/src/main/java/com/tangem/tap/common/redux/AppState.kt
@@ -23,6 +23,8 @@ import com.tangem.tap.features.onboarding.products.wallet.redux.OnboardingWallet
import com.tangem.tap.features.onboarding.products.wallet.redux.OnboardingWalletState
import com.tangem.tap.features.send.redux.middlewares.SendMiddleware
import com.tangem.tap.features.send.redux.states.SendState
+import com.tangem.tap.features.shop.redux.ShopMiddleware
+import com.tangem.tap.features.shop.redux.ShopState
import com.tangem.tap.features.tokens.redux.TokensMiddleware
import com.tangem.tap.features.tokens.redux.TokensState
import com.tangem.tap.features.wallet.redux.WalletState
@@ -44,6 +46,7 @@ data class AppState(
val disclaimerState: DisclaimerState = DisclaimerState(),
val tokensState: TokensState = TokensState(),
val walletConnectState: WalletConnectState = WalletConnectState(),
+ val shopState: ShopState = ShopState(),
) : StateType {
companion object {
@@ -62,7 +65,8 @@ data class AppState(
DisclaimerMiddleware().disclaimerMiddleware,
TokensMiddleware().tokensMiddleware,
WalletConnectMiddleware().walletConnectMiddleware,
- BackupMiddleware().backupMiddleware
+ BackupMiddleware().backupMiddleware,
+ ShopMiddleware().shopMiddleware,
)
}
}
diff --git a/app/src/main/java/com/tangem/tap/common/redux/navigation/NavigationState.kt b/app/src/main/java/com/tangem/tap/common/redux/navigation/NavigationState.kt
index 61e3d263da..6f68439f61 100644
--- a/app/src/main/java/com/tangem/tap/common/redux/navigation/NavigationState.kt
+++ b/app/src/main/java/com/tangem/tap/common/redux/navigation/NavigationState.kt
@@ -11,6 +11,7 @@ data class NavigationState(
enum class AppScreen {
Home,
+ Shop,
Disclaimer,
OnboardingNote, OnboardingWallet, OnboardingTwins, OnboardingOther,
Wallet, WalletDetails,
diff --git a/app/src/main/java/com/tangem/tap/common/shop/TangemShopService.kt b/app/src/main/java/com/tangem/tap/common/shop/TangemShopService.kt
new file mode 100644
index 0000000000..d428a9d197
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/TangemShopService.kt
@@ -0,0 +1,216 @@
+package com.tangem.tap.common.shop
+
+import android.app.Application
+import android.content.Intent
+import com.google.android.gms.wallet.PaymentData
+import com.shopify.buy3.Storefront
+import com.tangem.tap.common.shop.data.ProductType
+import com.tangem.tap.common.shop.data.TangemProduct
+import com.tangem.tap.common.shop.data.TotalSum
+import com.tangem.tap.common.shop.shopify.ShopifyShop
+import com.tangem.tap.common.shop.shopify.data.CheckoutItem
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.coroutineScope
+import java.math.BigDecimal
+import java.util.*
+
+class TangemShopService(application: Application, shopifyShop: ShopifyShop) {
+
+ private val shopifyService = ShopifyService(application, shopifyShop)
+
+ private lateinit var product: Storefront.Product
+
+ private val checkouts = mutableMapOf()
+ private val variants = mutableMapOf()
+
+ private lateinit var googlePayService: GooglePayService
+
+ suspend fun getProducts(): Result> {
+ val result = shopifyService.getProducts()
+
+ result.onSuccess {
+ product = it.first {
+ val variantsSku = it.variants.edges.map { it.node.sku }
+ variantsSku.contains(ProductType.WALLET_2_CARDS.sku) && variantsSku.contains(
+ ProductType.WALLET_3_CARDS.sku
+ )
+ }
+ product.variants.edges.map { it.node }
+ .forEach { variant ->
+ if (variant.sku == ProductType.WALLET_2_CARDS.sku) {
+ variants[ProductType.WALLET_2_CARDS] = variant
+ } else if (variant.sku == ProductType.WALLET_3_CARDS.sku) {
+ variants[ProductType.WALLET_3_CARDS] = variant
+ }
+ }
+
+
+ val twoCardsProduct = TangemProduct(
+ type = ProductType.WALLET_2_CARDS,
+ totalSum = TotalSum(
+ finalValue = variants[ProductType.WALLET_2_CARDS]?.priceV2?.format(),
+ beforeDiscount = variants[ProductType.WALLET_2_CARDS]?.compareAtPriceV2?.format()
+ )
+ )
+ val threeCardsProduct = TangemProduct(
+ type = ProductType.WALLET_3_CARDS,
+ totalSum = TotalSum(
+ finalValue = variants[ProductType.WALLET_3_CARDS]?.priceV2?.format(),
+ beforeDiscount = variants[ProductType.WALLET_3_CARDS]?.compareAtPriceV2?.format()
+ )
+ )
+ createCheckouts()
+ return Result.success(listOf(twoCardsProduct, threeCardsProduct))
+ }
+ return Result.failure(result.exceptionOrNull()!!)
+ }
+
+ private suspend fun createCheckouts() {
+ variants.keys.map { coroutineScope { async { createCheckout(it) } } }.awaitAll()
+ }
+
+ private suspend fun createCheckout(productType: ProductType) {
+ val checkoutItem = CheckoutItem(variants[productType]!!.id, 1)
+ val result = shopifyService.createCheckout(listOf(checkoutItem))
+ result.onSuccess { checkout ->
+ checkouts[productType] = checkout
+ }
+ }
+
+ suspend fun checkIfGooglePayAvailable(googlePayService: GooglePayService): Result {
+ this.googlePayService = googlePayService
+ return googlePayService.checkIfGooglePayAvailable()
+ }
+
+ fun buyWithGooglePay(productType: ProductType) {
+ val totalPrice = checkouts[productType]!!.totalPriceV2.amount
+ googlePayService.payWithGooglePay(
+ totalPriceCents = totalPrice, currencyCode = checkouts[productType]!!.currencyCode.name,
+ merchantID = shopifyService.shop.merchantID
+ )
+ }
+
+// fun subscribeToGooglePayResult(
+// productType: ProductType,
+// resultCallback: (Result) -> Unit
+// ) {
+// googlePayService.responseCallback = { result ->
+// result.onFailure { }
+// result.onSuccess {
+// completeTokenizedPayment(it, productType)
+// }
+// }
+// }
+
+ suspend fun handleGooglePayResult(
+ resultCode: Int,
+ data: Intent?,
+ productType: ProductType
+ ): Result {
+ val result = googlePayService.handleResponseFromGooglePay(resultCode, data)
+ result.onSuccess {
+ val finalizePaymentResult = completeTokenizedPayment(it, productType)
+ finalizePaymentResult.onSuccess {
+ return Result.success(Unit)
+ }
+ return Result.failure(finalizePaymentResult.exceptionOrNull()!!)
+ }
+ return Result.failure(result.exceptionOrNull()!!)
+ }
+
+ private suspend fun completeTokenizedPayment(
+ paymentData: PaymentData,
+ productType: ProductType
+ ): Result {
+ val checkout = checkouts[productType]!!
+ val googlePayResponse =
+ googlePayService.parsePaymentData(paymentData)
+ ?: return Result.failure(Exception("cannot parse GPay result"))
+
+ val amount =
+ Storefront.MoneyInput(checkout.totalPriceV2.amount, checkout.totalPriceV2.currencyCode)
+ val idempotencyKey = UUID.randomUUID().toString()
+ val addressGPay = googlePayResponse.billingAddress
+
+ val address = Storefront.MailingAddressInput().apply {
+ lastName = addressGPay.name
+ address1 = addressGPay.address1
+ address2 = addressGPay.address2 + addressGPay.address3
+ province = addressGPay.administrativeArea
+ zip = addressGPay.postalCode
+ phone = addressGPay.phoneNumber
+ }
+
+
+ val payment = Storefront.TokenizedPaymentInputV3(
+ amount,
+ idempotencyKey,
+ address,
+ paymentData.toJson(),
+ Storefront.PaymentTokenType.GOOGLE_PAY
+ )
+ .setTest(true)
+
+ return shopifyService.completeWithTokenizedPayment(
+ payment = payment,
+ checkoutID = checkout.id
+ )
+ }
+
+ suspend fun applyPromoCode(promoCode: String): Result> {
+ val products = variants.keys
+ .map { coroutineScope { async { applyPromoCode(promoCode, it) } } }
+ .awaitAll()
+ .map { result -> result.getOrElse { return Result.failure(it) } }
+
+ return Result.success(products)
+ }
+
+ suspend fun applyPromoCode(promoCode: String, productType: ProductType): Result {
+ val checkout = checkouts[productType] ?: return Result.failure(Exception("No checkout"))
+
+ val result = if (promoCode.isBlank()) {
+ shopifyService.removeDiscount(checkout.id)
+ } else {
+ shopifyService.applyDiscount(promoCode, checkout.id)
+ }
+
+ result.onSuccess {
+ checkouts[productType] = it
+ return Result.success(
+ TangemProduct(
+ productType,
+ TotalSum(
+ finalValue = it.totalPriceV2.format(),
+ beforeDiscount = variants[productType]!!.compareAtPriceV2.format()
+ ),
+ appliedDiscount = it.getAppliedDiscount()
+ )
+
+ )
+ }
+ return Result.failure(result.exceptionOrNull()!!)
+ }
+
+ fun getCheckoutUrl(productType: ProductType): String {
+ return checkouts[productType]!!.webUrl
+ }
+
+ companion object {
+ const val TANGEM_WALLET_2_CARDS_SKU = "TG115x2"
+ const val TANGEM_WALLET_3_CARDS_SKU = "TG115x3"
+ }
+}
+
+private fun Storefront.MoneyV2.format(): String {
+ val currencySymbol = Currency.getInstance(currencyCode.name).symbol
+ val amountFormatted = BigDecimal(amount).setScale(2)
+ return currencySymbol + amountFormatted
+}
+
+private fun Storefront.Checkout.getAppliedDiscount(): String? {
+ val discountApplication =
+ discountApplications.edges.firstOrNull()?.node as? Storefront.DiscountCodeApplication
+ return discountApplication?.code
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/data/ProductType.kt b/app/src/main/java/com/tangem/tap/common/shop/data/ProductType.kt
new file mode 100644
index 0000000000..89116f8096
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/data/ProductType.kt
@@ -0,0 +1,8 @@
+package com.tangem.tap.common.shop.data
+
+import com.tangem.tap.common.shop.TangemShopService
+
+enum class ProductType(val sku: String) {
+ WALLET_2_CARDS(TangemShopService.TANGEM_WALLET_2_CARDS_SKU),
+ WALLET_3_CARDS(TangemShopService.TANGEM_WALLET_3_CARDS_SKU)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/data/TangemProduct.kt b/app/src/main/java/com/tangem/tap/common/shop/data/TangemProduct.kt
new file mode 100644
index 0000000000..022af2b4ea
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/data/TangemProduct.kt
@@ -0,0 +1,7 @@
+package com.tangem.tap.common.shop.data
+
+data class TangemProduct(
+ val type: ProductType,
+ val totalSum: TotalSum? = null,
+ val appliedDiscount: String? = null
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/data/TotalSum.kt b/app/src/main/java/com/tangem/tap/common/shop/data/TotalSum.kt
new file mode 100644
index 0000000000..a9e920745f
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/data/TotalSum.kt
@@ -0,0 +1,6 @@
+package com.tangem.tap.common.shop.data
+
+data class TotalSum(
+ val finalValue: String? = null,
+ val beforeDiscount: String? = null,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/googlepay/GooglePayService.kt b/app/src/main/java/com/tangem/tap/common/shop/googlepay/GooglePayService.kt
new file mode 100644
index 0000000000..13c3913ebe
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/googlepay/GooglePayService.kt
@@ -0,0 +1,148 @@
+package com.tangem.tap.common.shop
+
+import android.app.Activity
+import android.app.Activity.RESULT_CANCELED
+import android.app.Activity.RESULT_OK
+import android.content.Intent
+import android.util.Log
+import com.google.android.gms.common.api.ApiException
+import com.google.android.gms.wallet.*
+import com.tangem.common.core.TangemSdkError
+import com.tangem.tap.common.shop.googlepay.GooglePayUtil
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+import org.json.JSONException
+import org.json.JSONObject
+import timber.log.Timber
+import kotlin.coroutines.resume
+import kotlin.coroutines.suspendCoroutine
+
+class GooglePayService(private val paymentsClient: PaymentsClient, private val activity: Activity) {
+
+// var responseCallback: ((Result) -> Unit)? = null
+
+ suspend fun checkIfGooglePayAvailable(): Result {
+
+ val isReadyToPayJson = GooglePayUtil.isReadyToPayRequest() ?: return Result.success(false)
+ val request = IsReadyToPayRequest.fromJson(isReadyToPayJson.toString())
+
+ val task = paymentsClient.isReadyToPay(request)
+ return withContext(Dispatchers.IO) {
+ suspendCoroutine { continuation ->
+ task.addOnCompleteListener { completedTask ->
+ try {
+ val result = completedTask.getResult(ApiException::class.java)
+ continuation.resume(Result.success(true))
+ } catch (exception: ApiException) {
+ // Process error
+ Timber.w("isReadyToPay failed: $exception")
+ continuation.resume(Result.failure(exception))
+ }
+ }
+ }
+ }
+ }
+
+ fun payWithGooglePay(totalPriceCents: String, currencyCode: String, merchantID: String) {
+ val paymentDataRequestJson = GooglePayUtil.getPaymentDataRequest(
+ totalPriceCents,
+ currencyCode = currencyCode,
+ countryCode = "RU",
+ merchantID = merchantID
+ )
+ if (paymentDataRequestJson == null) {
+ Timber.e("RequestPayment: can't fetch payment data request")
+ return
+ }
+ val request = PaymentDataRequest.fromJson(paymentDataRequestJson.toString())
+
+ AutoResolveHelper.resolveTask(
+ paymentsClient.loadPaymentData(request), activity, LOAD_PAYMENT_DATA_REQUEST_CODE
+ )
+ }
+
+ fun handleResponseFromGooglePay(resultCode: Int, data: Intent?): Result {
+ val result = when (resultCode) {
+ RESULT_OK -> {
+ val paymentData = data?.let { intent -> PaymentData.getFromIntent(intent) }
+ if (paymentData == null) {
+ Result.failure(Exception("No payment data"))
+ } else {
+ Result.success(paymentData)
+ }
+ }
+ RESULT_CANCELED -> {
+ Result.failure(TangemSdkError.UserCancelled())
+ }
+ AutoResolveHelper.RESULT_ERROR -> {
+ val statusCode = AutoResolveHelper.getStatusFromIntent(data)?.statusCode
+ if (statusCode == null) {
+ Result.failure(Exception("Unknown Status"))
+ } else {
+ Result.failure(Exception("$statusCode"))
+ }
+
+ }
+ else -> Result.failure(Exception("Unknown Status"))
+ }
+// responseCallback?.invoke(result)
+ return result
+ }
+
+ fun parsePaymentData(paymentData: PaymentData): GooglePayResponse? {
+ val paymentInformation = paymentData.toJson()
+
+ try {
+ // Token will be null if PaymentDataRequest was not constructed using fromJson(String).
+ val paymentMethodData =
+ JSONObject(paymentInformation).getJSONObject("paymentMethodData")
+ val addressJson = paymentMethodData.getJSONObject("info")
+ .getJSONObject("billingAddress")
+
+ val address = Address(
+ name = addressJson.getString("name"),
+ postalCode = addressJson.getString("postalCode"),
+ countryCode = addressJson.getString("countryCode"),
+ phoneNumber = addressJson.getString("phoneNumber"),
+ address1 = addressJson.getString("address1"),
+ address2 = addressJson.getString("address2"),
+ address3 = addressJson.getString("address3"),
+ locality = addressJson.getString("locality"),
+ administrativeArea = addressJson.getString("administrativeArea"),
+ sortingCode = addressJson.getString("sortingCode"),
+ )
+
+ val token = paymentMethodData
+ .getJSONObject("tokenizationData")
+ .getString("token")
+
+ return GooglePayResponse(address, token)
+
+ } catch (e: JSONException) {
+ Log.e("handlePaymentSuccess", "Error: " + e.toString())
+ }
+ return null
+ }
+
+ companion object {
+ const val LOAD_PAYMENT_DATA_REQUEST_CODE = 315
+ }
+}
+
+data class GooglePayResponse(
+ val billingAddress: Address,
+ val token: String,
+)
+
+data class Address(
+ val name: String,
+ val postalCode: String,
+ val countryCode: String,
+ val phoneNumber: String,
+ val address1: String,
+ val address2: String,
+ val address3: String,
+ val locality: String,
+ val administrativeArea: String,
+ val sortingCode: String
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/googlepay/GooglePayUtil.kt b/app/src/main/java/com/tangem/tap/common/shop/googlepay/GooglePayUtil.kt
new file mode 100644
index 0000000000..610ab10c9d
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/googlepay/GooglePayUtil.kt
@@ -0,0 +1,137 @@
+package com.tangem.tap.common.shop.googlepay
+
+import android.app.Activity
+import com.google.android.gms.wallet.PaymentsClient
+import com.google.android.gms.wallet.Wallet
+import com.google.android.gms.wallet.WalletConstants
+import org.json.JSONArray
+import org.json.JSONException
+import org.json.JSONObject
+
+object GooglePayUtil {
+ private val baseRequest = JSONObject().apply {
+ put("apiVersion", 2)
+ put("apiVersionMinor", 0)
+ }
+
+ private fun gatewayTokenizationSpecification(merchantID: String): JSONObject {
+ return JSONObject().apply {
+ put("type", "PAYMENT_GATEWAY")
+ put(
+ "parameters", JSONObject(
+ mapOf(
+ "gateway" to "shopify",
+ "gatewayMerchantId" to merchantID
+ )
+ )
+ )
+ }
+ }
+
+ private val allowedCardNetworks = JSONArray(
+ listOf(
+ "AMEX",
+ "DISCOVER",
+ "INTERAC",
+ "JCB",
+ "MASTERCARD",
+ "VISA"
+ )
+ )
+
+ private val allowedCardAuthMethods = JSONArray(
+ listOf(
+ "PAN_ONLY",
+ "CRYPTOGRAM_3DS"
+ )
+ )
+
+ private fun baseCardPaymentMethod(): JSONObject {
+ return JSONObject().apply {
+
+ val parameters = JSONObject().apply {
+ put("allowedAuthMethods", allowedCardAuthMethods)
+ put("allowedCardNetworks", allowedCardNetworks)
+ put("billingAddressRequired", true)
+ put("billingAddressParameters", JSONObject().apply {
+ put("format", "FULL")
+ })
+ }
+
+ put("type", "CARD")
+ put("parameters", parameters)
+ }
+ }
+
+ private fun cardPaymentMethod(merchantID: String): JSONObject {
+ val cardPaymentMethod = baseCardPaymentMethod()
+ cardPaymentMethod.put("tokenizationSpecification", gatewayTokenizationSpecification(merchantID))
+
+ return cardPaymentMethod
+ }
+
+ fun createPaymentsClient(activity: Activity): PaymentsClient {
+ val walletOptions = Wallet.WalletOptions.Builder()
+ .setEnvironment(PAYMENTS_ENVIRONMENT)
+ .build()
+
+ return Wallet.getPaymentsClient(activity, walletOptions)
+ }
+
+ fun isReadyToPayRequest(): JSONObject? {
+ return try {
+ baseRequest.apply {
+ put("allowedPaymentMethods", JSONArray().put(baseCardPaymentMethod()))
+ }
+
+ } catch (e: JSONException) {
+ null
+ }
+ }
+
+ private fun getTransactionInfo(
+ price: String,
+ countryCode: String,
+ currencyCode: String
+ ): JSONObject {
+ return JSONObject().apply {
+ put("totalPrice", price)
+ put("totalPriceStatus", "FINAL")
+ put("countryCode", countryCode)
+ put("currencyCode", currencyCode)
+ }
+ }
+
+ private val merchantInfo: JSONObject =
+ JSONObject().put("merchantName", "Example Merchant")
+
+
+ fun getPaymentDataRequest(
+ price: String,
+ countryCode: String,
+ currencyCode: String,
+ merchantID: String
+ ): JSONObject? {
+ try {
+ return baseRequest.apply {
+ put("allowedPaymentMethods", JSONArray().put(cardPaymentMethod(merchantID)))
+ put("transactionInfo", getTransactionInfo(price, countryCode, currencyCode))
+ put("merchantInfo", merchantInfo)
+
+ // An optional shipping address requirement is a top-level property of the
+ // PaymentDataRequest JSON object.
+ val shippingAddressParameters = JSONObject().apply {
+ put("phoneNumberRequired", false)
+// put("allowedCountryCodes", JSONArray(listOf("US", "GB")))
+ }
+ put("shippingAddressParameters", shippingAddressParameters)
+ put("shippingAddressRequired", true)
+ }
+ } catch (e: JSONException) {
+ return null
+ }
+ }
+}
+
+
+const val PAYMENTS_ENVIRONMENT = WalletConstants.ENVIRONMENT_TEST
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/shopify/ShopifyService.kt b/app/src/main/java/com/tangem/tap/common/shop/shopify/ShopifyService.kt
new file mode 100644
index 0000000000..da24d1337d
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/shopify/ShopifyService.kt
@@ -0,0 +1,384 @@
+package com.tangem.tap.common.shop
+
+import android.app.Application
+import com.shopify.buy3.GraphCallResult
+import com.shopify.buy3.GraphClient
+import com.shopify.buy3.RetryHandler
+import com.shopify.buy3.Storefront.*
+import com.shopify.graphql.support.ID
+import com.shopify.graphql.support.Input
+import com.tangem.tap.common.shop.shopify.ShopifyShop
+import com.tangem.tap.common.shop.shopify.data.CheckoutItem
+import com.tangem.tap.common.shop.shopify.data.checkoutFieldsFragment
+import com.tangem.tap.common.shop.shopify.data.collectionFieldsFragment
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+import java.util.concurrent.TimeUnit
+import kotlin.coroutines.resume
+import kotlin.coroutines.suspendCoroutine
+
+
+class ShopifyService(private val application: Application, val shop: ShopifyShop) {
+ val client: GraphClient by lazy { initClient() }
+
+
+ suspend fun getShopName(): Result {
+ val query = query { rootQuery: QueryRootQuery ->
+ rootQuery
+ .shop { shopQuery: ShopQuery ->
+ shopQuery
+ .name()
+ }
+ }
+ return when (val result = queryAsync(query)) {
+ is GraphCallResult.Success -> {
+ val name = result.response.data!!.shop.name
+ Result.success(name)
+ }
+ is GraphCallResult.Failure -> {
+ Result.failure(result.error)
+ }
+ }
+ }
+
+ suspend fun getProducts(collectionTitleFilter: String? = null): Result> {
+ val filter = collectionTitleFilter?.let { "title:\"$it\"" }
+
+ val query = query { rootQuery: QueryRootQuery ->
+ rootQuery
+ .collections(
+ { arg -> arg.first(250).query(filter) },
+ ) { collectionConnectionQuery ->
+ collectionConnectionQuery.collectionFieldsFragment()
+ }
+ }
+ return when (val result = queryAsync(query)) {
+ is GraphCallResult.Success -> {
+ val products = result.response.data!!.collections.edges
+ .map { it.node.products }
+ .flatMap { it.edges }
+ .map { it.node }
+ Result.success(products)
+ }
+ is GraphCallResult.Failure -> {
+ Result.failure(result.error)
+ }
+ }
+ }
+
+ suspend fun checkout(pollUntilOrder: Boolean, checkoutID: ID): Result {
+
+ val query = query { rootQuery: QueryRootQuery ->
+ rootQuery
+ .node(checkoutID) { query ->
+ query.onCheckout { checkoutQuery ->
+ with(checkoutQuery) {
+ checkoutFieldsFragment()
+ }
+ }
+ }
+ }
+ val retryHandler = RetryHandler.build(
+ 1, TimeUnit.SECONDS
+ ) {
+ this.retryWhen { result ->
+ when (result) {
+ is GraphCallResult.Success -> {
+ val checkout = result.response.data?.node as? Checkout
+ checkout == null
+ }
+ is GraphCallResult.Failure -> false
+ }
+ }
+ }
+
+ val result = if (pollUntilOrder) queryAsync(query, retryHandler) else queryAsync(query)
+ return when (result) {
+ is GraphCallResult.Success -> {
+ val checkout = result.response.data!!.node as? Checkout
+ if (checkout != null) {
+ Result.success(checkout)
+ } else {
+ Result.failure(ShopifyError.Unknown)
+ }
+
+ }
+ is GraphCallResult.Failure -> {
+ Result.failure(result.error)
+ }
+ }
+ }
+
+ suspend fun createCheckout(
+ checkoutItems: List,
+ checkoutID: ID? = null
+ ): Result {
+
+
+ val storefrontLineItems: MutableList = checkoutItems
+ .map { CheckoutLineItemInput(it.quantity, it.id) }.toMutableList()
+
+ val query = if (checkoutID != null) {
+ mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutLineItemsReplace(
+ storefrontLineItems, checkoutID
+ ) { payloadQuery: CheckoutLineItemsReplacePayloadQuery ->
+ payloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .userErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ } else {
+ val input = CheckoutCreateInput()
+ .setLineItemsInput(
+ Input.value(storefrontLineItems)
+ )
+ mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutCreate(
+ input
+ ) { payloadQuery: CheckoutCreatePayloadQuery ->
+ payloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .checkoutUserErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ }
+ return runCheckoutMutation(query)
+ }
+
+ suspend fun applyDiscount(discountCode: String, checkoutID: ID): Result {
+ val query = mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutDiscountCodeApplyV2(
+ discountCode, checkoutID
+ ) { payloadQuery: CheckoutDiscountCodeApplyV2PayloadQuery ->
+ payloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .checkoutUserErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ return runCheckoutMutation(query)
+ }
+
+ suspend fun removeDiscount(checkoutID: ID): Result {
+ val query = mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutDiscountCodeRemove(
+ checkoutID
+ ) { payloadQuery: CheckoutDiscountCodeRemovePayloadQuery ->
+ payloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .checkoutUserErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ return runCheckoutMutation(query)
+ }
+
+ suspend fun updateAddress(
+ address: MailingAddress,
+ checkoutID: ID,
+ waitForShippingRates: Boolean
+ ): Result {
+ val input = MailingAddressInput()
+ .setAddress1(address.address1)
+ .setAddress2(address.address2)
+ .setCity(address.city)
+ .setCountry(address.country)
+ .setFirstName(address.firstName)
+ .setLastName(address.lastName)
+ .setPhone(address.phone)
+ .setProvince(address.province)
+ .setZip(address.zip)
+
+ val query = mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutShippingAddressUpdateV2(
+ input, checkoutID
+ ) { shippingAddressUpdatePayloadQuery: CheckoutShippingAddressUpdateV2PayloadQuery ->
+ shippingAddressUpdatePayloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .checkoutUserErrors { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+
+ return runCheckoutMutation(query)
+ }
+
+ suspend fun updateEmail(email: String?, checkoutID: ID): Result {
+ val query = mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutEmailUpdateV2(
+ checkoutID, email
+ ) { emailUpdatePayloadQuery: CheckoutEmailUpdateV2PayloadQuery ->
+ emailUpdatePayloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .checkoutUserErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ return runCheckoutMutation(query)
+ }
+
+ suspend fun updateShippingRate(handle: String?, checkoutID: ID): Result {
+ val query = mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutShippingLineUpdate(
+ checkoutID, handle
+ ) { shippingLineUpdatePayloadQuery: CheckoutShippingLineUpdatePayloadQuery ->
+ shippingLineUpdatePayloadQuery
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery.checkoutFieldsFragment()
+ }
+ .checkoutUserErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ return runCheckoutMutation(query)
+ }
+
+ suspend fun completeWithTokenizedPayment(
+ payment: TokenizedPaymentInputV3,
+ checkoutID: ID
+ ): Result {
+
+ val query = mutation { mutationQuery: MutationQuery ->
+ mutationQuery
+ .checkoutCompleteWithTokenizedPaymentV3(
+ checkoutID, payment
+ ) { payloadQuery: CheckoutCompleteWithTokenizedPaymentV3PayloadQuery ->
+ payloadQuery
+ .payment { paymentQuery: PaymentQuery ->
+ paymentQuery
+ .ready()
+ .errorMessage()
+ }
+ .checkout { checkoutQuery: CheckoutQuery ->
+ checkoutQuery
+ .ready()
+ }
+ .checkoutUserErrors() { userErrorQuery: CheckoutUserErrorQuery ->
+ userErrorQuery
+ .field()
+ .message()
+ }
+ }
+ }
+ return runCheckoutMutation(query)
+ }
+
+ fun startGooglePaySession() {
+// PaySession()
+ }
+
+ private suspend fun runCheckoutMutation(mutation: MutationQuery): Result {
+ return when (val result = mutationQueryAsync(mutation)) {
+ is GraphCallResult.Success -> {
+ val checkout = result.response.data!!.checkoutCreate?.checkout
+ ?: result.response.data!!.checkoutDiscountCodeApplyV2?.checkout
+ ?: result.response.data!!.checkoutDiscountCodeRemove?.checkout
+ ?: result.response.data!!.checkoutShippingAddressUpdateV2?.checkout
+ ?: result.response.data!!.checkoutEmailUpdateV2?.checkout
+ ?: result.response.data!!.checkoutShippingLineUpdate?.checkout
+ ?: result.response.data!!.checkoutCompleteWithTokenizedPaymentV3.checkout
+
+ Result.success(checkout)
+ }
+ is GraphCallResult.Failure -> Result.failure(result.error)
+ }
+ }
+
+ private suspend fun queryAsync(
+ query: QueryRootQuery,
+ retryHandler: RetryHandler
+ ): GraphCallResult =
+ withContext(Dispatchers.IO) {
+ suspendCoroutine { continuation ->
+ client.queryGraph(query).enqueue(retryHandler = retryHandler) { result ->
+ continuation.resume(result)
+ }
+ }
+ }
+
+ private suspend fun queryAsync(
+ query: QueryRootQuery,
+ ): GraphCallResult =
+ withContext(Dispatchers.IO) {
+ suspendCoroutine { continuation ->
+ client.queryGraph(query).enqueue { result ->
+ continuation.resume(result)
+ }
+ }
+ }
+
+ private suspend fun mutationQueryAsync(query: MutationQuery): GraphCallResult =
+ withContext(Dispatchers.IO) {
+ suspendCoroutine { continuation ->
+ client.mutateGraph(query).enqueue { result ->
+ continuation.resume(result)
+ }
+ }
+ }
+
+
+ private fun initClient(): GraphClient {
+ return GraphClient.build(
+ application,
+ shop.domain,
+ shop.storefrontApiKey
+ ) {
+// httpCache(application.filesDir) {
+// cacheMaxSizeBytes = (1024 * 1024 * 10)
+// defaultCachePolicy =
+// HttpCachePolicy.Default.CACHE_FIRST.expireAfter(20, TimeUnit.MINUTES)
+// }
+ }
+
+ }
+}
+
+
+sealed class ShopifyError : Throwable() {
+ object Unknown : ShopifyError()
+ object GooglePayFailed : ShopifyError()
+ class UserError(val errorMessage: String)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/shopify/ShopifyShop.kt b/app/src/main/java/com/tangem/tap/common/shop/shopify/ShopifyShop.kt
new file mode 100644
index 0000000000..5fde9c60ff
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/shopify/ShopifyShop.kt
@@ -0,0 +1,10 @@
+package com.tangem.tap.common.shop.shopify
+
+import com.squareup.moshi.JsonClass
+
+@JsonClass(generateAdapter = true)
+data class ShopifyShop(
+ val domain: String,
+ val storefrontApiKey: String,
+ val merchantID: String,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/shopify/data/Checkout.kt b/app/src/main/java/com/tangem/tap/common/shop/shopify/data/Checkout.kt
new file mode 100644
index 0000000000..849c1f33c3
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/shopify/data/Checkout.kt
@@ -0,0 +1,134 @@
+package com.tangem.tap.common.shop.shopify.data
+
+import com.shopify.buy3.Storefront
+
+fun Storefront.CheckoutQuery.checkoutFieldsFragment() {
+ // id()
+ ready()
+ webUrl()
+ currencyCode()
+ lineItemsSubtotalPrice { it.amount() }
+ totalPriceV2 {
+ it.currencyCode()
+ it.amount() }
+ lineItems({ arg -> arg.first(250) }) {
+ it.edges {
+ it.node {
+// it.id()
+ it.title()
+ it.quantity()
+ it.variant() {
+ it.priceV2() { it.amount() }
+ }
+ }
+ }
+ }
+ shippingLine {
+ it.handle()
+ it.title()
+ it.priceV2 { it.amount() }
+ }
+ availableShippingRates {
+ it.ready()
+ it.shippingRates {
+ it.handle()
+ it.title()
+ it.priceV2 { it.amount() }
+ }
+ }
+ shippingAddress {
+ it.address1()
+ it.address2()
+ it.city()
+// .company()
+ it.country()
+// .countryCodeV2()
+ it.firstName()
+// .formatted()
+// .formattedArea()
+// .id()
+ it.lastName()
+// .latitude()
+// .longitude()
+// .name()
+ it.phone()
+ it.province()
+// .provinceCode()
+ it.zip()
+ }
+ discountApplications({ arg -> arg.first(250) }) {
+ it.edges {
+ it.node {
+ it.onDiscountCodeApplication {
+ it.code()
+// .applicable()
+// .allocationMethod()
+// .targetSelection()
+// .targetType()
+ it.value {
+ it.onMoneyV2 {
+ it.amount()
+ }
+ it.onPricingPercentageValue {
+ it.percentage()
+ }
+ }
+ }
+ }
+ }
+ }
+ order {
+ it.cancelReason()
+ it.canceledAt()
+ it.currencyCode()
+// .currentSubtotalPrice()
+// .currentTotalDuties()
+// .currentTotalPrice()
+// .currentTotalTax()
+ it.customerLocale()
+ it.customerUrl()
+// .discountApplications()
+ it.edited()
+ it.email()
+ it.financialStatus()
+ it.fulfillmentStatus()
+// .id()
+// .lineItems()
+// .metafield()
+// .metafields()
+ it.name()
+ it.orderNumber()
+// .originalTotalDuties()
+// .originalTotalPrice()
+ it.phone()
+ it.processedAt()
+ it.shippingAddress {
+ it.address1()
+ it.address2()
+ it.city()
+ it.company()
+ it.country()
+ it.countryCodeV2()
+ it.firstName()
+ it.formatted()
+ it.formattedArea()
+// .id()
+ it.lastName()
+ it.latitude()
+ it.longitude()
+ it.name()
+ it.phone()
+ it.province()
+ it.provinceCode()
+ it.zip()
+ }
+// .shippingDiscountAllocations()
+ it.statusUrl()
+// .subtotalPriceV2()
+// .successfulFulfillments()
+// .totalPriceV2()
+// .totalRefundedV2()
+// .totalShippingPriceV2()
+// .totalTaxV2()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/shopify/data/CheckoutItem.kt b/app/src/main/java/com/tangem/tap/common/shop/shopify/data/CheckoutItem.kt
new file mode 100644
index 0000000000..5dc508df40
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/shopify/data/CheckoutItem.kt
@@ -0,0 +1,8 @@
+package com.tangem.tap.common.shop.shopify.data
+
+import com.shopify.graphql.support.ID
+
+data class CheckoutItem(
+ val id: ID,
+ val quantity: Int
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/common/shop/shopify/data/Collection.kt b/app/src/main/java/com/tangem/tap/common/shop/shopify/data/Collection.kt
new file mode 100644
index 0000000000..572a7b68c7
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/common/shop/shopify/data/Collection.kt
@@ -0,0 +1,50 @@
+package com.tangem.tap.common.shop.shopify.data
+
+import com.shopify.buy3.Storefront
+
+fun Storefront.CollectionConnectionQuery.collectionFieldsFragment() {
+ edges { collectionEdgeQuery ->
+ collectionEdgeQuery
+ .node { collectionQuery ->
+ collectionQuery
+ .title()
+ .products({ arg -> arg.first(250) }
+ ) { productConnectionQuery ->
+ productConnectionQuery
+ .edges { productEdgeQuery ->
+ productEdgeQuery
+ .node { productQuery ->
+ productQuery.title()
+ .productType()
+ .description()
+ .variants({ arg -> arg.first(10) }) { variantConnectionQuery ->
+ variantConnectionQuery.edges { variantQuery ->
+ variantQuery.node {
+ it.title()
+ it.sku()
+ it.currentlyNotInStock()
+ it.priceV2 {
+ it.amount()
+ it.currencyCode()
+ }
+ it.compareAtPriceV2 {
+ it.amount()
+ it.currencyCode()
+ }
+ it.compareAtPriceV2 {
+ it.amount()
+ }
+ it.product {
+ it.title()
+ .productType()
+ .description()
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/domain/configurable/config/ConfigManager.kt b/app/src/main/java/com/tangem/tap/domain/configurable/config/ConfigManager.kt
index 412537befb..4324891cae 100644
--- a/app/src/main/java/com/tangem/tap/domain/configurable/config/ConfigManager.kt
+++ b/app/src/main/java/com/tangem/tap/domain/configurable/config/ConfigManager.kt
@@ -2,6 +2,7 @@ package com.tangem.tap.domain.configurable.config
import com.tangem.blockchain.common.BlockchainSdkConfig
import com.tangem.common.extensions.VoidCallback
+import com.tangem.tap.common.shop.shopify.ShopifyShop
import com.tangem.tap.domain.configurable.Loader
/**
@@ -16,7 +17,8 @@ data class Config(
val isSendingToPayIdEnabled: Boolean = true,
val isTopUpEnabled: Boolean = false,
@Deprecated("Not relevant since version 3.23")
- val isCreatingTwinCardsAllowed: Boolean = false
+ val isCreatingTwinCardsAllowed: Boolean = false,
+ val shopify: ShopifyShop? = null
)
class ConfigManager(
@@ -52,10 +54,10 @@ class ConfigManager(
fun resetToDefault(name: String) {
when (name) {
isSendingToPayIdEnabled -> config =
- config.copy(isSendingToPayIdEnabled = defaultConfig.isSendingToPayIdEnabled)
+ config.copy(isSendingToPayIdEnabled = defaultConfig.isSendingToPayIdEnabled)
isTopUpEnabled -> config = config.copy(isTopUpEnabled = defaultConfig.isTopUpEnabled)
isCreatingTwinCardsAllowed -> config =
- config.copy(isCreatingTwinCardsAllowed = defaultConfig.isCreatingTwinCardsAllowed)
+ config.copy(isCreatingTwinCardsAllowed = defaultConfig.isCreatingTwinCardsAllowed)
}
}
@@ -87,6 +89,7 @@ class ConfigManager(
infuraProjectId = values.infuraProjectId
),
appsFlyerDevKey = values.appsFlyerDevKey,
+ shopify = values.shopifyShop,
)
defaultConfig = defaultConfig.copy(
coinMarketCapKey = values.coinMarketCapKey,
@@ -99,6 +102,7 @@ class ConfigManager(
infuraProjectId = values.infuraProjectId
),
appsFlyerDevKey = values.appsFlyerDevKey,
+ shopify = values.shopifyShop,
)
}
diff --git a/app/src/main/java/com/tangem/tap/domain/configurable/config/JsonModels.kt b/app/src/main/java/com/tangem/tap/domain/configurable/config/JsonModels.kt
index edbbf6345c..c82d448e7d 100644
--- a/app/src/main/java/com/tangem/tap/domain/configurable/config/JsonModels.kt
+++ b/app/src/main/java/com/tangem/tap/domain/configurable/config/JsonModels.kt
@@ -1,5 +1,7 @@
package com.tangem.tap.domain.configurable.config
+import com.tangem.tap.common.shop.shopify.ShopifyShop
+
/**
[REDACTED_AUTHOR]
*/
@@ -20,6 +22,7 @@ class ConfigValueModel(
val blockcypherTokens: Set?,
val infuraProjectId: String?,
val appsFlyerDevKey: String,
+ val shopifyShop: ShopifyShop?
)
class ConfigModel(val features: FeatureModel?, val configValues: ConfigValueModel?) {
diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsConfirmFragment.kt b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsConfirmFragment.kt
index 8e6dc116d8..07d0ea9b41 100644
--- a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsConfirmFragment.kt
+++ b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsConfirmFragment.kt
@@ -68,7 +68,7 @@ class DetailsConfirmFragment : Fragment(R.layout.fragment_details_confirm),
}
ConfirmScreenState.LongTap, ConfirmScreenState.AccessCode,
ConfirmScreenState.PassCode -> {
- toolbar.title = getString(R.string.details_row_title_manage_security)
+ toolbar.title = getString(R.string.details_manage_security_title)
tv_warning_description.text = getString(R.string.details_security_management_warning)
btn_confirm.text = getString(R.string.common_save_changes)
btn_confirm.setCompoundDrawablesRelativeWithIntrinsicBounds(
diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt
index acb76789ba..8651dbd9d3 100644
--- a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt
+++ b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt
@@ -125,7 +125,7 @@ class DetailsFragment : Fragment(R.layout.fragment_details), StoreSubscriber) {
@@ -201,43 +205,40 @@ class AdditionalEmailInfo {
}
interface EmailData {
- val subject: String
- val mainMessage: String
+ val subjectResId: Int
+ val mainMessageResId: Int
+
+ fun getDataCollectionMessageResId(): Int = R.string.feedback_data_collection_message
fun prepare(infoHolder: AdditionalEmailInfo) {}
- fun appendDelimiter(builder: StringBuilder) {
- builder.append("----------\n")
- }
-
- fun appendBlankLine(builder: StringBuilder) {
- builder.append("\n")
- }
-
fun createOptionalMessage(infoHolder: AdditionalEmailInfo): String
- fun joinTogether(infoHolder: AdditionalEmailInfo, allowToErasePhoneInfo: Boolean): String {
- val allowToErasePhoneInfoDisclaimer = if (allowToErasePhoneInfo) {
- "Following information is optional. You can erase it if you don’t want to share it.\n\n"
- } else {
- ""
- }
- return "$mainMessage\n\n\n\n" +
- allowToErasePhoneInfoDisclaimer +
- createOptionalMessage(infoHolder)
+ fun joinTogether(context: Context, infoHolder: AdditionalEmailInfo): String {
+ return StringBuilder().apply {
+ append(context.getString(mainMessageResId))
+ append("\n\n\n\n")
+ append(context.getString(getDataCollectionMessageResId()))
+ append(createOptionalMessage(infoHolder))
+ }.toString()
+ }
+
+ companion object {
+ internal fun StringBuilder.appendDelimiter() = append("----------\n")
+ internal fun StringBuilder.appendBlankLine() = append("\n")
}
}
class RateCanBeBetterEmail : EmailData {
- override val subject: String = "My suggestions"
- override val mainMessage: String = "Tell us what functions you are missing, and we will try to help you."
+ override val subjectResId: Int = R.string.feedback_subject_rate_negative
+ override val mainMessageResId: Int = R.string.feedback_preface_rate_negative
override fun createOptionalMessage(infoHolder: AdditionalEmailInfo): String {
val walletInfo = infoHolder.walletsInfo[0]
return StringBuilder().apply {
appendKeyValue("Card ID", infoHolder.cardId)
appendKeyValue("Blockchain", walletInfo.blockchain.fullName)
- appendBlankLine(this)
+ appendBlankLine()
appendKeyValue("Phone model", infoHolder.phoneModel)
appendKeyValue("OS version", infoHolder.osVersion)
appendKeyValue("App version", infoHolder.appVersion)
@@ -246,11 +247,21 @@ class RateCanBeBetterEmail : EmailData {
}
class ScanFailsEmail : EmailData {
- override val subject: String = "Can’t scan a card"
- override val mainMessage: String = "Please tell us what card do you have?"
+
+ override val subjectResId: Int = R.string.feedback_subject_scan_failed
+ override val mainMessageResId: Int = R.string.feedback_preface_scan_failed
+
+ override fun joinTogether(context: Context, infoHolder: AdditionalEmailInfo): String {
+ return StringBuilder().apply {
+ append(context.getString(mainMessageResId))
+ append("\n\n\n\n")
+ append(createOptionalMessage(infoHolder))
+ }.toString()
+ }
+
override fun createOptionalMessage(infoHolder: AdditionalEmailInfo): String {
return StringBuilder().apply {
- appendBlankLine(this)
+ appendBlankLine()
appendKeyValue("Phone model", infoHolder.phoneModel)
appendKeyValue("OS version", infoHolder.osVersion)
appendKeyValue("App version", infoHolder.appVersion)
@@ -259,8 +270,8 @@ class ScanFailsEmail : EmailData {
}
class SendTransactionFailedEmail(private val error: String) : EmailData {
- override val subject: String = "Can’t send a transaction"
- override val mainMessage: String = "Please tell us more about your issue. Every small detail can help."
+ override val subjectResId: Int = R.string.feedback_subject_tx_failed
+ override val mainMessageResId: Int = R.string.feedback_preface_tx_failed
override fun createOptionalMessage(infoHolder: AdditionalEmailInfo): String {
val walletInfo = infoHolder.onSendErrorWalletInfo ?: AdditionalEmailInfo.EmailWalletInfo()
@@ -268,17 +279,17 @@ class SendTransactionFailedEmail(private val error: String) : EmailData {
appendKeyValue("Card ID", infoHolder.cardId)
appendKeyValue("Firmware version", infoHolder.cardFirmwareVersion)
appendKeyValue("Signed hashes", infoHolder.signedHashesCount)
- appendDelimiter(this)
+ appendDelimiter()
appendKeyValue("Blockchain", walletInfo.blockchain.fullName)
appendKeyValue("Host", walletInfo.host)
appendKeyValue("Token", infoHolder.token)
appendKeyValue("Error", error)
- appendDelimiter(this)
+ appendDelimiter()
appendKeyValue("Source address", walletInfo.address)
appendKeyValue("Destination address", infoHolder.destinationAddress)
appendKeyValue("Amount", infoHolder.amount)
appendKeyValue("Fee", infoHolder.fee)
- appendBlankLine(this)
+ appendBlankLine()
appendKeyValue("Phone model", infoHolder.phoneModel)
appendKeyValue("OS version", infoHolder.osVersion)
appendKeyValue("App version", infoHolder.appVersion)
@@ -288,16 +299,16 @@ class SendTransactionFailedEmail(private val error: String) : EmailData {
}
class FeedbackEmail : EmailData {
- override val subject: String
+ override val subjectResId: Int
get() = if (isS2CCard) s2cSubject else tangemSubject
- override val mainMessage: String
+ override val mainMessageResId: Int
get() = if (isS2CCard) s2cMainMessage else tangemMainMessage
- private val tangemSubject = "Tangem feedback"
- private val tangemMainMessage = "Hi support team,"
+ private val tangemSubject: Int = R.string.feedback_subject_support_tangem
+ private val tangemMainMessage: Int = R.string.feedback_preface_support
- private val s2cSubject = "Feedback"
- private val s2cMainMessage = "Hi support team,"
+ private val s2cSubject: Int = R.string.feedback_subject_support
+ private val s2cMainMessage: Int = R.string.feedback_preface_support
private var isS2CCard = false
@@ -312,26 +323,26 @@ class FeedbackEmail : EmailData {
builder.appendKeyValue("Signed hashes", infoHolder.signedHashesCount)
infoHolder.walletsInfo.forEach {
- appendDelimiter(builder)
+ builder.appendDelimiter()
builder.appendKeyValue("Blockchain", it.blockchain.fullName)
builder.appendKeyValue("Host", it.host)
builder.appendKeyValue("Wallet address", it.address)
builder.appendKeyValue("Explorer link", it.explorerLink)
}
- appendBlankLine(builder)
+ builder.appendBlankLine()
infoHolder.tokens.forEach { tokens ->
- appendDelimiter(builder)
+ builder.appendDelimiter()
builder.appendKeyValue("Blockchain", tokens.key.fullName)
builder.appendKeyValue("Tokens", tokens.value.map { "${it.name} - ${it.symbol}" }.toString())
}
- appendDelimiter(builder)
- appendBlankLine(builder)
-
+ builder.appendDelimiter()
+ builder.appendBlankLine()
// appendKeyValue("Outputs count", infoHolder.outputsCount)
builder.appendKeyValue("Phone model", infoHolder.phoneModel)
builder.appendKeyValue("OS version", infoHolder.osVersion)
builder.appendKeyValue("App version", infoHolder.appVersion)
+
return builder.toString()
}
}
diff --git a/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt b/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt
index fb59fee5b6..95eada77e7 100644
--- a/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt
+++ b/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt
@@ -4,7 +4,6 @@ import com.tangem.tap.common.analytics.AnalyticsEvent
import com.tangem.tap.common.analytics.AnalyticsParam
import com.tangem.tap.common.analytics.GetCardSourceParams
import com.tangem.tap.common.entities.IndeterminateProgressButton
-import com.tangem.tap.common.extensions.dispatchOpenUrl
import com.tangem.tap.common.extensions.onCardScanned
import com.tangem.tap.common.extensions.withMainContext
import com.tangem.tap.common.post
@@ -50,7 +49,7 @@ private val homeMiddleware: Middleware = { dispatch, state ->
}
is HomeAction.ReadCard -> handleReadCard()
is HomeAction.GoToShop -> {
- store.dispatchOpenUrl(HomeMiddleware.CARD_SHOP_URI)
+ store.dispatch(NavigationAction.NavigateTo(AppScreen.Shop))
store.state.globalState.analyticsHandlers?.triggerEvent(
event = AnalyticsEvent.GET_CARD,
params = mapOf(AnalyticsParam.SOURCE.param to GetCardSourceParams.WELCOME.param)
diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/AddressInfoBottomSheetDialog.kt b/app/src/main/java/com/tangem/tap/features/onboarding/AddressInfoBottomSheetDialog.kt
index c747e1a745..882158b731 100644
--- a/app/src/main/java/com/tangem/tap/features/onboarding/AddressInfoBottomSheetDialog.kt
+++ b/app/src/main/java/com/tangem/tap/features/onboarding/AddressInfoBottomSheetDialog.kt
@@ -45,7 +45,7 @@ class AddressInfoBottomSheetDialog(
btn_fl_share.setOnClickListener {
store.dispatchShare(data.shareUrl)
}
- tv_recieve_message.text = getQRReceiveMessage(tv_recieve_message.context, stateDialog.currency)
+ tv_receive_message.text = getQRReceiveMessage(tv_receive_message.context, stateDialog.currency)
}
}
diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/OnboardingWalletFragment.kt b/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/OnboardingWalletFragment.kt
index 398ee44b55..d63d66047c 100644
--- a/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/OnboardingWalletFragment.kt
+++ b/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/OnboardingWalletFragment.kt
@@ -32,7 +32,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
StoreSubscriber, FragmentOnBackPressedHandler {
private var accessCodeDialog: AccessCodeDialog? = null
- private lateinit var cardsWidget: BackupCardsWidget
+ private lateinit var cardsWidget: WalletCardsWidget
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -48,7 +48,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
super.onViewCreated(view, savedInstanceState)
val leapfrog = LeapfrogWidget(fl_cards_container)
- cardsWidget = BackupCardsWidget(leapfrog) { 200f }
+ cardsWidget = WalletCardsWidget(leapfrog) { 200f }
startPostponedEnterTransition()
view_pager_backup_info.adapter = BackupInfoAdapter()
diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/BackupCardsWidget.kt b/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/WalletCardsWidget.kt
similarity index 99%
rename from app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/BackupCardsWidget.kt
rename to app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/WalletCardsWidget.kt
index 1b4ecba2a7..0efdbf3d0b 100644
--- a/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/BackupCardsWidget.kt
+++ b/app/src/main/java/com/tangem/tap/features/onboarding/products/wallet/ui/WalletCardsWidget.kt
@@ -10,7 +10,7 @@ import com.tangem.tangem_sdk_new.ui.widget.leapfrogWidget.LeapView
import com.tangem.tangem_sdk_new.ui.widget.leapfrogWidget.LeapViewState
import com.tangem.tangem_sdk_new.ui.widget.leapfrogWidget.LeapfrogWidget
-class BackupCardsWidget(
+class WalletCardsWidget(
val leapfrogWidget: LeapfrogWidget,
val getTopOfAnchorViewForActivateState: () -> Float,
) {
diff --git a/app/src/main/java/com/tangem/tap/features/shop/redux/ShopAction.kt b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopAction.kt
new file mode 100644
index 0000000000..9f7e7937b4
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopAction.kt
@@ -0,0 +1,38 @@
+package com.tangem.tap.features.shop.redux
+
+import android.content.Intent
+import com.tangem.tap.common.shop.GooglePayService
+import com.tangem.tap.common.shop.data.ProductType
+import com.tangem.tap.common.shop.data.TangemProduct
+import org.rekotlin.Action
+
+sealed class ShopAction : Action {
+
+ object LoadProducts : ShopAction() {
+ data class Success(val products: List) : ShopAction()
+ }
+
+ data class ApplyPromoCode(val promoCode: String) : ShopAction() {
+ data class Success(val promoCode: String?, val products: List) : ShopAction()
+ object InvalidPromoCode : ShopAction()
+ }
+
+ object BuyWithGooglePay : ShopAction() {
+ object UserCancelled : ShopAction()
+ data class HandleGooglePayResponse(val resultCode: Int, val data: Intent?) : ShopAction()
+
+ data class Failure(val exception: Throwable) : ShopAction()
+ object Success : ShopAction()
+ }
+
+ object StartWebCheckout : ShopAction()
+
+ data class CheckIfGooglePayAvailable(val googlePayService: GooglePayService) : ShopAction() {
+ object Success : ShopAction()
+ object Failure : ShopAction()
+ }
+
+ data class SelectProduct(val productType: ProductType) : ShopAction()
+
+ object ResetState : ShopAction()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/features/shop/redux/ShopMiddleware.kt b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopMiddleware.kt
new file mode 100644
index 0000000000..605d5fe9d2
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopMiddleware.kt
@@ -0,0 +1,116 @@
+package com.tangem.tap.features.shop.redux
+
+import com.tangem.tap.common.extensions.dispatchOnMain
+import com.tangem.tap.common.extensions.dispatchOpenUrl
+import com.tangem.tap.common.redux.AppState
+import com.tangem.tap.common.redux.navigation.AppScreen
+import com.tangem.tap.common.redux.navigation.NavigationAction
+import com.tangem.tap.scope
+import com.tangem.tap.shopService
+import com.tangem.tap.store
+import kotlinx.coroutines.launch
+import org.rekotlin.Action
+import org.rekotlin.Middleware
+
+class ShopMiddleware {
+
+ val shopMiddleware: Middleware = { dispatch, state ->
+ { next ->
+ { action ->
+ handle(action)
+ next(action)
+ }
+ }
+ }
+}
+
+private fun handle(action: Action) {
+
+ val shopState = store.state.shopState
+
+ if (action is NavigationAction.NavigateTo && action.screen == AppScreen.Shop) {
+ store.dispatch(ShopAction.LoadProducts)
+ }
+
+ if (action !is ShopAction) return
+
+ when (action) {
+ is ShopAction.ApplyPromoCode -> {
+ scope.launch {
+ if (action.promoCode.isBlank() && shopState.promoCode == null) {
+ store.dispatchOnMain(ShopAction.ApplyPromoCode.InvalidPromoCode)
+ return@launch
+ }
+
+ val result = shopService.applyPromoCode(action.promoCode)
+
+ result.onSuccess { products ->
+ store.dispatchOnMain(
+ ShopAction.ApplyPromoCode.Success(
+ promoCode = products.first { it.type == shopState.selectedProduct }.appliedDiscount,
+ products = products
+ )
+ )
+ }
+ result.onFailure { store.dispatchOnMain(ShopAction.ApplyPromoCode.InvalidPromoCode) }
+ }
+ }
+ ShopAction.BuyWithGooglePay -> {
+ shopService.buyWithGooglePay(shopState.selectedProduct)
+// shopService.subscribeToGooglePayResult(productType = shopState.selectedProduct) { result ->
+// result.onSuccess {
+// store.dispatch(ShopAction.BuyWithGooglePay.Success)
+// }
+// result.onFailure { error ->
+// if (error is TangemSdkError.UserCancelled) {
+// store.dispatch(ShopAction.BuyWithGooglePay.UserCancelled)
+// } else {
+// store.dispatch(ShopAction.BuyWithGooglePay.Failure(error))
+// }
+// }
+// }
+ }
+ is ShopAction.BuyWithGooglePay.HandleGooglePayResponse -> {
+ scope.launch {
+ val result = shopService.handleGooglePayResult(
+ action.resultCode,
+ action.data,
+ shopState.selectedProduct
+ )
+ result.onSuccess {
+ store.dispatchOnMain(ShopAction.BuyWithGooglePay.Success)
+ }
+ result.onFailure {
+ store.dispatchOnMain(ShopAction.BuyWithGooglePay.Failure(it))
+ }
+ }
+
+ }
+ ShopAction.LoadProducts -> {
+ scope.launch {
+ val result = shopService.getProducts()
+ result.onSuccess {
+ store.dispatchOnMain(ShopAction.LoadProducts.Success(it))
+ }
+ }
+ }
+ is ShopAction.CheckIfGooglePayAvailable -> {
+ scope.launch {
+ val isAvailable =
+ shopService.checkIfGooglePayAvailable(action.googlePayService).getOrNull()
+ ?: false
+ val newAction = if (isAvailable) {
+ ShopAction.CheckIfGooglePayAvailable.Success
+ } else {
+ ShopAction.CheckIfGooglePayAvailable.Failure
+ }
+ store.dispatchOnMain(newAction)
+
+ }
+ }
+ ShopAction.StartWebCheckout -> {
+ store.dispatchOpenUrl(shopService.getCheckoutUrl(shopState.selectedProduct))
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/features/shop/redux/ShopReducer.kt b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopReducer.kt
new file mode 100644
index 0000000000..8d4b4ff2a7
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopReducer.kt
@@ -0,0 +1,68 @@
+package com.tangem.tap.features.shop.redux
+
+import org.rekotlin.Action
+
+class ShopReducer {
+ companion object {
+ fun reduce(action: Action, state: ShopState): ShopState = internalReduce(action, state)
+ }
+}
+
+private fun internalReduce(action: Action, state: ShopState): ShopState {
+
+ if (action !is ShopAction) return state
+
+ return when (action) {
+ is ShopAction.ApplyPromoCode -> state.copy(
+ promoCode = action.promoCode,
+ promoCodeLoading = true
+ )
+ ShopAction.BuyWithGooglePay -> state
+ ShopAction.LoadProducts -> state
+ is ShopAction.LoadProducts.Success -> {
+ state.copy(
+ availableProducts = action.products,
+ )
+ }
+ ShopAction.StartWebCheckout -> state
+ ShopAction.ApplyPromoCode.InvalidPromoCode -> state.copy(
+ promoCode = null, promoCodeLoading = false
+ )
+ is ShopAction.ApplyPromoCode.Success -> {
+ state.copy(
+ promoCode = action.promoCode,
+ availableProducts = action.products,
+ promoCodeLoading = false
+
+ )
+ }
+ is ShopAction.SelectProduct -> {
+ state.copy(
+ selectedProduct = action.productType,
+ )
+ }
+ is ShopAction.CheckIfGooglePayAvailable -> {
+ state
+ }
+ ShopAction.CheckIfGooglePayAvailable.Failure -> {
+ state.copy(isGooglePayAvailable = false)
+ }
+ ShopAction.CheckIfGooglePayAvailable.Success -> {
+ state.copy(isGooglePayAvailable = false) // TODO: change when we add support for GPay
+
+ }
+ is ShopAction.BuyWithGooglePay.Failure -> {
+ state
+ }
+ is ShopAction.BuyWithGooglePay.HandleGooglePayResponse -> {
+ state
+ }
+ ShopAction.BuyWithGooglePay.Success -> {
+ state
+ }
+ ShopAction.BuyWithGooglePay.UserCancelled -> {
+ state
+ }
+ ShopAction.ResetState -> ShopState()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/features/shop/redux/ShopState.kt b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopState.kt
new file mode 100644
index 0000000000..a4ead917a3
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/features/shop/redux/ShopState.kt
@@ -0,0 +1,25 @@
+package com.tangem.tap.features.shop.redux
+
+import com.tangem.tap.common.shop.data.ProductType
+import com.tangem.tap.common.shop.data.TangemProduct
+import org.rekotlin.StateType
+
+data class ShopState(
+ val availableProducts: List = emptyList(),
+ val selectedProduct: ProductType = ProductType.WALLET_3_CARDS,
+ val promoCode: String? = null,
+ val promoCodeLoading: Boolean = false,
+ val isGooglePayAvailable: Boolean = false, // TODO: change when we add support for GPay
+) : StateType {
+ val total: String?
+ get() = availableProducts.firstOrNull { it.type == selectedProduct }?.totalSum?.finalValue
+
+ val priceBeforeDiscount: String?
+ get() {
+ val totalSum = availableProducts.firstOrNull { it.type == selectedProduct }?.totalSum
+ if (totalSum?.finalValue != totalSum?.beforeDiscount) {
+ return totalSum?.beforeDiscount
+ }
+ return null
+ }
+}
diff --git a/app/src/main/java/com/tangem/tap/features/shop/ui/ShopFragment.kt b/app/src/main/java/com/tangem/tap/features/shop/ui/ShopFragment.kt
new file mode 100644
index 0000000000..27a20c0842
--- /dev/null
+++ b/app/src/main/java/com/tangem/tap/features/shop/ui/ShopFragment.kt
@@ -0,0 +1,167 @@
+package com.tangem.tap.features.shop.ui
+
+import android.animation.Animator
+import android.animation.AnimatorListenerAdapter
+import android.content.Context
+import android.os.Bundle
+import android.view.View
+import android.view.View.OnFocusChangeListener
+import android.view.inputmethod.EditorInfo
+import android.view.inputmethod.InputMethodManager
+import androidx.activity.OnBackPressedCallback
+import com.tangem.tap.common.KeyboardObserver
+import com.tangem.tap.common.extensions.show
+import com.tangem.tap.common.redux.navigation.NavigationAction
+import com.tangem.tap.common.shop.data.ProductType
+import com.tangem.tap.features.BaseStoreFragment
+import com.tangem.tap.features.shop.redux.ShopAction
+import com.tangem.tap.features.shop.redux.ShopState
+import com.tangem.tap.store
+import com.tangem.wallet.R
+import kotlinx.android.synthetic.main.fragment_shop.*
+import org.rekotlin.StoreSubscriber
+
+
+class ShopFragment : BaseStoreFragment(R.layout.fragment_shop), StoreSubscriber {
+
+
+ override fun subscribeToStore() {
+ store.subscribe(this) { state ->
+ state.skipRepeats { oldState, newState ->
+ oldState.shopState == newState.shopState
+ }.select { it.shopState }
+ }
+ storeSubscribersList.add(this)
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ activity?.onBackPressedDispatcher?.addCallback(this, object : OnBackPressedCallback(true) {
+ override fun handleOnBackPressed() {
+ store.dispatch(NavigationAction.PopBackTo())
+ store.dispatch(ShopAction.ResetState)
+ }
+ })
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ setupCardsImages()
+ setupProductSelection()
+ setupPromoCodeEditText()
+
+ toolbar.setNavigationOnClickListener {
+ requireActivity().onBackPressed()
+ }
+
+
+ val keyboardObserver = KeyboardObserver(requireActivity())
+ keyboardObserver.registerListener { isVisible ->
+ fl_cards.show(!isVisible)
+ }
+ }
+
+ private fun setupCardsImages() {
+ imv_second.animate()
+ .translationY(70f)
+ .scaleX(0.9f)
+ .scaleY(0.9f)
+ .start()
+ imv_third.animate()
+ .translationY(140f)
+ .scaleX(0.8f)
+ .scaleY(0.8f)
+ .start()
+ }
+
+ private fun setupProductSelection() {
+ chip_product_1.setOnCheckedChangeListener { _, isChecked ->
+ if (isChecked) store.dispatch(ShopAction.SelectProduct(ProductType.WALLET_3_CARDS))
+ }
+ chip_product_2.setOnCheckedChangeListener { _, isChecked ->
+ if (isChecked) store.dispatch(ShopAction.SelectProduct(ProductType.WALLET_2_CARDS))
+ }
+ }
+
+ private fun setupPromoCodeEditText() {
+ et_promo_code.setOnEditorActionListener { view, actionId, event ->
+ if (actionId == EditorInfo.IME_ACTION_DONE) {
+ val imm: InputMethodManager =
+ requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
+ imm.hideSoftInputFromWindow(view.windowToken, 0)
+ view.clearFocus()
+ return@setOnEditorActionListener true
+ }
+ return@setOnEditorActionListener false
+ }
+
+ et_promo_code.onFocusChangeListener = OnFocusChangeListener { _, hasFocus ->
+ if (!hasFocus) {
+ store.dispatch(ShopAction.ApplyPromoCode(et_promo_code.text.toString()))
+ }
+ }
+ }
+
+ override fun newState(state: ShopState) {
+ if (activity == null) return
+
+ animateProductSelection(state.selectedProduct)
+ handlePriceState(state)
+ handlePromoCodeState(state)
+ handleButtonsState(state)
+ }
+
+ private fun animateProductSelection(selectedProduct: ProductType) {
+ val show = when (selectedProduct) {
+ ProductType.WALLET_2_CARDS -> false
+ ProductType.WALLET_3_CARDS -> true
+ }
+ showOrHideThirdCardWithAnimation(show)
+ }
+
+ private fun showOrHideThirdCardWithAnimation(show: Boolean) {
+ val translationY = if (show) 140f else 0f
+ if (show) imv_third.show()
+ imv_third.animate()
+ .translationY(translationY)
+ .setListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationEnd(animation: Animator) {
+ super.onAnimationEnd(animation)
+ imv_third?.show(show)
+ }
+ })
+ }
+
+ private fun handlePriceState(state: ShopState) {
+ tv_total.text = state.total
+ tv_total_before_discount.text = state.priceBeforeDiscount
+
+ pb_price.show(state.total == null)
+
+ }
+
+ private fun handlePromoCodeState(state: ShopState) {
+ if (state.promoCode == null && !et_promo_code.hasFocus()) {
+ et_promo_code.setText("")
+ }
+ pb_promo_code.show(state.promoCodeLoading)
+ }
+
+ private fun handleButtonsState(state: ShopState) {
+ btn_pay_google_pay.show(state.isGooglePayAvailable)
+ btn_alternative_payment.show(state.isGooglePayAvailable)
+ btn_main_action.show(!state.isGooglePayAvailable)
+
+ if (state.total != null) {
+ btn_alternative_payment.setOnClickListener { store.dispatch(ShopAction.StartWebCheckout) }
+ btn_main_action.setOnClickListener { store.dispatch(ShopAction.StartWebCheckout) }
+ btn_pay_google_pay.setOnClickListener { store.dispatch(ShopAction.BuyWithGooglePay) }
+ }
+ }
+
+ override fun handleOnBackPressed() {
+ store.dispatch(ShopAction.ResetState)
+ super.handleOnBackPressed()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/features/tokens/ui/AddTokensFragment.kt b/app/src/main/java/com/tangem/tap/features/tokens/ui/AddTokensFragment.kt
index 178d8d514f..6a2559848e 100644
--- a/app/src/main/java/com/tangem/tap/features/tokens/ui/AddTokensFragment.kt
+++ b/app/src/main/java/com/tangem/tap/features/tokens/ui/AddTokensFragment.kt
@@ -11,6 +11,7 @@ import androidx.appcompat.widget.SearchView
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.transition.TransitionInflater
+import com.tangem.tap.common.extensions.getString
import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.features.tokens.redux.TokensAction
import com.tangem.tap.features.tokens.redux.TokensState
@@ -96,7 +97,7 @@ class AddTokensFragment : Fragment(R.layout.fragment_add_tokens),
val menuItem = menu.findItem(R.id.menu_search)
val searchView: SearchView = menuItem.actionView as SearchView
- searchView.queryHint = "Type here to search"
+ searchView.queryHint = searchView.getString(R.string.add_token_search_hint)
searchView.maxWidth = android.R.attr.width
searchView.inputtedTextAsFlow()
.debounce(400)
diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt
index bfd6057d73..f1d99a3053 100644
--- a/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt
+++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt
@@ -23,8 +23,6 @@ import com.tangem.tap.features.wallet.ui.dialogs.AmountToSendDialog
import com.tangem.tap.store
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.fragment_wallet_details.*
-import kotlinx.android.synthetic.main.item_currency_wallet.view.*
-import kotlinx.android.synthetic.main.item_popular_token.view.*
import kotlinx.android.synthetic.main.layout_balance_error.*
import kotlinx.android.synthetic.main.layout_balance_wallet_details.*
import kotlinx.android.synthetic.main.layout_wallet_details.*
@@ -197,7 +195,7 @@ class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), StoreS
requireContext()))
}
iv_qr_code.setImageBitmap(state.walletAddresses.selectedAddress.shareUrl.toQrCode())
- tv_recieve_message.text = getQRReceiveMessage(tv_recieve_message.context, state.currency)
+ tv_receive_message.text = getQRReceiveMessage(tv_receive_message.context, state.currency)
}
}
diff --git a/app/src/main/res/color/selector_chip_shop.xml b/app/src/main/res/color/selector_chip_shop.xml
new file mode 100644
index 0000000000..052f962892
--- /dev/null
+++ b/app/src/main/res/color/selector_chip_shop.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/color/selector_chip_shop_text.xml b/app/src/main/res/color/selector_chip_shop_text.xml
new file mode 100644
index 0000000000..5d5afc33ff
--- /dev/null
+++ b/app/src/main/res/color/selector_chip_shop_text.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable-de/buy_with_googlepay_button_content.xml b/app/src/main/res/drawable-de/buy_with_googlepay_button_content.xml
new file mode 100755
index 0000000000..e1e2577110
--- /dev/null
+++ b/app/src/main/res/drawable-de/buy_with_googlepay_button_content.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable-fr/buy_with_googlepay_button_content.xml b/app/src/main/res/drawable-fr/buy_with_googlepay_button_content.xml
new file mode 100755
index 0000000000..4be47da569
--- /dev/null
+++ b/app/src/main/res/drawable-fr/buy_with_googlepay_button_content.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable-hdpi/card_placeholder_new.png b/app/src/main/res/drawable-hdpi/card_placeholder_new.png
deleted file mode 100644
index 4c9cff9062..0000000000
Binary files a/app/src/main/res/drawable-hdpi/card_placeholder_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable-hdpi/card_placeholder_wallet.9.png b/app/src/main/res/drawable-hdpi/card_placeholder_wallet.9.png
new file mode 100644
index 0000000000..97ea9bc260
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/card_placeholder_wallet.9.png differ
diff --git a/app/src/main/res/drawable-it/buy_with_googlepay_button_content.xml b/app/src/main/res/drawable-it/buy_with_googlepay_button_content.xml
new file mode 100755
index 0000000000..477793d6e5
--- /dev/null
+++ b/app/src/main/res/drawable-it/buy_with_googlepay_button_content.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable-ldpi/card_placeholder_new.png b/app/src/main/res/drawable-ldpi/card_placeholder_new.png
deleted file mode 100644
index e9986ae27f..0000000000
Binary files a/app/src/main/res/drawable-ldpi/card_placeholder_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable-mdpi/card_placeholder_new.png b/app/src/main/res/drawable-mdpi/card_placeholder_new.png
deleted file mode 100644
index b15e1cf3bb..0000000000
Binary files a/app/src/main/res/drawable-mdpi/card_placeholder_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable-mdpi/card_placeholder_wallet.9.png b/app/src/main/res/drawable-mdpi/card_placeholder_wallet.9.png
new file mode 100644
index 0000000000..8a45ec562c
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/card_placeholder_wallet.9.png differ
diff --git a/app/src/main/res/drawable-ru/buy_with_googlepay_button_content.xml b/app/src/main/res/drawable-ru/buy_with_googlepay_button_content.xml
new file mode 100755
index 0000000000..a624bdabf1
--- /dev/null
+++ b/app/src/main/res/drawable-ru/buy_with_googlepay_button_content.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable-xhdpi/card_placeholder_new.png b/app/src/main/res/drawable-xhdpi/card_placeholder_new.png
deleted file mode 100644
index a9f3c750e0..0000000000
Binary files a/app/src/main/res/drawable-xhdpi/card_placeholder_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xhdpi/card_placeholder_wallet.9.png b/app/src/main/res/drawable-xhdpi/card_placeholder_wallet.9.png
new file mode 100644
index 0000000000..ee8fdfd5f2
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/card_placeholder_wallet.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/googlepay_button_background_image.9.png b/app/src/main/res/drawable-xhdpi/googlepay_button_background_image.9.png
new file mode 100755
index 0000000000..40f767d533
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/googlepay_button_background_image.9.png differ
diff --git a/app/src/main/res/drawable-xhdpi/googlepay_button_no_shadow_background_image.9.png b/app/src/main/res/drawable-xhdpi/googlepay_button_no_shadow_background_image.9.png
new file mode 100755
index 0000000000..969cc52a94
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/googlepay_button_no_shadow_background_image.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/card_placeholder_new.png b/app/src/main/res/drawable-xxhdpi/card_placeholder_new.png
deleted file mode 100644
index 0caf7a0d35..0000000000
Binary files a/app/src/main/res/drawable-xxhdpi/card_placeholder_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/card_placeholder_wallet.9.png b/app/src/main/res/drawable-xxhdpi/card_placeholder_wallet.9.png
new file mode 100644
index 0000000000..7483c7232b
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/card_placeholder_wallet.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/googlepay_button_background_image.9.png b/app/src/main/res/drawable-xxhdpi/googlepay_button_background_image.9.png
new file mode 100755
index 0000000000..91035e2a41
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/googlepay_button_background_image.9.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/googlepay_button_no_shadow_background_image.9.png b/app/src/main/res/drawable-xxhdpi/googlepay_button_no_shadow_background_image.9.png
new file mode 100755
index 0000000000..dda66dfd0d
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/googlepay_button_no_shadow_background_image.9.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/card_placeholder_new.png b/app/src/main/res/drawable-xxxhdpi/card_placeholder_new.png
deleted file mode 100644
index 56a6e580f0..0000000000
Binary files a/app/src/main/res/drawable-xxxhdpi/card_placeholder_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxxhdpi/card_placeholder_wallet.9.png b/app/src/main/res/drawable-xxxhdpi/card_placeholder_wallet.9.png
new file mode 100644
index 0000000000..3fb1bc1422
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/card_placeholder_wallet.9.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/googlepay_button_background_image.9.png b/app/src/main/res/drawable-xxxhdpi/googlepay_button_background_image.9.png
new file mode 100755
index 0000000000..ab905289bc
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/googlepay_button_background_image.9.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/googlepay_button_no_shadow_background_image.9.png b/app/src/main/res/drawable-xxxhdpi/googlepay_button_no_shadow_background_image.9.png
new file mode 100755
index 0000000000..e67fdaf516
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/googlepay_button_no_shadow_background_image.9.png differ
diff --git a/app/src/main/res/drawable/buy_with_googlepay_button_content.xml b/app/src/main/res/drawable/buy_with_googlepay_button_content.xml
new file mode 100755
index 0000000000..a893cd0cac
--- /dev/null
+++ b/app/src/main/res/drawable/buy_with_googlepay_button_content.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/googlepay_button_background.xml b/app/src/main/res/drawable/googlepay_button_background.xml
new file mode 100755
index 0000000000..b81005b06f
--- /dev/null
+++ b/app/src/main/res/drawable/googlepay_button_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/googlepay_button_content.xml b/app/src/main/res/drawable/googlepay_button_content.xml
new file mode 100755
index 0000000000..b2cdb1d52b
--- /dev/null
+++ b/app/src/main/res/drawable/googlepay_button_content.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/googlepay_button_no_shadow_background.xml b/app/src/main/res/drawable/googlepay_button_no_shadow_background.xml
new file mode 100755
index 0000000000..9543c4bcb6
--- /dev/null
+++ b/app/src/main/res/drawable/googlepay_button_no_shadow_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/googlepay_button_overlay.xml b/app/src/main/res/drawable/googlepay_button_overlay.xml
new file mode 100755
index 0000000000..70c7a92271
--- /dev/null
+++ b/app/src/main/res/drawable/googlepay_button_overlay.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_clear_24.xml b/app/src/main/res/drawable/ic_clear_24.xml
new file mode 100644
index 0000000000..cd2a842a1f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_clear_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_promo_code.xml b/app/src/main/res/drawable/ic_promo_code.xml
new file mode 100644
index 0000000000..149d59df21
--- /dev/null
+++ b/app/src/main/res/drawable/ic_promo_code.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_shipping.xml b/app/src/main/res/drawable/ic_shipping.xml
new file mode 100644
index 0000000000..b36ffe1bed
--- /dev/null
+++ b/app/src/main/res/drawable/ic_shipping.xml
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/shape_line.xml b/app/src/main/res/drawable/shape_line.xml
new file mode 100644
index 0000000000..cf7b6cfb0f
--- /dev/null
+++ b/app/src/main/res/drawable/shape_line.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_rectangle_rounded_4.xml b/app/src/main/res/drawable/shape_rectangle_rounded_4.xml
new file mode 100644
index 0000000000..b7d03c2907
--- /dev/null
+++ b/app/src/main/res/drawable/shape_rectangle_rounded_4.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/buy_with_googlepay_button.xml b/app/src/main/res/layout/buy_with_googlepay_button.xml
new file mode 100755
index 0000000000..2553181fd8
--- /dev/null
+++ b/app/src/main/res/layout/buy_with_googlepay_button.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_onboarding_address_info.xml b/app/src/main/res/layout/dialog_onboarding_address_info.xml
index 55617e452f..ca04440067 100644
--- a/app/src/main/res/layout/dialog_onboarding_address_info.xml
+++ b/app/src/main/res/layout/dialog_onboarding_address_info.xml
@@ -24,7 +24,7 @@
app:layout_constraintTop_toBottomOf="@+id/pseudo_toolbar" />
+ app:title="@string/add_tokens_title" />
@@ -51,7 +51,7 @@
android:layout_marginBottom="16dp"
android:enabled="false"
android:gravity="center"
- android:text="Save changes"
+ android:text="@string/common_save_changes"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
diff --git a/app/src/main/res/layout/fragment_details.xml b/app/src/main/res/layout/fragment_details.xml
index b6475a8ac3..58ac038846 100644
--- a/app/src/main/res/layout/fragment_details.xml
+++ b/app/src/main/res/layout/fragment_details.xml
@@ -133,32 +133,39 @@
app:layout_constraintTop_toBottomOf="@id/tv_issuer"
tools:text="48 hashes" />
-
-
-
+ app:layout_constraintTop_toBottomOf="@+id/tv_signed_hashes_title">
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/ll_manage_security" />
+ app:title="@string/details_manage_security_title" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_popular_token.xml b/app/src/main/res/layout/item_popular_token.xml
index 3f03f0279f..6b8ad727ed 100644
--- a/app/src/main/res/layout/item_popular_token.xml
+++ b/app/src/main/res/layout/item_popular_token.xml
@@ -79,7 +79,7 @@
+ android:layout_height="120dp">
+ tools:src="@drawable/shape_circle" />
+ tools:text="J" />
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_wallet_details.xml b/app/src/main/res/layout/layout_wallet_details.xml
index 2532441b29..8e33a5cead 100644
--- a/app/src/main/res/layout/layout_wallet_details.xml
+++ b/app/src/main/res/layout/layout_wallet_details.xml
@@ -71,19 +71,15 @@
-
+ app:layout_constraintGuide_percent="0.40" />
+ tools:text="139mrsJgyWnJjkljlkhiuojlkljkjljljlkjlkfsdkdsjflsdkjflsdkjfffffffljlkjkljlkjlkjkljky9BV" />
-
-
-
-
+ app:iconEndPadding="0dp"
+ app:iconStartPadding="12dp"
+ app:layout_constraintEnd_toStartOf="@+id/btn_share"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintHorizontal_chainStyle="packed"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/iv_qr_code" />
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/btn_copy"
+ app:layout_constraintTop_toTopOf="@+id/btn_copy" />
diff --git a/app/src/main/res/layout/layout_wallet_short_buttons.xml b/app/src/main/res/layout/layout_wallet_short_buttons.xml
index 61217164ee..09318739b7 100644
--- a/app/src/main/res/layout/layout_wallet_short_buttons.xml
+++ b/app/src/main/res/layout/layout_wallet_short_buttons.xml
@@ -15,7 +15,9 @@
android:layout_marginBottom="33dp"
android:drawableTop="@drawable/ic_group_1243"
android:gravity="bottom|center_horizontal"
+ android:paddingStart="0dp"
android:paddingTop="7dp"
+ android:paddingEnd="0dp"
android:text="@string/wallet_button_scan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/btn_trade"
diff --git a/app/src/main/res/layout/test_shopify_fragment.xml b/app/src/main/res/layout/test_shopify_fragment.xml
new file mode 100644
index 0000000000..eff6a14884
--- /dev/null
+++ b/app/src/main/res/layout/test_shopify_fragment.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 29e248d8d7..9e6777a914 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -9,8 +9,8 @@
Annuler J\'accepte
- L’accès à la caméra est refusé
- Vous n\'avez pas octroyé l’accès à votre caméra, veuillez modifier vos paramètres de confidentialité
+ L\'accès à la caméra est refusé
+ Vous n\'avez pas octroyé l\'accès à votre caméra, veuillez modifier vos paramètres de confidentialité Paramètres Bienvenue à Tangem. Avez-vous une de nos cartes Encore une fois, bienvenue dans Tangem. \nScannez votre carte pour commencer.
@@ -29,7 +29,7 @@
Solde confirmé Solde est en cours de téléchargement …Blockchain est inaccessible
- Compte n’est pas créé
+ Compte n\'est pas créé Téléchargez %s +%s pour créer un compte Carte vide Créez un portefeuille pour commencer à utiliser votre carte Tangem
@@ -37,7 +37,7 @@
Votre carte Tangem a été créée pour fonctionner avec une autre application. Regardez le nom et les instructions sur votre carte et installez l\'application pertinente Transaction en cours…Envoi\u0020
- jusqu’à %s
+ jusqu\'à %s Réception \u0020de %s Explorer l\'adresse
@@ -80,7 +80,7 @@
Emetteur Signé %s hashes
- Monnaie de l’application
+ Monnaie de l\'application Paramètres Carte Valider la carte
@@ -93,9 +93,9 @@
Ce mécanisme protège contre les attaques sans contact sur la carte. Il y a un délai entre la réception et l\'exécution de la commande. Après la première transaction signée, ce téléphone sera associé à la carte et les transactions seront signées immédiatement.Mot de passe Avant d\'exécuter une commande qui modifie l\'état de la carte, vous devrez entrer un mot de passe.
- Code d’accès
+ Code d\'accès Vous devrez entrer le mot de passe correct avant de scanner la carte
- Vous pouvez rencontrer des problèmes NFC avec certains iPhone 7/7 + lors de l’extraction
+ Vous pouvez rencontrer des problèmes NFC avec certains iPhone 7/7 + lors de l\'extraction Cette carte a déjà été rechargée et a signé des transactions avant. Envisagez la possibilité de retirer tous les fonds immédiatement si vous avez reçu cette carte d\'une source non fiable.AttentionCette carte n\'est pas conçue pour fonctionner avec Tangem
@@ -105,7 +105,7 @@
Appuyez votre carte au téléphone comme indiqué ci-dessus Touchez, pour annuler un portefeuille Touchez, pour créer un portefeuille
- Touchez, pour modifier le code d’accès
+ Touchez, pour modifier le code d\'accès Touchez, pour modifier le mot de passe PayString incorrect
@@ -115,44 +115,44 @@ Avertissement
\n\n1.Application Tangem (Logiciel)
-\n\nLe logiciel est destiné à l\’utilisation exclusivement avec les e-portefeuilles Tangem (Cartes) à l\’aide de l\’interface NFC. Le logiciel NE réalise pas ce qui suit :
+\n\nLe logiciel est destiné à l\'utilisation exclusivement avec les e-portefeuilles Tangem (Cartes) à l\'aide de l\'interface NFC. Le logiciel NE réalise pas ce qui suit :
-\n\na. Génération, stockage, transmission ou octroi d\’accès aux clés privées (confidentiels) de chiffrement des blockchain-portefeuilles, qui contiennent les avoirs numériques, y compris la crypto-monnaie.
-\n\nb. Génération, stockage, transmission ou octroi d\’accès aux clés confidentielles, aux mots de passe, phrases secrètes, phrases de restitution, qui pourront être utilisées pour la restitution ou pour le clonage des clés privées (confidentiels) de chiffrement des blockchain-portefeuilles, contenant les avoirs numériques, y compris la crypto-monnaie.
-\n\nc. Prestation des services de bourse, de commerce, d\’investissement du nom de Tangem AG.
+\n\na. Génération, stockage, transmission ou octroi d\'accès aux clés privées (confidentiels) de chiffrement des blockchain-portefeuilles, qui contiennent les avoirs numériques, y compris la crypto-monnaie.
+\n\nb. Génération, stockage, transmission ou octroi d\'accès aux clés confidentielles, aux mots de passe, phrases secrètes, phrases de restitution, qui pourront être utilisées pour la restitution ou pour le clonage des clés privées (confidentiels) de chiffrement des blockchain-portefeuilles, contenant les avoirs numériques, y compris la crypto-monnaie.
+\n\nc. Prestation des services de bourse, de commerce, d\'investissement du nom de Tangem AG.
-\n\n2. Risques, liés avec l\’utilisation du logiciel
+\n\n2. Risques, liés avec l\'utilisation du logiciel
-\n\nTangem n\’assume aucune responsabilité pour tous les dommages, préjudice ou prétentions, qui peuvent survenir comme résultat des évènements, se rapportant à une de cinq catégories suivantes :
+\n\nTangem n\'assume aucune responsabilité pour tous les dommages, préjudice ou prétentions, qui peuvent survenir comme résultat des évènements, se rapportant à une de cinq catégories suivantes :
-\n\na. Les erreurs, commises par l\’utilisateur de tout logiciel ou service liés avec la crypto-monnaie, par exemple, les mots de passe oubliés, les paiements envoyés aux adresses incorrectes, et élimination occasionnelle des blockchain-portefeuilles sur les Cartes.
-\n\nb. Les problèmes du Logiciel et/ou de tout progiciel ou service liés avec blockchain ou avec la crypto-monnaie, par exemple, les fichiers endommagés, les transaction créées d\’une manière incorrecte, les bibliothèques cryptographiques non sécurisées, les logiciels malveillants.
-\n\nc. Les défaillances techniques du hardware de l\’utilisateur, y compris les Cartes, de tout logiciel ou service liés avec la crypto-monnaie, par exemple, la perte des données à cause des périphériques défectives ou endommagées de stockage.
-\n\nd. Les problèmes de la sécurité, subis par l\’utilisateur de tout logiciel ou service liés avec la crypto-monnaie, par exemple, l\’accès non autorisé aux portefeuilles et/ou comptes des utilisateurs.
-\n\ne. Les actions ou l\’inaction des tierces personnes et/ou les évènements subis par les tierces personnes, par exemple, la faillite du prestataire de services, les attaques sur la sécurité informatique des prestataires de services et la fraude commise par des tierces personnes.
+\n\na. Les erreurs, commises par l\'utilisateur de tout logiciel ou service liés avec la crypto-monnaie, par exemple, les mots de passe oubliés, les paiements envoyés aux adresses incorrectes, et élimination occasionnelle des blockchain-portefeuilles sur les Cartes.
+\n\nb. Les problèmes du Logiciel et/ou de tout progiciel ou service liés avec blockchain ou avec la crypto-monnaie, par exemple, les fichiers endommagés, les transaction créées d\'une manière incorrecte, les bibliothèques cryptographiques non sécurisées, les logiciels malveillants.
+\n\nc. Les défaillances techniques du hardware de l\'utilisateur, y compris les Cartes, de tout logiciel ou service liés avec la crypto-monnaie, par exemple, la perte des données à cause des périphériques défectives ou endommagées de stockage.
+\n\nd. Les problèmes de la sécurité, subis par l\'utilisateur de tout logiciel ou service liés avec la crypto-monnaie, par exemple, l\'accès non autorisé aux portefeuilles et/ou comptes des utilisateurs.
+\n\ne. Les actions ou l\'inaction des tierces personnes et/ou les évènements subis par les tierces personnes, par exemple, la faillite du prestataire de services, les attaques sur la sécurité informatique des prestataires de services et la fraude commise par des tierces personnes.
-\n\n3. Risques commerciales et d\’investissement
+\n\n3. Risques commerciales et d\'investissement
-\n\nToute échange de crypto-monnaie ou d\’autres avoirs numériques implique les risques importants. Toute transaction liée avec la monnaie implique les risques, qui incluent, entre autres, la possibilité de modification des conditions économiques, qui peuvent influencer d\’une manière significative le prix ou la disponibilité de la monnaie. Les investissements dans les spéculations boursières avec les crypto-monnaies peuvent aussi être exposés aux montées et chutes en flèche lors des fluctuations des valeurs marchandes correspondants. C\'est pour cette raison, que lors de la spéculation sur tels marchés, il est conseillé d\’utiliser seulement le capital-risque.
+\n\nToute échange de crypto-monnaie ou d\'autres avoirs numériques implique les risques importants. Toute transaction liée avec la monnaie implique les risques, qui incluent, entre autres, la possibilité de modification des conditions économiques, qui peuvent influencer d\'une manière significative le prix ou la disponibilité de la monnaie. Les investissements dans les spéculations boursières avec les crypto-monnaies peuvent aussi être exposés aux montées et chutes en flèche lors des fluctuations des valeurs marchandes correspondants. C\'est pour cette raison, que lors de la spéculation sur tels marchés, il est conseillé d\'utiliser seulement le capital-risque.
\n\n4. Risques de commerce électronique
-\n\nAvant de passer aux transactions en utilisant le système électronique, Vous devez prendre connaissance, d\’une manière bien attentive, des règles et des dispositions stipulées par les bourses qui offrent ce système, et/ou les listes des titres de placement que vous voulez négocier. Le commerce en ligne possède le risque inaliénable lié avec la vitesse de réponse du système et avec le temps d\’accès qui peuvent varier en fonction des conditions de marché, du rendement du système et d\’autres facteurs. Avant de commencer les négoces, vous devez comprendre ces risques aussi que les risques supplémentaires.
+\n\nAvant de passer aux transactions en utilisant le système électronique, Vous devez prendre connaissance, d\'une manière bien attentive, des règles et des dispositions stipulées par les bourses qui offrent ce système, et/ou les listes des titres de placement que vous voulez négocier. Le commerce en ligne possède le risque inaliénable lié avec la vitesse de réponse du système et avec le temps d\'accès qui peuvent varier en fonction des conditions de marché, du rendement du système et d\'autres facteurs. Avant de commencer les négoces, vous devez comprendre ces risques aussi que les risques supplémentaires.
\n\n5. Respect des obligations fiscales
-\n\nLes utilisateurs du Logiciel assument toute la responsabilité pour définir, quels impôts sont appliqués à leurs transactions avec la crypto-monnaie, au cas où il y a de tels impôts. Les propriétaires et les participants à l\’élaboration du Logiciel n\’assument pas la responsabilité pour la définition des impôts qui sont appliqués aux transactions avec la crypto-monnaie.
+\n\nLes utilisateurs du Logiciel assument toute la responsabilité pour définir, quels impôts sont appliqués à leurs transactions avec la crypto-monnaie, au cas où il y a de tels impôts. Les propriétaires et les participants à l\'élaboration du Logiciel n\'assument pas la responsabilité pour la définition des impôts qui sont appliqués aux transactions avec la crypto-monnaie.
\n\n6. Absence de garanties
-\n\nLe logiciel est concédé sous les conditions « tel quel », sans aucune garantie à l\’égard du Logiciel et/ou de tout le contenu, données, matériaux et/ou services, présentes dans ce Logiciel.
+\n\nLe logiciel est concédé sous les conditions « tel quel », sans aucune garantie à l\'égard du Logiciel et/ou de tout le contenu, données, matériaux et/ou services, présentes dans ce Logiciel.
\n\n7. Restriction de la responsabilité
-\n\nSauf disposition contraire prévue par la législation, les propriétaires et les participants à l\’élaboration du Logiciel n\’assument pas la responsabilité pour aucun dommage, y compris l\’indisponibilité, la perte de profit ou la perte des données, qui surviennent comme résultat de l\’utilisation ou bien qui sont liés d\’une certaine manière avec l\’utilisation du Logiciel. Les propriétaires et les participants à l\’élaboration du Logiciel n\’assument pas la responsabilité pour les actions, les résolutions ou pour une autre conduite que vous manifestez ou pas par l\’intermédiaire du Logiciel.
+\n\nSauf disposition contraire prévue par la législation, les propriétaires et les participants à l\'élaboration du Logiciel n\'assument pas la responsabilité pour aucun dommage, y compris l\'indisponibilité, la perte de profit ou la perte des données, qui surviennent comme résultat de l\'utilisation ou bien qui sont liés d\'une certaine manière avec l\'utilisation du Logiciel. Les propriétaires et les participants à l\'élaboration du Logiciel n\'assument pas la responsabilité pour les actions, les résolutions ou pour une autre conduite que vous manifestez ou pas par l\'intermédiaire du Logiciel.
\n\n8. Dernière modification
@@ -171,14 +171,14 @@ Avertissement
PayString non pris en charge par la blockchainPayString non enregistréLa demande de PayString a échoué
- L’adresse est la même que celle de votre portefeuille
+ L\'adresse est la même que celle de votre portefeuilleSolde insuffisantErreur interne de la blockchainCommission non valideLe montant minimal est de %ыLe reste est trop petit
- L’adresse a été copiée avec succès
- Saisissez d’abord le PayString requis
+ L\'adresse a été copiée avec succès
+ Saisissez d\'abord le PayString requisPosez pour scannerPosez la carteVotre solde sur ce portefeuille n\'est pas nul, ou vous avez des transactions non confirmées. Impossible de supprimer la fonction du portefeuille
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
new file mode 100644
index 0000000000..9581d6c26c
--- /dev/null
+++ b/app/src/main/res/values-ru/strings.xml
@@ -0,0 +1,379 @@
+
+
+ Tangem
+ Нет
+ Сохранить изменения
+ Предупреждение
+ Повторить попытку
+ Готово
+ Отмена
+ Принять
+ %s
+ Доступ к камере запрещен
+ Вы не предоставили доступ к своей камере, измените настройки конфиденциальности.
+ Настройки
+ Добро пожаловать в Tangem.\nУ Вас есть одна из наших карт?
+ Добро пожаловать обратно в Тангем. \nОтсканируйте карту, чтобы начать.
+ Магазин
+ Приготовьтесь приложить свою\nкарту к задней панели\nтелефона.
+ Нажмите на
+ Сканировать карту
+ Да! Отсканировать
+ Сканировать
+ Отправить
+ Создать кошелек
+ Tangem
+ Выбрите опцию
+ Токен
+ Токены
+ Подтвержденный баланс
+ Загрузка баланса…
+ Блокчейн недоступен
+ Аккаунт не создан
+ Загрузите %1$s+ %2$s для создания учетной записи
+ Карта пуста
+ Создайте кошелек, чтобы начать пользоваться картой Tangem
+ Эта карта не поддерживается
+ Ваша карта Tangem предназначена для работы с другим приложением. Пожалуйста, ознакомьтесь с названием и инструкциями на вашей карте и установите правильное приложение.
+ Транзакция в процессе…
+ до %s
+ от %s
+ Получение\u0020
+ Отправка\u0020
+ Посмотреть адрес
+ Создать PayString
+ %s кошелек
+ Создать PayString
+ Карта: %s
+ PayString имя
+ $payid.tangem.com
+ Создать
+ Ваша PayString — это уникальная для вас информация, такая как номер телефона, электронная почта или ABN.
+ PayString успешно создан и скопирован в буфер обмена
+ Ошибка при создании PayString
+ Такой PayString уже существует. Попробуйте другой.
+ Адрес или PayString
+ Адрес
+ Отправить
+ Комиссия сети
+ Сумма
+ Комиссия
+ Всего
+ Максимальная сумма
+ Неверный адрес
+ Недопустимая сумма
+ Сумма превышает баланс
+ Общая сумма превышает баланс
+ Комиссия превышает баланс
+ Низкий
+ Нормальный
+ Приоритетный
+ Включить коммисию
+ %1$s %2$s будет отправлено
+ ≈ %1$s (включая комиссию: %2$s)
+ %1$s %2$s и %3$s %4$s будут отправлены
+ Баланс: %1$s %2$s
+ Транзакция успешно подписана и отправлена в блокчейн. Баланс кошелька будет обновлен через некоторое время
+ Подробности
+ ID карты
+ Эмитент
+ Подписано
+ %s хэшей
+ Валюта приложения
+ Настройки
+ Карта
+ Подтвердить карту
+ Управление безопасностью
+ Удалить кошелек
+ Это действие необратимо. Если после удаления кошелька кто-то отправит на него средства, то Вы не сможете их вывести.
+ Если вы забудете код, Вы потеряете возможность использовать карту. Невозможно восстановить или изменить код, если вы его потеряете.
+ Управление безопасностью
+ Длительное удержание
+ Этот механизм защищает карту от бесконтактной атаки. Это обеспечит задержку между приемом и выполнением команды. После первой подписанной транзакции этот телефон будет привязан к карте, и транзакции будут подписаны без задержки.
+ Пароль
+ Перед выполнением любой команды, влекущей за собой изменение состояния карты, вам необходимо будет ввести пароль.
+ Код доступа
+ Перед сканированием карты вам нужно будет ввести правильный код доступа.
+ У Вас могут возникнуть проблемы с NFC на некоторых iPhone 7/7+ во время извлечения.
+ Эта карта уже пополнялась и подписывала транзакции в прошлом. Рассмотрите возможность немедленного снятия всех средств, если Вы получили эту карту из ненадежного источника.
+ Предупреждение
+ Эта карта не предназначена для работы с этим приложением
+ Карта, которую Вы отсканировали, является картой для разработчиков. Не принимайте ее в качестве оплаты.
+ Карты Tangem, выпущенные до сентября 2019 года, в настоящее время не могут быть извлечены с помощью iPhone. Мы усердно работаем с Apple, чтобы сделать это возможным в будущих версиях iOS.
+ Нажмите, чтобы подписать
+ Приложите карту к телефону, как показано выше.
+ Приложите, чтобы удалить кошелек
+ Приложите, чтобы создать кошелек
+ Приложите, чтобы изменить код доступа
+ Приложите, чтобы изменить пароль
+ Неверный PayString
+ Условия использования
+ Не удалось получить комиссию
+ Целевая учетная запись не создана. Сумма для отправки должна быть %1$s %2$s + плата за создание или больше
+ Нет соединения с интернетом
+ Неизвестная ошибка
+ Ошибка проверки PayString
+ PayString не поддерживается блокчейном
+ PayString не зарегистрирован
+ Не удалось выполнить запрос PayString
+ Адрес совпадает с адресом кошелька
+ Недостаточный баланс
+ Внутренняя ошибка блокчейна
+ Неверная комиссия
+ Минимальная сумма: %s
+ Сдача слишком мала
+ Для создания учетной записи отправьте 1+ XLM на этот адрес
+ Адрес скопирован в буфер обмена
+ Сначала введите желаемую PayString
+ Приложите, чтобы отсканировать
+ Приложите карту
+ Ваш баланс на этом кошельке не равен нулю, или у Вас есть неподтвержденные транзакции
+ Это текущая активная опция
+ Чтобы не платить повышенную комиссию при следующем пополнении кошелька, уменьшите сумму на %s XTZ
+ Уменьшить на %s XTZ
+ Нет, отправить все
+ Ошибка сканирования карты. Попробуй снова
+ Купить
+ Продать
+ Торговать
+ По умолчанию
+ Совместимость
+ Устаревший
+ Создать кошелек
+ Создать кошелек
+ Сгенерируйте ключи кошелька на обеих картах, чтобы начать использовать свои Twin карты.
+ Tangem Twin
+ Один кошелек. Две карты.
+ Одна, которую Вы держите в руках, и вторая карта с номером #%s.
+ Карта %1d из %2d
+ Пересоздать Twin кошелек
+ Условия использования карты
+ Tangem Twin
+ Это действие необратимо. У Вас не будет доступа к старому кошельку.
+ Приложите Twin карту #%s
+ Подготовка карты
+ Создание кошелька
+ Процедура создания кошелька состоит из трех шагов. Вы должны пройти его до конца, иначе вам придется начинать сначала.
+ Сканировать карту #%s
+ Вы уже начали процесс пересоздания кошелька. Если Вы прервете его, вы не сможете использовать свои карты, пока не запустите его снова и не завершите пересоздание кошелька.
+ Вы приложили ту же карту. Чтобы создать кошелек, вам нужно приложить другу Twin карту.
+ Адрес кошелька успешно создан
+ Начать
+ Назад
+ Добавить
+ Удалить
+ Поиск
+ Памятка
+ Тег назначения
+ Недопустимый тег назначения. Он не будет добавлен в транзакцию
+ Недопустимый идентификатор памятки. Он не будет добавлен в транзакцию
+ Приложение
+ Отправить отзыв
+ Успешно отправлено
+ Спасибо за ваш отзыв
+ Ваши предложения отправлены
+ Спасибо за ваш отзыв. Мы ответим как можно скорее
+ Не удалось отправить электронное письмо
+ Причина: %s
+ Не могу отправить транзакцию
+ Причина: %s. Хотите отправить отзыв?
+ У Вас возникли трудности со сканированием вашей карты?
+ Пожалуйста, попробуйте приложить карту точно так, как показано на анимации, или обратитесь в поддержку.
+ Отмена
+ Попробуйте снова
+ Обратиться в поддержку
+ Отправить отзыв
+ Очень круто!
+ Может быть лучше
+ Один вопрос
+ Вам нравится приложение Tangem?
+ Все поля обязательны к заполнению
+ Токенов пока нет
+ Добавленные токены
+ Удалить токен %s
+ Вы уверены, что хотите удалить этот токен?
+ Добавить токены
+ Добавить токен
+ Начните поиск
+ Управление токенами
+ Добавить пользовательский
+ Пользовательские токены
+ Популярные токены
+ Добавить пользовательский токен
+ Пожалуйста заполните все поля
+ Введенное число не является допустимым десятичным числом
+ Имя
+ Символ токена
+ Адрес контракта
+ Десятичные
+ бывший. USD Coin
+ бывший. USDC
+ Добавлен
+ Удалить токен
+ Значок токена
+ Блокчейн
+ Управление токенами
+ Блокчейны
+ Ethereum токены
+ Binance Smart Chain токены
+ Binance Chain токены
+ Avalanche C-Chain токены
+ Polygon токены
+ Копировать
+ Поделиться
+ + Добавить токены
+ Пожалуйста, дождитесь завершения транзакции, чтобы иметь возможность отправить средства
+ Проверка подлинности не удалась
+ Эта карта может быть производственным образцом или подделкой.
+ Важная информация о безопасности \u26A0
+ Эта карта ранее подписывала транзакции
+ Узнать подробнее
+ Я понял
+ На этой карте доступно только %s подписей. Вы должны вывести все свои средства.
+ Отключить
+ Подписать
+ Подписать и отправить
+ Отклонить
+ Это тестовая карта. Не принимайте ее в качестве оплаты. Она должна использоваться только в целях тестирования и разработки.
+ Вы хотите купить или продать криптовалюту?
+ К сожалению, текущая версия приложения не готова к работе с этой картой, проверьте наличие обновлений.
+ Добро пожаловать в Tangem
+ Самый безопасный способ покупать, использовать и\n хранить криптовалюту
+ Получить новую карту
+ Активация карты
+ Как это работает?
+ Получить криптовалюту
+ Создать кошелек
+ Давайте сгенерируем все ключи на вашей карте и создадим безопасный кошелек
+ Создать кошелек
+ Пополните свой кошелек
+ Чтобы начать, просто пополните карту на любую сумму
+ Чтобы начать, просто пополните кошелек более чем на %s %s.
+ Купить криптовалюту
+ Показать адрес кошелька
+ Отсканируйте адрес, чтобы пополнить кошелек
+ Успешно!
+ Ваша криптокарта активирована и готова к использованию
+ Продолжить
+ Баланс
+ Отправляйте только %s (%s) на этот адрес. Отправка любой другой валюты приведет к ее безвозвратной потере.
+ Отправляйте только %s (%s) из сети %s на этот адрес. Отправка любой другой валюты приведет к ее безвозвратной потере.
+ Если процесс повторного создания кошелька каким-либо образом прервется, вам придется начать все сначала.
+ Процесс связывания карт частично завершен. Вы не можете выйти из него сейчас.
+ Внутренняя ошибка: не удается создать менеджер кошельков
+ Блокчейн недоступен. Попробуй позже
+ Хорошо, понял!
+ Успешно!
+ Начнем
+ Выполнить резервное копирование
+ Получить резервную карту
+ Оставить на потом
+ Завершить процесс резервного копирования
+ + Добавить резервную карту
+ Сканировать карту #%d
+ Сканировать основную карту
+ Добавить больше карт
+ Сделайте резервную копию вашего кошелька
+ Нет резервных карт
+ Подготовьте свою карту
+ Добавлена одна резервная карта
+ Добавлены две резервные карты
+ Резервная карта #%d
+ Вы можете привязать до трех карт к одному кошельку.
+ Чтобы начать процесс резервного копирования, добавьте еще максимум 2 карты
+ Подготовьте основную карту с номером %s
+ Подготовьте основную карту
+ Вы можете добавить еще одну карту или завершить процесс резервного копирования
+ Добавлено максимальное количество карт.
+ Если процесс резервного копирования будет прерван каким-либо образом, вам придется начать все сначала.
+ Вы добавили одну резервную карту. После того, как процесс будет завершен, Вы больше не сможете добавить карт. Если у Вас есть еще одна карта, добавьте ее в резервную копию. Хотите продолжить?
+ Создать код доступа
+ Введите код доступа повторно
+ Защитить
+ Персонализировать
+ Восстановить
+ Вам необходимо установить единый код доступа для защиты всех ваших кошельков.
+ Позже Вы сможете установить индивидуальный код доступа для каждой карты.
+ Код доступа можно восстановить с помощью привязанной карты, не храните все карты в одном месте.
+ Выберите любое слово, фразу или номер в качестве кода доступа.
+ Код доступа должен состоять не менее чем из 4 символов.
+ Введенный код доступа не соответствует исходному коду доступа
+ Создать
+ Подтвердить
+ Вы создали 2 резервные карты, и теперь эти карты готовы к использованию.
+ Создание резервной копии
+ Процесс резервного копирования частично завершен. Вы не можете выйти из него сейчас.
+ Резервный кошелек
+ Идентичные карты
+ Код доступа
+ Восстановление кода доступа
+ Вы можете сделать до двух резервных копий карты Tangem Wallet.
+ Все резервные карты могут использоваться как полнофункциональные с одинаковыми ключами.
+ Вы сможете установить код доступа для защиты своих кошельков.
+ Код доступа можно восстановить с помощью одной из резервных карт.
+ Ваша карта Tangem Wallet настроена и готова к использованию.
+ Вы создали 1 резервную карту, и теперь эта карта готова к использованию.
+ Основная карта
+ Я понимаю
+ Статус резервного копирования
+ Активный. Количество резервных карт: %d
+ Связано. Количество резервных карт: %d
+ Нет резервной копии
+ Создать резервную копию
+ У Вас есть прерванное резервное копирование. Хотите возобновить?
+ Да, возобновить
+ Отказаться
+ Это необратимое действие
+ Если сейчас отменить резервное копирование, то придется вернуть карты до заводских настроек, чтобы начать заново
+ Возобновить резервное копирование
+ Отказаться
+ Основная карта
+ Сканировать основную карту
+ Перейти к моему кошельку
+ Карта %1s из %2s
+ Отправка %s
+ Подготовьте резервную карту с номером %s
+ Подготовьте основную карту с номером %s
+ Сброс до заводских настроек
+ Это действие необратимо. Если после сброса карты кто-то отправит на нее средства, то Вы не сможете их вывести.
+ Код доступа доступен только для карт с резервной копией.
+ Сеть Solana взымает арендную плату в размере %s каждые 2 дня. Аккаунты, которые не могут позволить себе арендную плату, удаляются из сети. Пополните свой счет более чем на %s, чтобы использовать его бесплатно.
+ %1s (%2s)
+ Эта карта не является векселем на предъявителя. В настоящее время мы не можем сопоставить количество подписей на карте с информацией в блокчейне. Это нормально, но в редких случаях может означать, что предыдущий владелец скрывает автономную подпись, что является проблемой безопасности.\n\nНе принимайте эту карту в качестве физического платежа от кого-то, кому Вы не доверяете.\n\nВо всех остальных отношениях - это совершенно безопасно.\n\nTangem — единственный аппаратный кошелек, предлагающий защиту от подсчета подписей.
+ Wallet Connect
+ Запрос на создание транзакции для %2s\n%3s\n\nСумма: %4s\nКомиссия: %5s\nВсего: %6s\nБаланс: %7s
+ Запрос на запуск сеанса для карты с идентификатором %1s\nдля %2s\n\nURL: %3s
+ Сеансы подключения кошелька
+ Сеанс WalletConnect открыт с %s
+ Упс. Нет сессий.
+ Нет открытых сессий WalletConnect
+ Открытая сессия
+ Карта: %s
+ Коснитесь карты, чтобы привязать ее к кошельку.
+ Не удается отправить транзакцию. Недостаточно средств.
+ Просьба подписать сообщение\nкартой %s\n\n
+ Сообщение для %s:\n%s
+ Буфер обмена содержит код WalletConnect. Использовать скопированное значение или отсканировать QR-код
+ Вставить из буфера обмена
+ Сканировать новый код
+ Эту карту нельзя использовать для установки сеанса WalletConnect.
+ Операция не может быть завершена
+ Операция не может быть завершена. \n\nВы уже установили сеанс WalletConnect с этими параметрами.
+ Не удалось установить сеанс WalletConnect: ошибка времени выполнения. Пожалуйста, повторите попытку позже.
+ Транзакция BNB успешно подписана и отправлена в DApp.
+ DApp %s, запрашивает\nподпись транзакции BNB с\nкартой: %s\n\n%s
+ Сведения о транзакции:\nОт: %s\nКому: %s\nСумма: %s
+ Торговый ордер на %s\nЦена: %s\nСумма к получению: %s\nСумма к оплате: %s
+ Мои предложения
+ Не могу отсканировать карту
+ Не могу отправить транзакцию
+ Не могу протолкнуть транзакцию
+ Обращение в поддержку Tangem
+ Обращение в поддержку
+ Расскажите, каких функций Вам не хватает, и мы постараемся Вам помочь.
+ Скажите, пожалуйста, какая у Вас карта?
+ Пожалуйста, расскажите нам больше о Вашей проблеме. Каждая маленькая деталь может помочь.
+ Привет, команда поддержки,
+ Пожалуйста, расскажите нам больше о Вашей проблеме. Каждая деталь может быть полезной
+ Информация ниже не является обязательной. Вы можете стереть её, если хотите.
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 93cbbcca62..3318e7609d 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -29,6 +29,11 @@
#F4F5F6#DE000000
+ #060606
+ #686868
+ #F2F2F2
+ #090E13
+
#14181D
diff --git a/app/src/main/res/values/googlepay_strings.xml b/app/src/main/res/values/googlepay_strings.xml
new file mode 100755
index 0000000000..81d01c2b74
--- /dev/null
+++ b/app/src/main/res/values/googlepay_strings.xml
@@ -0,0 +1,12 @@
+
+
+ Google Pay
+ Buy with Google Pay
+ Donate With Google Pay
+ Pay With Google Pay
+ Subscribe With Google Pay
+ Book With Google Pay
+ Checkout With Google Pay
+ Order With Google Pay
+ View In Google Pay
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a8830f8137..c3e70dee2f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -110,8 +110,8 @@
This card has been already topped up and signed transactions in the past. Consider immediate withdrawal of all funds if you have received this card from an untrusted source.WarningThis card is not designed to work with this app
- The card you scanned is a development card. Don’t accept it as a payment
- Tangem cards manufactured before September 2019 cannot currently be extracted with an iPhone. We’re working hard with Apple to make it possible in future versions of iOS.
+ The card you scanned is a development card. Don\'t accept it as a payment
+ Tangem cards manufactured before September 2019 cannot currently be extracted with an iPhone. We\'re working hard with Apple to make it possible in future versions of iOS.Tap to signTap the card to your phone as shown above
@@ -122,7 +122,7 @@
Invalid PayString
- Legal Disclaimer
+ Legal Disclaimer
\n
\n1. Tangem application (Software)
\n
@@ -144,7 +144,7 @@
\n
\nc) Technical failures in the hardware of the user, including Cards, of any cryptocurrency-related software or service, e.g., data loss due to a faulty or damaged storage device.
\n
- \nd) Security problems experienced by the user of any cryptocurrency-related software or service, e.g., unauthorized access to users’ wallets and/or accounts.
+ \nd) Security problems experienced by the user of any cryptocurrency-related software or service, e.g., unauthorized access to users\' wallets and/or accounts.
\n
\ne) Actions or inactions of third parties and/or events experienced by third parties, e.g., bankruptcy of service providers, information security attacks on service providers, and fraud conducted by third parties.
\n
diff --git a/app/src/main/res/values/strings_untranslated.xml b/app/src/main/res/values/strings_untranslated.xml
index bfe549e0f7..d52e9f1f7b 100644
--- a/app/src/main/res/values/strings_untranslated.xml
+++ b/app/src/main/res/values/strings_untranslated.xml
@@ -54,7 +54,7 @@
Thank your for your feedback. We will response as soon as possibleFailed to send emailReason: %s
- Can’t send a transaction
+ Can\'t send a transactionReason: %s. Do you want to send feedback?Are you having difficulty scanning your card?Please try to tap the card exactly as shown in the animation or request support.
@@ -115,9 +115,9 @@
Important security information \u26A0This card has signed transactions in the pastLearn more
- This card is not a bearer note. We can’t currently match the signature count on the card with the information on the blockchain. This is normal but in rare cases can mean a previous holder is holding back an offline signature, which is a security concern.
- \n\nDo not accept this card as physical payment from someone you don’t trust.
- \n\nIt’s perfectly safe in all other respects.
+ This card is not a bearer note. We can\'t currently match the signature count on the card with the information on the blockchain. This is normal but in rare cases can mean a previous holder is holding back an offline signature, which is a security concern.
+ \n\nDo not accept this card as physical payment from someone you don\'t trust.
+ \n\nIt\'s perfectly safe in all other respects.
\n\nTangem is the only hardware wallet to offer signature count protection.I understand
@@ -162,7 +162,7 @@
Clipboard contain WalletConnect code. Use copied value or scan QR-codePaste from clipboardScan new code
- This card can’t be used to establish WalletConnect session
+ This card can\'t be used to establish WalletConnect sessionThe operation couldn\'t be completedThe operation couldn\'t be completed. \n\nYou have already established a WalletConnect session with this parameters.Failed to establish WalletConnect session: timeout error. Please, try again later.
@@ -184,14 +184,14 @@
Receive cryptoCreate a wallet
- Let’s generate all the keys on your card and create a secure wallet
+ Let\'s generate all the keys on your card and create a secure walletCreate walletTop up your walletTo get started, simply top up the card with any amountTo get started, simply top up the wallet with more than %s %s.Buy crypto
- Show the wallet’s address
+ Show the wallet\'s addressScan the address to top up your walletSuccess!
@@ -201,8 +201,8 @@
Send only %s (%s) to this address. Sending any other currency will result in its irreversible loss.Send only %s (%s) from %s network to this address. Sending any other currency will result in its irreversible loss.
- If the process of re-creating the wallet gets interrupted in any way, you’ll have to start over.
- The twinning process is partly complete. You can’t exit it now.
+ If the process of re-creating the wallet gets interrupted in any way, you\'ll have to start over.
+ The twinning process is partly complete. You can\'t exit it now.Internal error: can\'t create wallet manager
@@ -235,9 +235,9 @@
Prepare the primary cardYou can add one more card or finalize the backup processMax number of cards added. Finalize the backup process
- If the process of backup gets interrupted in any way you’ll have to start over
+ If the process of backup gets interrupted in any way you\'ll have to start over
- You’ve added one backup card. When backup process is finished you can’t add more backup cards. If you have one more card, add it in backup, otherwise you can buy it in shop. Do you like to continue backup process?
+ You\'ve added one backup card. When backup process is finished you can\'t add more backup cards. If you have one more card, add it in backup, otherwise you can buy it in shop. Do you like to continue backup process?Create Access CodeRe-enter your Access Code
@@ -246,7 +246,7 @@
RestoreYou have to setup a single access code to protect all yor wallets.You can set an individual access code on each card later.
- The access code can be restored with a linked card, don’t keep all cards at one place.
+ The access code can be restored with a linked card, don\'t keep all cards at one place.Choose any word, phrase, or number you want as your access code.Access code must be at least 4 characters longEntered access code didn\'t match initial access code
@@ -255,7 +255,7 @@
SubmitYou have created 2 backup cards, and now these cards are ready for use.Creating a backup
- The backup process is partly complete. You can’t exit it now.
+ The backup process is partly complete. You can\'t exit it now.Backup walletIdentical cards
@@ -313,8 +313,34 @@ Price: %s\n
Amount to receive: %s\n
Amount to pay: %s
- Solana network charges a rent of %s every 2 days. Accounts that can’t afford the rent are purged from the network. Deposit your account with more than %s to use it for free.
+ Solana network charges a rent of %s every 2 days. Accounts that can\'t afford the rent are purged from the network. Deposit your account with more than %s to use it for free.%1s (%2s)
+ Type here to search
+
+ My suggestions
+ Can\'t scan a card
+ Can\'t send a transaction
+ Can\'t push a transaction
+ Tangem feedback
+ Feedback
+ Tell us what functions you are missing, and we will try to help you.
+ Please tell us what card do you have?
+ Please tell us more about your issue. Every small detail can help.
+ Hi support team,
+ Please tell us more about your issue. Every small detail can help.
+ Following information is optional. You can erase it if you don’t want to share it.
+
+ One Wallet
+ 3 cards
+ 2 cards
+ Shipping
+ Free
+ I have a promo code...
+ Total
+ Other payment methods
+ Buy now
+ Order card
+ Delivery (Free shipping)
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index ba05fd093a..10c1c9cb80 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -147,6 +147,15 @@
adjustResize
+
+
diff --git a/build.gradle b/build.gradle
index 0ac373259b..23b9e4d0bc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,7 +10,7 @@ buildscript {
classpath "com.android.tools.build:gradle:${versions.build_gradle}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
- classpath 'com.google.gms:google-services:4.3.8'
+ classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}