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

Merged
merged 17 commits into from
Dec 14, 2024
Merged

Split app into modules #131

merged 17 commits into from
Dec 14, 2024

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.

Copy link
Collaborator

@hieuwu hieuwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependencies graph look good & packaging very clean. 👍

@shubertm
Copy link
Member

shubertm commented Dec 3, 2024

SVID_20241203_151830_1.mp4
  • Trying to change the "from currency" creates new "to currency"

@mdrlzy mdrlzy merged commit b167cc6 into main Dec 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants