Good morning, I am currently trying to implement a...
# moko
u
Good morning, I am currently trying to implement a customer/brand/theme based app. The basic idea is to have a “Base”-Set of colors, images and strings. However, all properties must be overwritable via another set (e.g. override thge logo, but the navigation-drawer-icon should be used from “base”. I would like to do that directly via moko-resources for both platforms. My first approach was to create two library projects that both have Moko resources, but this seems to clash even if I have different `multiplatformResourcesPackage`s. An other way would be to have a “virtual”/merged source
commonMain/ressources/MR
but this would also be quite complex at some point. Which approach do you guys use? Is there anything
a
we use resources in multiple modules and all works fine. just set different package. what exactly not work with different packages?
u
Oh, you are right. (I didn’t override all dimensions of the logo therefore it was not displayed) And afterwards you are doing something like this?
Copy code
painterResource(
try  {
   de.jumero.theme.MR.images.logo
} catch (e : Exception) {
   de.jumero.base.MR.images.logo
})
a
why it should be in this way?
we have resources in multiple modules but this resources is not override eachself
every feature have own set of resources
and access to shared resources
so it's not like your case
u
But unfortunately this is what we need. For instance if customerA wants to override a icon all other customers needs to have this item in the “customer”-resources… In android this could be done by simply adding a resource with the same name into the project itself.
a
i will try to do some experiments to achive this...maybe something will works
are you have android build flavours for android target to achive this?
u
At first I just hoped that the MR resources would be merged if they had the same package - but unfortunately that’s not the case 😉
a
for android it will, just because android works in this way
but for ios we have separated bundles and this bundles can have same names inside
u
but the generated MR-class is not merged, isn’t it? I guess it has been either the one or the other
a
classes not merged, yes.
maybe will work - pass gradle property when run gradle compilation, like
-Presources.variant=base
and base on this property decide what exactly resources library should be added in dependency
not best solution but now i not see some multiplatform way...
u
Hey Aleksey, Thank you! I will give it a try…