Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-21 12:23:19 +01:00
parent 333640b3a7
commit 9736fa301c
6 changed files with 33 additions and 39 deletions

View file

@ -239,7 +239,7 @@ internal class CreateWalletStartModel @Inject constructor(
val route = if (onboardingV2FeatureToggles.isAddressSyncEnabled) {
AppRoute.Onboarding(
scanResponse = scanResponse,
mode = AppRoute.Onboarding.Mode.AddressSync
mode = AppRoute.Onboarding.Mode.AddressSync,
)
} else {
AppRoute.Wallet

View file

@ -52,11 +52,11 @@ internal class DefaultAddressSyncComponent(
modifier = modifier,
childContent = {
Children(
stack = childStack
) {
it.instance.Content(modifier = modifier)
stack = childStack,
) { child ->
child.instance.Content(Modifier)
}
}
},
)
BackHandler {
@ -64,10 +64,7 @@ internal class DefaultAddressSyncComponent(
}
}
private fun createChild(
step: AddressSyncStep,
childContext: AppComponentContext,
): ComposableContentComponent {
private fun createChild(step: AddressSyncStep, childContext: AppComponentContext): ComposableContentComponent {
return when (step) {
AddressSyncStep.ASK_BIOMETRY -> createAskBiometryComponent(childContext)
AddressSyncStep.ASK_NOTIFICATIONS -> createPushNotificationComponent(childContext)
@ -85,8 +82,8 @@ internal class DefaultAddressSyncComponent(
model.onIntent(
AddressSyncIntent.Next(
step = AddressSyncStep.ASK_NOTIFICATIONS,
replace = true
)
shouldReplace = true,
),
)
}
@ -94,12 +91,12 @@ internal class DefaultAddressSyncComponent(
model.onIntent(
AddressSyncIntent.Next(
step = AddressSyncStep.ASK_NOTIFICATIONS,
replace = false
)
shouldReplace = false,
),
)
}
}
)
},
),
)
}
@ -112,8 +109,8 @@ internal class DefaultAddressSyncComponent(
model.onIntent(
AddressSyncIntent.Next(
step = AddressSyncStep.ADDRESS_SYNC,
replace = true
)
shouldReplace = true,
),
)
}
@ -121,8 +118,8 @@ internal class DefaultAddressSyncComponent(
model.onIntent(
AddressSyncIntent.Next(
step = AddressSyncStep.ADDRESS_SYNC,
replace = false
)
shouldReplace = false,
),
)
}
@ -130,13 +127,13 @@ internal class DefaultAddressSyncComponent(
model.onIntent(
AddressSyncIntent.Next(
step = AddressSyncStep.ADDRESS_SYNC,
replace = false
)
shouldReplace = false,
),
)
}
},
source = AppRoute.PushNotification.Source.Onboarding,
)
),
)
}
}

View file

@ -3,6 +3,6 @@ package com.tangem.features.onboarding.v2.addresssync.model
import com.tangem.features.onboarding.v2.addresssync.navigation.AddressSyncStep
sealed interface AddressSyncIntent {
data class Next(val step: AddressSyncStep, val replace: Boolean) : AddressSyncIntent
data class Next(val step: AddressSyncStep, val shouldReplace: Boolean) : AddressSyncIntent
data object Back : AddressSyncIntent
}

View file

@ -47,15 +47,15 @@ internal class AddressSyncModel @Inject constructor(
private suspend fun trySkippingScreen(next: AddressSyncIntent.Next) {
when (next.step) {
AddressSyncStep.ASK_BIOMETRY -> {
val showBiometry = canUseBiometryUseCase.strict() && shouldShowAskBiometryUseCase()
if (showBiometry.not()) {
nextScreen(AddressSyncIntent.Next(step = AddressSyncStep.ASK_NOTIFICATIONS, replace = true))
val shouldShowAskBiometry = canUseBiometryUseCase.strict() && shouldShowAskBiometryUseCase()
if (shouldShowAskBiometry.not()) {
nextScreen(AddressSyncIntent.Next(step = AddressSyncStep.ASK_NOTIFICATIONS, shouldReplace = true))
}
}
AddressSyncStep.ASK_NOTIFICATIONS -> {
val showNotification = shouldAskPermissionUseCase(PUSH_PERMISSION)
if (showNotification.not()) {
nextScreen(AddressSyncIntent.Next(step = AddressSyncStep.ADDRESS_SYNC, replace = true))
val shouldShowAskNotification = shouldAskPermissionUseCase(PUSH_PERMISSION)
if (shouldShowAskNotification.not()) {
nextScreen(AddressSyncIntent.Next(step = AddressSyncStep.ADDRESS_SYNC, shouldReplace = true))
}
}
AddressSyncStep.ADDRESS_SYNC -> Unit

View file

@ -14,10 +14,7 @@ import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
@Composable
internal fun AddressSyncContent(
modifier: Modifier = Modifier,
childContent: @Composable (Modifier) -> Unit = {},
) {
internal fun AddressSyncContent(modifier: Modifier = Modifier, childContent: @Composable (Modifier) -> Unit = {}) {
Column(
modifier = modifier
.background(color = TangemTheme.colors.background.secondary)
@ -26,7 +23,7 @@ internal fun AddressSyncContent(
.systemBarsPadding(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
childContent(modifier)
childContent(Modifier)
}
}

View file

@ -39,7 +39,7 @@ internal class AddressSyncModelTest {
val model = createModel(this)
val stack = model.stackNavigation.trackStack()
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_BIOMETRY, replace = false))
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_BIOMETRY, shouldReplace = false))
advanceUntilIdle()
assert(stack == listOf(AddressSyncStep.ASK_BIOMETRY))
@ -55,7 +55,7 @@ internal class AddressSyncModelTest {
val model = createModel(this)
val stack = model.stackNavigation.trackStack()
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_BIOMETRY, replace = false))
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_BIOMETRY, shouldReplace = false))
advanceUntilIdle()
assert(stack == listOf(AddressSyncStep.ASK_NOTIFICATIONS))
@ -70,7 +70,7 @@ internal class AddressSyncModelTest {
val model = createModel(this)
val stack = model.stackNavigation.trackStack()
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_BIOMETRY, replace = false))
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_BIOMETRY, shouldReplace = false))
advanceUntilIdle()
assert(stack == listOf(AddressSyncStep.ADDRESS_SYNC))
@ -83,7 +83,7 @@ internal class AddressSyncModelTest {
val model = createModel(this)
val stack = model.stackNavigation.trackStack()
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_NOTIFICATIONS, replace = false))
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_NOTIFICATIONS, shouldReplace = false))
advanceUntilIdle()
assert(stack == listOf(AddressSyncStep.ASK_NOTIFICATIONS))
@ -96,7 +96,7 @@ internal class AddressSyncModelTest {
val model = createModel(this)
val stack = model.stackNavigation.trackStack()
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_NOTIFICATIONS, replace = false))
model.onIntent(AddressSyncIntent.Next(step = AddressSyncStep.ASK_NOTIFICATIONS, shouldReplace = false))
advanceUntilIdle()
assert(stack == listOf(AddressSyncStep.ADDRESS_SYNC))