Updated on 2026-08-14
This commit is contained in:
parent
b1488b60d3
commit
47c411b270
13 changed files with 110 additions and 4 deletions
|
|
@ -75,7 +75,8 @@ object OnboardingHelper {
|
|||
scanResponse.productType == ProductType.Ring ||
|
||||
scanResponse.productType == ProductType.Wallet ||
|
||||
scanResponse.productType == ProductType.Visa // AppRoute.OnboardingOther is also supported
|
||||
if (store.inject(DaggerGraphState::onboardingV2FeatureToggles).isOnboardingV2Enabled &&
|
||||
val featureToggles = store.inject(DaggerGraphState::onboardingV2FeatureToggles)
|
||||
if (featureToggles.isOnboardingV2Enabled &&
|
||||
newOnboardingSupportTypes
|
||||
) {
|
||||
val backupState = store.state.onboardingWalletState.backupState
|
||||
|
|
@ -91,7 +92,15 @@ object OnboardingHelper {
|
|||
}
|
||||
|
||||
return when (val type = scanResponse.productType) {
|
||||
ProductType.Note -> AppRoute.OnboardingNote
|
||||
ProductType.Note -> if (featureToggles.isNoteRefactoringEnabled) {
|
||||
AppRoute.Onboarding(
|
||||
scanResponse = scanResponse,
|
||||
startFromBackup = false,
|
||||
mode = AppRoute.Onboarding.Mode.Onboarding,
|
||||
)
|
||||
} else {
|
||||
AppRoute.OnboardingNote
|
||||
}
|
||||
ProductType.Wallet,
|
||||
ProductType.Wallet2,
|
||||
ProductType.Ring,
|
||||
|
|
|
|||
|
|
@ -364,8 +364,8 @@ internal class ChildFactory @Inject constructor(
|
|||
componentFactory = walletComponentFactory,
|
||||
)
|
||||
}
|
||||
is AppRoute.SaveWallet,
|
||||
is AppRoute.OnboardingNote,
|
||||
is AppRoute.SaveWallet,
|
||||
is AppRoute.OnboardingOther,
|
||||
is AppRoute.OnboardingTwins,
|
||||
is AppRoute.OnboardingWallet,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ sealed class AppRoute(val path: String) : Route {
|
|||
val isTosAccepted: Boolean,
|
||||
) : AppRoute(path = "/disclaimer${if (isTosAccepted) "/tos_accepted" else ""}")
|
||||
|
||||
@Deprecated("Do not use! Should be replaced by an implementation in onboarding component")
|
||||
@Serializable
|
||||
data object OnboardingNote : AppRoute(path = "/onboarding/note")
|
||||
|
||||
|
|
|
|||
|
|
@ -62,5 +62,9 @@
|
|||
{
|
||||
"name": "ASK_BIOMETRY_REFACTORING_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "NOTE_REFACTORING_ENABLED",
|
||||
"version": "undefined"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ package com.tangem.features.onboarding.v2
|
|||
interface OnboardingV2FeatureToggles {
|
||||
val isOnboardingV2Enabled: Boolean
|
||||
val isVisaOnboardingEnabled: Boolean
|
||||
val isNoteRefactoringEnabled: Boolean
|
||||
}
|
||||
|
|
@ -10,4 +10,6 @@ internal class DefaultOnboardingV2FeatureToggles @Inject constructor(
|
|||
get() = featureTogglesManager.isFeatureEnabled("ONBOARDING_CODE_REFACTORING_ENABLED")
|
||||
override val isVisaOnboardingEnabled: Boolean
|
||||
get() = featureTogglesManager.isFeatureEnabled("VISA_ONBOARDING_ENABLED")
|
||||
override val isNoteRefactoringEnabled: Boolean
|
||||
get() = featureTogglesManager.isFeatureEnabled("NOTE_REFACTORING_ENABLED")
|
||||
}
|
||||
|
|
@ -75,6 +75,11 @@ internal class OnboardingEntryModel @Inject constructor(
|
|||
titleProvider = titleProvider,
|
||||
onDone = ::onVisaOnboardingDone,
|
||||
)
|
||||
ProductType.Note -> OnboardingRoute.Note(
|
||||
scanResponse = scanResponse,
|
||||
titleProvider = titleProvider,
|
||||
onDone = ::navigateToWalletScreen,
|
||||
)
|
||||
else -> error("Unsupported")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.tangem.core.decompose.context.AppComponentContext
|
|||
import com.tangem.features.managetokens.component.OnboardingManageTokensComponent
|
||||
import com.tangem.features.onboarding.v2.done.api.OnboardingDoneComponent
|
||||
import com.tangem.features.onboarding.v2.multiwallet.api.OnboardingMultiWalletComponent
|
||||
import com.tangem.features.onboarding.v2.note.api.OnboardingNoteComponent
|
||||
import com.tangem.features.onboarding.v2.visa.api.OnboardingVisaComponent
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -12,6 +13,7 @@ internal class OnboardingChildFactory @Inject constructor(
|
|||
private val onboardingManageTokensComponentFactory: OnboardingManageTokensComponent.Factory,
|
||||
private val onboardingDoneComponentFactory: OnboardingDoneComponent.Factory,
|
||||
private val onBoardingVisaComponentFactory: OnboardingVisaComponent.Factory,
|
||||
private val onboardingNoteComponentFactory: OnboardingNoteComponent.Factory,
|
||||
) {
|
||||
|
||||
fun createChild(route: OnboardingRoute, childContext: AppComponentContext, onManageTokensDone: () -> Unit): Any {
|
||||
|
|
@ -47,6 +49,14 @@ internal class OnboardingChildFactory @Inject constructor(
|
|||
onDone = route.onDone,
|
||||
),
|
||||
)
|
||||
is OnboardingRoute.Note -> onboardingNoteComponentFactory.create(
|
||||
context = childContext,
|
||||
params = OnboardingNoteComponent.Params(
|
||||
scanResponse = route.scanResponse,
|
||||
titleProvider = route.titleProvider,
|
||||
onDone = route.onDone,
|
||||
),
|
||||
)
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,12 @@ sealed class OnboardingRoute : Route {
|
|||
|
||||
data object None : OnboardingRoute()
|
||||
|
||||
data class Note(
|
||||
val titleProvider: TitleProvider,
|
||||
val scanResponse: ScanResponse,
|
||||
val onDone: () -> Unit,
|
||||
) : OnboardingRoute()
|
||||
|
||||
data class MultiWallet(
|
||||
val titleProvider: TitleProvider,
|
||||
val scanResponse: ScanResponse,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,12 @@ internal inline fun OnboardingEntry(
|
|||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
OnboardingRoute.None -> {}
|
||||
is OnboardingRoute.Note -> {
|
||||
(it.instance as ComposableContentComponent).Content(
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
is OnboardingRoute.None -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.tangem.features.onboarding.v2.note.api
|
||||
|
||||
import com.tangem.core.decompose.factory.ComponentFactory
|
||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||
import com.tangem.domain.models.scan.ScanResponse
|
||||
import com.tangem.features.onboarding.v2.TitleProvider
|
||||
|
||||
interface OnboardingNoteComponent : ComposableContentComponent {
|
||||
|
||||
data class Params(
|
||||
val titleProvider: TitleProvider,
|
||||
val scanResponse: ScanResponse,
|
||||
val onDone: () -> Unit,
|
||||
)
|
||||
|
||||
interface Factory : ComponentFactory<Params, OnboardingNoteComponent>
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.tangem.features.onboarding.v2.note.impl
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.tangem.core.decompose.context.AppComponentContext
|
||||
import com.tangem.features.onboarding.v2.note.api.OnboardingNoteComponent
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
|
||||
internal class DefaultOnboardingNoteComponent @AssistedInject constructor(
|
||||
@Assisted context: AppComponentContext,
|
||||
@Assisted val params: OnboardingNoteComponent.Params,
|
||||
) : OnboardingNoteComponent, AppComponentContext by context {
|
||||
|
||||
@Composable
|
||||
override fun Content(modifier: Modifier) {
|
||||
// TODO [REDACTED_TASK_KEY]
|
||||
}
|
||||
|
||||
@AssistedFactory
|
||||
interface Factory : OnboardingNoteComponent.Factory {
|
||||
override fun create(
|
||||
context: AppComponentContext,
|
||||
params: OnboardingNoteComponent.Params,
|
||||
): DefaultOnboardingNoteComponent
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.tangem.features.onboarding.v2.note.impl.di
|
||||
|
||||
import com.tangem.features.onboarding.v2.note.api.OnboardingNoteComponent
|
||||
import com.tangem.features.onboarding.v2.note.impl.DefaultOnboardingNoteComponent
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
internal interface ComponentModule {
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun bindComponent(factory: DefaultOnboardingNoteComponent.Factory): OnboardingNoteComponent.Factory
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue