Updated on 2026-08-14
This commit is contained in:
commit
2ade5a1407
9 changed files with 23 additions and 26 deletions
|
|
@ -23,7 +23,7 @@ enum class SettingsElement(
|
|||
WalletConnect(R.drawable.ic_walletconnect, R.string.wallet_connect_title),
|
||||
Chat(R.drawable.ic_chat, R.string.details_chat),
|
||||
SendFeedback(R.drawable.ic_comment, R.string.details_row_title_send_feedback),
|
||||
// ReferralProgram(R.drawable.ic_add_friends, R.string.details_referral_title),
|
||||
ReferralProgram(R.drawable.ic_add_friends, R.string.details_referral_title),
|
||||
CardSettings(R.drawable.ic_card_settings, R.string.card_settings_title),
|
||||
AppCurrency(R.drawable.ic_currency, R.string.details_row_title_currency),
|
||||
AppSettings(R.drawable.ic_settings, R.string.app_settings_title),
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class DetailsViewModel(private val store: Store<AppState>) {
|
|||
}
|
||||
SettingsElement.AppSettings -> if (state.appSettingsState.isBiometricsAvailable) it else null
|
||||
SettingsElement.AppCurrency -> if (cardTypesResolver?.isMultiwalletAllowed() != true) it else null
|
||||
// SettingsElement.ReferralProgram -> if (state.scanResponse?.card?.isTangemWallet == true) it else null
|
||||
SettingsElement.ReferralProgram -> if (cardTypesResolver?.isTangemWallet() == true) it else null
|
||||
else -> it
|
||||
}
|
||||
}
|
||||
|
|
@ -94,9 +94,9 @@ class DetailsViewModel(private val store: Store<AppState>) {
|
|||
SettingsElement.PrivacyPolicy -> {
|
||||
// TODO: To be available later
|
||||
}
|
||||
// SettingsElement.ReferralProgram -> {
|
||||
// store.dispatch(NavigationAction.NavigateTo(AppScreen.ReferralProgram))
|
||||
// }
|
||||
SettingsElement.ReferralProgram -> {
|
||||
store.dispatch(NavigationAction.NavigateTo(AppScreen.ReferralProgram))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ object Library {
|
|||
const val accompanistAppCompatTheme = "com.google.accompanist:accompanist-appcompat-theme:" + Versions.accompanist
|
||||
const val accompanistSystemUiController =
|
||||
"com.google.accompanist:accompanist-systemuicontroller:" + Versions.accompanist
|
||||
const val accompanistWebView = "com.google.accompanist:accompanist-webview:" + Versions.accompanist
|
||||
const val amplitude = "com.amplitude:android-sdk:" + Versions.amplitude
|
||||
const val appsflyer = "com.appsflyer:af-android-sdk:" + Versions.appsflyer
|
||||
const val armadillo = "at.favre.lib:armadillo:" + Versions.armadillo
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ object Versions {
|
|||
// endregion Compose
|
||||
|
||||
// region Other libraries
|
||||
const val accompanist = "0.23.0"
|
||||
const val accompanist = "0.27.1"
|
||||
const val amplitude = "2.36.1"
|
||||
const val appsflyer = "6.5.1"
|
||||
const val armadillo = "0.9.0"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ data class ReferralResponse(
|
|||
) {
|
||||
|
||||
data class Conditions(
|
||||
@Json(name = "award") val award: Int,
|
||||
@Json(name = "discount") val discount: Discount,
|
||||
@Json(name = "awards") val awards: List<Award>,
|
||||
@Json(name = "tosLink") val tosLink: String,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ReferralConverter @Inject constructor() : Converter<ReferralResponse, Refe
|
|||
val tokenConverter = TokenConverter()
|
||||
return if (referral != null) {
|
||||
ReferralData.ParticipantData(
|
||||
award = conditions.awards.firstOrNull()?.amount ?: conditions.award,
|
||||
award = conditions.awards.firstOrNull()?.amount ?: 0,
|
||||
discount = conditions.discount.amount,
|
||||
discountType = safeValueOf(conditions.discount.discountType.uppercase(), DiscountType.PERCENTAGE),
|
||||
tosLink = conditions.tosLink,
|
||||
|
|
@ -35,7 +35,7 @@ class ReferralConverter @Inject constructor() : Converter<ReferralResponse, Refe
|
|||
)
|
||||
} else {
|
||||
ReferralData.NonParticipantData(
|
||||
award = conditions.awards.firstOrNull()?.amount ?: conditions.award,
|
||||
award = conditions.awards.firstOrNull()?.amount ?: 0,
|
||||
discount = conditions.discount.amount,
|
||||
discountType = safeValueOf(conditions.discount.discountType.uppercase(), DiscountType.PERCENTAGE),
|
||||
tosLink = conditions.tosLink,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ dependencies {
|
|||
|
||||
/** Other libraries */
|
||||
implementation(Library.composeShimmer)
|
||||
implementation(Library.accompanistWebView)
|
||||
|
||||
/** DI */
|
||||
implementation(Library.hilt)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package com.tangem.feature.referral.ui
|
||||
|
||||
import android.view.ViewGroup.LayoutParams
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -15,7 +12,8 @@ import androidx.compose.ui.platform.LocalConfiguration
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import com.google.accompanist.web.WebView
|
||||
import com.google.accompanist.web.rememberWebViewState
|
||||
import com.tangem.core.ui.components.appbar.AppBarWithAdditionalButtons
|
||||
import com.tangem.core.ui.components.atoms.Hand
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
|
@ -44,20 +42,16 @@ internal fun AgreementBottomSheetContent(url: String) {
|
|||
|
||||
@Composable
|
||||
private fun AgreementHtmlView(url: String) {
|
||||
AndroidView(
|
||||
val state = rememberWebViewState(url)
|
||||
WebView(
|
||||
state = state,
|
||||
modifier = Modifier.background(TangemTheme.colors.background.secondary),
|
||||
factory = {
|
||||
WebView(it).apply {
|
||||
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||
webViewClient = WebViewClient()
|
||||
settings.apply {
|
||||
javaScriptEnabled = false
|
||||
allowFileAccess = false
|
||||
}
|
||||
loadUrl(url)
|
||||
onCreated = {
|
||||
it.settings.apply {
|
||||
javaScriptEnabled = false
|
||||
allowFileAccess = false
|
||||
}
|
||||
},
|
||||
update = { it.loadUrl(url) },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ import com.tangem.feature.referral.presentation.R
|
|||
import com.valentinilk.shimmer.shimmer
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private const val GOOGLE_DOC_LINK_WRAPPER = "https://docs.google.com/viewer?url=%s&embedded=false"
|
||||
|
||||
/**
|
||||
* Referral program screen for participant and non-participant
|
||||
*
|
||||
|
|
@ -85,8 +87,8 @@ internal fun ReferralScreen(stateHolder: ReferralStateHolder) {
|
|||
sheetContent = {
|
||||
AgreementBottomSheetContent(
|
||||
url = when (val state = stateHolder.referralInfoState) {
|
||||
is ReferralInfoState.NonParticipantContent -> state.url
|
||||
is ReferralInfoState.ParticipantContent -> state.url
|
||||
is ReferralInfoState.NonParticipantContent -> String.format(GOOGLE_DOC_LINK_WRAPPER, state.url)
|
||||
is ReferralInfoState.ParticipantContent -> String.format(GOOGLE_DOC_LINK_WRAPPER, state.url)
|
||||
is ReferralInfoState.Loading -> ""
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue