Updated on 2026-08-14

This commit is contained in:
Tangem 2023-07-10 11:08:27 +03:00
commit f02602ef91
136 changed files with 658 additions and 387 deletions

View file

@ -32,26 +32,34 @@ fun Learn2earnStoriesScreen(onLearnClick: () -> Unit, modifier: Modifier = Modif
.fillMaxSize()
.align(Alignment.Center),
)
StoryDescription(
modifier = Modifier
.padding(horizontal = TangemTheme.dimens.size40)
.fillMaxSize(),
headerText = stringResource(id = R.string.story_learn_title),
bodyText = stringResource(id = R.string.story_learn_description),
)
Image(
modifier = Modifier
.padding(bottom = TangemTheme.dimens.size68)
.align(Alignment.BottomCenter),
painter = painterResource(id = R.drawable.img_1inch_logo_401_378),
contentDescription = null,
)
Column(
modifier = Modifier.fillMaxSize(),
) {
StoryDescription(
modifier = Modifier
.padding(horizontal = TangemTheme.dimens.size40)
.weight(weight = 1f),
headerText = stringResource(id = R.string.common_learn_and_earn),
bodyText = stringResource(id = R.string.story_learn_description),
)
Image(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = TangemTheme.dimens.size16)
.navigationBarsPadding()
.weight(weight = 1.2f),
painter = painterResource(id = R.drawable.img_1inch_logo_401_378),
contentDescription = null,
)
}
SecondaryButton(
modifier = Modifier
.padding(horizontal = TangemTheme.dimens.size16)
.padding(bottom = TangemTheme.dimens.size84)
.padding(bottom = TangemTheme.dimens.size36)
.fillMaxWidth()
.align(Alignment.BottomCenter),
.align(Alignment.BottomCenter)
.navigationBarsPadding(),
text = stringResource(id = R.string.story_learn_learn),
onClick = onLearnClick,
)

View file

@ -37,12 +37,12 @@ data class MainScreenState(
sealed class Description(val title: TextReference, val subtitle: TextReference) {
class Learn(award: Int) : Description(
TextReference.Res(R.string.main_learn_title),
TextReference.Res(R.string.common_learn_and_earn),
TextReference.PluralRes(R.plurals.main_learn_subtitle, award, WrappedList(listOf(award))),
)
object GetBonus : Description(
TextReference.Res(R.string.main_get_bonus_title),
TextReference.Res(R.string.common_learn_and_earn),
TextReference.Res(R.string.main_get_bonus_subtitle),
)
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_wallet"
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@ -10,21 +10,29 @@
android:id="@+id/app_bar"
style="@style/Widget.MaterialComponents.Toolbar.Surface"
android:layout_width="match_parent"
app:liftOnScroll="true"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/ic_close_24" />
</com.google.android.material.appbar.AppBarLayout>
<WebView
android:id="@+id/web_view"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

1
features/tokendetails/api/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,14 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
id("configuration")
}
android {
namespace = "com.tangem.features.tokendetails.api"
}
dependencies {
/** AndroidX */
implementation(deps.androidx.fragment.ktx)
}

View file

@ -0,0 +1,5 @@
package com.tangem.features.tokendetails.featuretoggles
interface TokenDetailsFeatureToggles {
val isRedesignedScreenEnabled: Boolean
}

View file

@ -0,0 +1,8 @@
package com.tangem.features.tokendetails.navigation
import androidx.fragment.app.Fragment
interface TokenDetailsRouter {
fun getEntryFragment(): Fragment
}

1
features/tokendetails/impl/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,38 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
alias(deps.plugins.kotlin.kapt)
alias(deps.plugins.hilt.android)
id("configuration")
}
android {
namespace = "com.tangem.features.tokendetails.impl"
}
dependencies {
/** AndroidX */
implementation(deps.androidx.activity.compose)
/** Compose */
implementation(deps.compose.material)
implementation(deps.compose.foundation)
implementation(deps.compose.material3)
implementation(deps.compose.navigation)
implementation(deps.compose.navigation.hilt)
implementation(deps.compose.ui)
implementation(deps.compose.ui.tooling)
implementation(deps.compose.accompanist.systemUiController)
/** DI */
implementation(deps.hilt.android)
kapt(deps.hilt.kapt)
/** Core modules */
implementation(projects.core.featuretoggles)
implementation(projects.core.ui)
/** Feature Apis */
implementation(projects.features.tokendetails.api)
}

View file

@ -0,0 +1,21 @@
package com.tangem.feature.tokendetails.di
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
import com.tangem.feature.tokendetails.featuretoggles.DefaultTokenDetailsFeatureToggles
import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal object TokenDetailsFeatureTogglesModule {
@Provides
@Singleton
fun provideTokenDetailsFeatureToggles(featureTogglesManager: FeatureTogglesManager): TokenDetailsFeatureToggles {
return DefaultTokenDetailsFeatureToggles(featureTogglesManager = featureTogglesManager)
}
}

View file

@ -0,0 +1,18 @@
package com.tangem.feature.tokendetails.di
import com.tangem.feature.tokendetails.presentation.router.DefaultTokenDetailsRouter
import com.tangem.features.tokendetails.navigation.TokenDetailsRouter
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.hilt.android.scopes.ActivityScoped
@Module
@InstallIn(ActivityComponent::class)
internal object TokenDetailsRouterModule {
@Provides
@ActivityScoped
fun provideTokenDetailsRouter(): TokenDetailsRouter = DefaultTokenDetailsRouter()
}

View file

@ -0,0 +1,14 @@
package com.tangem.feature.tokendetails.featuretoggles
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles
private const val REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED_KEY = "REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED"
internal class DefaultTokenDetailsFeatureToggles(
private val featureTogglesManager: FeatureTogglesManager,
) : TokenDetailsFeatureToggles {
override val isRedesignedScreenEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled(name = REDESIGNED_TOKEN_DETAIL_SCREEN_ENABLED_KEY)
}

View file

@ -0,0 +1,10 @@
package com.tangem.feature.tokendetails.presentation.router
import androidx.fragment.app.Fragment
import com.tangem.features.tokendetails.navigation.TokenDetailsRouter
internal class DefaultTokenDetailsRouter : TokenDetailsRouter {
// TODO: Doston fix it in next PRs
override fun getEntryFragment(): Fragment = Fragment()
}

View file

@ -26,6 +26,7 @@ dependencies {
/** Other libraries */
implementation(deps.kotlin.immutable.collections)
implementation(deps.tangem.blockchain)
/** DI */
implementation(deps.hilt.android)
@ -37,4 +38,7 @@ dependencies {
/** Feature Apis */
implementation(project(":features:wallet:api"))
/** Domain modules */
implementation(project(":domain:legacy"))
}

View file

@ -0,0 +1,52 @@
package com.tangem.feature.wallet.presentation.wallet.domain
import androidx.annotation.DrawableRes
import com.tangem.blockchain.common.Blockchain
import com.tangem.domain.common.CardTypesResolver
import com.tangem.feature.wallet.impl.R
/**
* Wallet image resolver
*
[REDACTED_AUTHOR]
*/
internal object WalletImageResolver {
private const val DOUBLE_WALLET_SET_BACKUP_COUNT = 1
private const val TRIPLE_WALLET_SET_BACKUP_COUNT = 2
/** Get image by [cardTypesResolver] */
@DrawableRes
fun resolve(cardTypesResolver: CardTypesResolver): Int? {
return when {
cardTypesResolver.isWallet2() -> resolveWallet2(cardTypesResolver)
cardTypesResolver.isTangemWallet() -> R.drawable.ill_wallet_120_106
cardTypesResolver.isWhiteWallet() -> R.drawable.ill_old_wallet_120_106
cardTypesResolver.isTangemTwins() -> R.drawable.ill_twin_120_106
cardTypesResolver.isStart2Coin() -> R.drawable.ill_start2coin_120_106
cardTypesResolver.isTangemNote() -> resolveNote(cardTypesResolver)
cardTypesResolver.isDev() -> R.drawable.ill_dev_120_106
else -> null
}
}
private fun resolveWallet2(cardTypesResolver: CardTypesResolver): Int? {
return when (cardTypesResolver.getBackupCardsCount()) {
DOUBLE_WALLET_SET_BACKUP_COUNT -> R.drawable.ill_wallet2_cards2_120_106
TRIPLE_WALLET_SET_BACKUP_COUNT -> R.drawable.ill_wallet2_cards3_120_106
else -> null
}
}
private fun resolveNote(cardTypesResolver: CardTypesResolver): Int? {
return when (cardTypesResolver.getBlockchain()) {
Blockchain.Bitcoin -> R.drawable.ill_note_btc_120_106
Blockchain.Ethereum -> R.drawable.ill_note_ethereum_120_106
Blockchain.Binance -> R.drawable.ill_note_binance_120_106
Blockchain.Dogecoin -> R.drawable.ill_note_doge_120_106
Blockchain.Cardano -> R.drawable.ill_note_cardano_120_106
Blockchain.XRP -> R.drawable.ill_note_xrp_120_106
else -> null
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB