Skip to content

Commit

Permalink
AND-9587 Stories: Implemented module skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
iMaks99 committed Dec 28, 2024
1 parent 30b6b2f commit 0061f75
Show file tree
Hide file tree
Showing 16 changed files with 180 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ dependencies {
implementation(projects.features.onramp.impl)
implementation(projects.features.onboardingV2.api)
implementation(projects.features.onboardingV2.impl)
implementation(projects.features.stories.api)
implementation(projects.features.stories.impl)

/** AndroidX libraries */
implementation(deps.androidx.core.ktx)
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.tangem.features.onramp.component.*
import com.tangem.features.pushnotifications.api.navigation.PushNotificationsRouter
import com.tangem.features.send.api.navigation.SendRouter
import com.tangem.features.staking.api.navigation.StakingRouter
import com.tangem.features.stories.api.component.StoriesComponent
import com.tangem.features.tester.api.TesterRouter
import com.tangem.features.tokendetails.navigation.TokenDetailsRouter
import com.tangem.features.wallet.navigation.WalletRouter
Expand Down Expand Up @@ -57,6 +58,7 @@ internal class ChildFactory @Inject constructor(
private val swapSelectTokensComponentFactory: SwapSelectTokensComponent.Factory,
private val onboardingEntryComponentFactory: OnboardingEntryComponent.Factory,
private val welcomeComponentFactory: WelcomeComponent.Factory,
private val storiesComponentFactory: StoriesComponent.Factory,
private val sendRouter: SendRouter,
private val tokenDetailsRouter: TokenDetailsRouter,
private val walletRouter: WalletRouter,
Expand Down Expand Up @@ -200,6 +202,13 @@ internal class ChildFactory @Inject constructor(
componentFactory = onboardingEntryComponentFactory,
)
}
is AppRoute.Stories -> {
createComponentChild(
contextProvider = contextProvider(route, contextFactory),
params = StoriesComponent.Params,
componentFactory = storiesComponentFactory,
)
}
is AppRoute.AccessCodeRecovery,
is AppRoute.AppCurrencySelector,
is AppRoute.ModalNotification,
Expand Down Expand Up @@ -412,6 +421,13 @@ internal class ChildFactory @Inject constructor(
componentFactory = onboardingEntryComponentFactory,
)
}
is AppRoute.Stories -> {
route.asComponentChild(
contextProvider = contextProvider(route, contextFactory),
params = StoriesComponent.Params,
componentFactory = storiesComponentFactory,
)
}
}
// endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,7 @@ sealed class AppRoute(val path: String) : Route {
AddBackup, // continue backup process for existing wallet 1
}
}

@Serializable
data object Stories : AppRoute(path = "/stories")
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@
{
"name": "NAVIGATION_REFACTORING",
"version": "undefined"
},
{
"name": "STORIES_ENABLED",
"version": "undefined"
}
]
1 change: 1 addition & 0 deletions features/stories/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
16 changes: 16 additions & 0 deletions features/stories/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
id("kotlin-parcelize")
id("configuration")
}

android {
namespace = "com.tangem.features.stories.api"
}

dependencies {
/* Project - Core */
implementation(projects.core.decompose)
implementation(projects.core.ui)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.tangem.features.stories.api

interface StoriesFeatureToggles {

val isFeatureEnabled: Boolean
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tangem.features.stories.api.component

import com.tangem.core.decompose.factory.ComponentFactory
import com.tangem.core.ui.decompose.ComposableContentComponent

interface StoriesComponent : ComposableContentComponent {
interface Factory : ComponentFactory<Params, StoriesComponent>

/**
* Params
*/
data object Params
}
1 change: 1 addition & 0 deletions features/stories/impl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
28 changes: 28 additions & 0 deletions features/stories/impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.stories.impl"
}

dependencies {

implementation(deps.compose.ui)
implementation(deps.compose.material3)

implementation(projects.core.configToggles)
implementation(projects.core.decompose)
implementation(projects.core.ui)

/** Feature modules */
implementation(projects.features.stories.api)

/** DI */
implementation(deps.hilt.android)
kapt(deps.hilt.kapt)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.tangem.features.stories.impl

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.features.stories.api.component.StoriesComponent
import com.tangem.features.stories.impl.ui.StoriesComponentContent
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject

// todo Temporary remove in AND-9353
@Suppress("UnusedPrivateMember")
internal class DefaultStoriesComponent @AssistedInject constructor(
@Assisted appComponentContext: AppComponentContext,
@Assisted params: StoriesComponent.Params,
) : StoriesComponent, AppComponentContext by appComponentContext {

@Composable
override fun Content(modifier: Modifier) {
StoriesComponentContent()
}

@AssistedFactory
interface Factory : StoriesComponent.Factory {
override fun create(context: AppComponentContext, params: StoriesComponent.Params): DefaultStoriesComponent
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.tangem.features.stories.impl

import com.tangem.core.configtoggle.feature.FeatureTogglesManager
import com.tangem.features.stories.api.StoriesFeatureToggles

internal class DefaultStoriesFeatureToggles(
private val featureTogglesManager: FeatureTogglesManager,
) : StoriesFeatureToggles {
override val isFeatureEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled("STORIES_ENABLED")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tangem.features.stories.impl.di

import com.tangem.features.stories.api.component.StoriesComponent
import com.tangem.features.stories.impl.DefaultStoriesComponent
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 StoriesComponentModule {

@Binds
@Singleton
fun bindStoriesComponentFactory(factory: DefaultStoriesComponent.Factory): StoriesComponent.Factory
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.tangem.features.stories.impl.di

import com.tangem.core.configtoggle.feature.FeatureTogglesManager
import com.tangem.features.stories.api.StoriesFeatureToggles
import com.tangem.features.stories.impl.DefaultStoriesFeatureToggles
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 StoriesFeatureModule {

@Provides
@Singleton
fun provideStoriesFeatureToggles(featureTogglesManager: FeatureTogglesManager): StoriesFeatureToggles {
return DefaultStoriesFeatureToggles(featureTogglesManager)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.tangem.features.stories.impl.ui

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun StoriesComponentContent() {
Text("Stories!")
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ include(":features:markets:impl")

include(":features:onramp:api")
include(":features:onramp:impl")

include(":features:stories:api")
include(":features:stories:impl")
// endregion Feature modules

// region Domain modules
Expand Down

0 comments on commit 0061f75

Please # to comment.