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

Handle different build flavors resources #742

Open
ahmedsalemelzeiny opened this issue Jun 27, 2024 · 1 comment
Open

Handle different build flavors resources #742

ahmedsalemelzeiny opened this issue Jun 27, 2024 · 1 comment

Comments

@ahmedsalemelzeiny
Copy link

Hi, I'm developing a new Compose app with multiple flavors, and each flavor may require different values for strings, images, or assets.

How can I manage this using Moko-Resources?

@Alex009
Copy link
Member

Alex009 commented Jun 28, 2024

hello. different flavors exist only on android, so you cant use this feature in multiplatform module.
but i think you can reimplement it with different gradle modules.

android-app
ios-app
shared
shared-flavor-1
shared-flavor-2

shared-flavor-1, shared-flavor-2 declare api dependency to shared

android-app can be configured with android build-flavors and declare dependency like:
flavor1Implementation(shared-flavor-1)
flavor2Implementation(shared-flavor-2)
implementation(shared)

in ios-app you can use separated targets - flavor1App, flavor2App. that will use two different frameworks - from shared-flavor-1 and shared-flavor-2.

in code you should use dependency inversion to provide flavor-specific resources from shared-flavor-1/shared-flavor-2 to shared

it's not so simple as with android flavors, but in this case you have quarantee that used resources really exist in specific build variant

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

No branches or pull requests

2 participants