To resolve an image URL by width and aspect ratio I need to know the specific image URL schema that my image API uses. The width and aspect ratio is known in my UI module while the schema specification is known in my data module each of which should be agnostic to one another.
So far I defined an ImageUrlResolver interface with a resolve method residing in data, that is implemented by an ImageUrlResolverImpl that knows how to resolve image URLs provided by the backend. In my dagger DataModule I created a method provideImageUrlResolver that provides a Singleton instance of the ImageUrlResolverImpl.
In order to keep the separation between UI and data layer I would like to implement a ImageUrlUtil singleton in my domain layer that should be accessible from an Image Composable residing in my UI layer. However injecting a kotlin object doesn't seem to be an option available with dagger.
I could create a GetImageUrlResolver class that can be injected to my ViewModels so I can pass references of ImageUrlResolver down to my ImageComposable. As every Screen of my App has images though I would not only have to inject this class into every ViewModel but would also have to pass down the reference the whole layout tree to my Image Composable.
Are there any viable solutions for the problem I am facing?