LemmyNet / jerboa

A native android app for Lemmy
GNU Affero General Public License v3.0
1.17k stars 167 forks source link

Introduce dependency injection #388

Closed oscarnylander closed 9 months ago

oscarnylander commented 1 year ago

Dependency Injection can:

I recommend hilt, as it builds on Dagger but reduces the undesirable amount of complexity present in setting up Dagger yourself.

oscarnylander commented 1 year ago

@dessalines Since there's some significant work involved in refactoring the app to use Hilt, let me know if you're interested in getting this in. If you do, I can probably get it done, but I'd like to avoid the effort if not.

dessalines commented 1 year ago

Yeah don't start work on this yet... I'm not a huge fan of these annotation-based, dependency injection frameworks, unless room absolutely can't work without it. I've always found them to be less code-traceable, and essentially hacks to make the code look just a little nicer.

It would only be useful for the HTTP and DB singletons, and since most of that work is done already, doesn't seem worth the effort.

oscarnylander commented 1 year ago

Alright.

I think one of the more interesting things that Hilt could provide would be Navigation Destination-scoped ViewModels, which (without looking too closely) would probably solve #402.

dessalines commented 1 year ago

That one hopefully should be solved in the autogen_types branch. I use a better HTTP result sealed class(with empty, loading, success, and failed results), which should handle loading better.

dessalines commented 9 months ago

Stale issue.