Use Dagger Hilt for dependency injection

This gets rid of our own janky dependency injection through the AegisApplication class
This commit is contained in:
Alexander Bakker 2022-02-06 19:00:01 +01:00
parent 927f5f2bd5
commit 71f2b54deb
42 changed files with 1157 additions and 977 deletions

View file

@ -0,0 +1,35 @@
package com.beemdevelopment.aegis;
import android.content.Context;
import com.beemdevelopment.aegis.icons.IconPackManager;
import com.beemdevelopment.aegis.vault.VaultManager;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.android.qualifiers.ApplicationContext;
import dagger.hilt.components.SingletonComponent;
@Module
@InstallIn(SingletonComponent.class)
public class AegisModule {
@Provides
@Singleton
public static IconPackManager provideIconPackManager(@ApplicationContext Context context) {
return new IconPackManager(context);
}
@Provides
@Singleton
public static VaultManager provideVaultManager(@ApplicationContext Context context) {
return new VaultManager(context);
}
@Provides
public static Preferences providePreferences(@ApplicationContext Context context) {
return new Preferences(context);
}
}