Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split app into modules #131

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Split app into modules #131

wants to merge 12 commits into from

Conversation

mdrlzy
Copy link
Member

@mdrlzy mdrlzy commented Nov 16, 2024

Modules structure

ARK-Rate
├── app
├── core
│   ├── data
│   ├── db
│   ├── di
│   ├── domain
│   └── presentation
├── feature
│   ├── pairalert
│   ├── portfolio
│   ├── quick
│   ├── quickwidget
│   ├── search
│   └── settings
├── fiaticons
└── cryptoicons

Resources

All resources are located in :core:presentation. Keeping resources in feature modules and ensuring that they are not duplicated will be a mess. We can easily access them via type aliases.

CoreR.kt

typealias CoreRString = R.string
typealias CoreRDrawable = R.drawable

Navigation

Feature modules generate compose-destination classes. We collect them in app module and create a single graph manually.
compose-destinations library works in destinations mode

ksp {
    arg("compose-destinations.mode", "destinations")
}

DI

We have CoreComponent in :core:di that contains common dependencies with Singleton scope. Feature modules create own components that depend on CoreComponent with own scopes. App holds CoreComponent and provides it.

Feature component are stored in separate object called FeatureComponentHolder inside the module. This is the easiest way to reuse component between compose screens in module.

Notes

  • :core:di and :core:db needed to not expose :core:data module and implementation so feature modules only know about :core:domain and interfaces
  • Build config replaced with BuildConfigFields and BuildConfigFieldsProvider. BuildConfigFieldsProvider created in :core:data module and initialized in app module. So all modules can use the build config of app module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant