AlphaWallet / alpha-wallet-android

An advanced Ethereum mobile wallet
https://www.alphawallet.com
MIT License
584 stars 528 forks source link

Migrate to Latest version of Dagger #2321

Closed JamesSmartCell closed 2 years ago

JamesSmartCell commented 2 years ago

Currently we are stuck on Dagger 2.22 - the latest version (as this issue is written) is 2.35.1 / 2.28.3

To upgrade you can go through this tutorial, as above 2.22 Dagger changes quite a bit:

https://proandroiddev.com/getting-started-with-dagger-2-27-on-android-by-example-8534f468175

After this refactor, the injection code should look a little less complex, and the effort to add a new Activity should be slightly less.

Things to watch out for:

some ViewModels serve multiple activities, for example:

    @ActivityScope
    @ContributesAndroidInjector(modules = TokenFunctionModule.class)
    abstract TokenFunctionActivity bindTokenFunctionActivity();

    @ActivityScope
    @ContributesAndroidInjector(modules = TokenFunctionModule.class)
    abstract FunctionActivity bindFunctionActivity();

    @ActivityScope
    @ContributesAndroidInjector(modules = TokenFunctionModule.class)
    abstract TokenDetailActivity bindTokenDetailActivity();

    @ActivityScope
    @ContributesAndroidInjector(modules = TokenFunctionModule.class)
    abstract TokenActivity bindTokenActivity();

This may be quite a big project - if you encounter difficulties please let me know.

asif-finimble commented 2 years ago

@JamesSmartCell, we need to use dagger-hilt right?

asif-finimble commented 2 years ago

Task Update Jan 19, Wednesday:

asif-finimble commented 2 years ago

References, guides & tutorials used:

asif-finimble commented 2 years ago

Adding new Activity or Fragment & how to inject

Injecting into ViewModels

Injecting into Service(Android)

Component Hierarchy: https://dagger.dev/hilt/components.html#component-lifetimes

asif-finimble commented 2 years ago

Task Update Jan 20:

@JamesSmartCell can you please test it on your end and let me know if I should make any changes?

JamesSmartCell commented 2 years ago

Thanks, I'll check it, it's this branch right:

https://github.com/AlphaWallet/alpha-wallet-android/tree/2321_migrate-dagger-to-latest

asif-finimble commented 2 years ago

Thanks, I'll check it, it's this branch right:

https://github.com/AlphaWallet/alpha-wallet-android/tree/2321_migrate-dagger-to-latest

Yes.