Closed JackEblan closed 23 hours ago
I think it's time for me to follow the clean architecture. Move all the contracts to the domain layer. It seems that I am struggling to structure my architecture right now.
I think it's time for me to follow the clean architecture. Move all the contracts to the domain layer. It seems that I am struggling to structure my architecture right now.
Why? For example in this function https://github.com/JackEblan/Geto/blob/250114fea36b485c5754c3bae25a9193887e2ea3/feature/service/src/main/kotlin/com/android/geto/feature/service/ServiceViewModel.kt#L45 I am forced to put a business logic inside the view model. This is from the frameworks and not the UI logic so view model should not handle this. I can't just put this to the domain layer as it will lead to circular dependencies because foreground-service module also depends on the domain module.
The best way to solve this is to move all the interfaces from frameworks to data into the domain layer. This way, I can make use cases more easily as I don't need to just import dependencies. Also domain should not depend on the outside, it's a standalone layer.
Move this to a read only property
https://github.com/JackEblan/Geto/blob/250114fea36b485c5754c3bae25a9193887e2ea3/foreground-service/src/main/kotlin/com/android/geto/foregroundservice/AndroidForegroundServiceManager.kt#L63