-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AND-8917 [Onboarding V2] Entry component + routing
- Loading branch information
Showing
14 changed files
with
149 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ng-v2/api/src/main/kotlin/com/tangem/features/onboarding/v2/OnboardingV2FeatureToggles.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.tangem.features.onboarding.v2 | ||
|
||
interface OnboardingV2FeatureToggles { | ||
val isRewrittenOnboardingCodeInUse: Boolean | ||
val isOnboardingV2Enabled: Boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...in/kotlin/com/tangem/features/onboarding/v2/entry/impl/DefaultOnboardingEntryComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.tangem.features.onboarding.v2.entry.impl | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import com.tangem.core.decompose.context.AppComponentContext | ||
import com.tangem.core.decompose.context.child | ||
import com.tangem.core.ui.extensions.stringReference | ||
import com.tangem.features.onboarding.v2.entry.OnboardingEntryComponent | ||
import com.tangem.features.onboarding.v2.entry.impl.ui.OnboardingEntry | ||
import com.tangem.features.onboarding.v2.stepper.api.OnboardingStepperComponent | ||
import dagger.assisted.Assisted | ||
import dagger.assisted.AssistedFactory | ||
import dagger.assisted.AssistedInject | ||
|
||
internal class DefaultOnboardingEntryComponent @AssistedInject constructor( | ||
@Assisted val context: AppComponentContext, | ||
@Assisted val params: OnboardingEntryComponent.Params, | ||
stepperFactory: OnboardingStepperComponent.Factory, | ||
) : OnboardingEntryComponent, AppComponentContext by context { | ||
|
||
private val stepperComponent = stepperFactory.create( | ||
context = child("stepper"), | ||
params = OnboardingStepperComponent.Params( | ||
scanResponse = params.scanResponse, | ||
initState = OnboardingStepperComponent.StepperState( | ||
currentStep = 0, | ||
steps = 3, | ||
title = stringReference(""), | ||
), | ||
popBack = { router.pop() }, | ||
), | ||
) | ||
|
||
@Composable | ||
override fun Content(modifier: Modifier) { | ||
OnboardingEntry( | ||
modifier = modifier, | ||
stepperContent = { modifierParam -> | ||
stepperComponent.Content(modifierParam) | ||
}, | ||
) | ||
} | ||
|
||
@AssistedFactory | ||
interface Factory : OnboardingEntryComponent.Factory { | ||
override fun create( | ||
context: AppComponentContext, | ||
params: OnboardingEntryComponent.Params, | ||
): DefaultOnboardingEntryComponent | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/di/ComponentModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.tangem.features.onboarding.v2.entry.impl.di | ||
|
||
import com.tangem.features.onboarding.v2.entry.OnboardingEntryComponent | ||
import com.tangem.features.onboarding.v2.entry.impl.DefaultOnboardingEntryComponent | ||
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 bindOnboardingEntryComponent( | ||
factory: DefaultOnboardingEntryComponent.Factory, | ||
): OnboardingEntryComponent.Factory | ||
} |
44 changes: 44 additions & 0 deletions
44
...2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/ui/OnboardingEntry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.tangem.features.onboarding.v2.entry.impl.ui | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.statusBarsPadding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.tangem.core.ui.components.appbar.TangemTopAppBar | ||
import com.tangem.core.ui.components.appbar.models.TopAppBarButtonUM | ||
import com.tangem.core.ui.res.TangemTheme | ||
import com.tangem.core.ui.res.TangemThemePreview | ||
import com.tangem.features.onboarding.v2.impl.R | ||
|
||
@Composable | ||
internal inline fun OnboardingEntry(modifier: Modifier = Modifier, stepperContent: @Composable (Modifier) -> Unit) { | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.statusBarsPadding() | ||
.background(TangemTheme.colors.background.primary), | ||
) { | ||
stepperContent(Modifier.fillMaxWidth()) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun Preview() { | ||
TangemThemePreview { | ||
OnboardingEntry { | ||
TangemTopAppBar( | ||
title = "Onboarding", | ||
startButton = TopAppBarButtonUM( | ||
iconRes = R.drawable.ic_back_24, | ||
enabled = true, | ||
onIconClicked = {}, | ||
), | ||
) | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...c/main/kotlin/com/tangem/features/onboarding/v2/stepper/api/OnboardingStepperComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters