-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hilt): adds basic dependency injection (#6)
- Loading branch information
Showing
8 changed files
with
95 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
app/src/main/java/us/kikin/android/gamingbacklog/BacklogApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package us.kikin.android.gamingbacklog | ||
|
||
import android.app.Application | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class BacklogApplication: Application() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/src/main/java/us/kikin/android/gamingbacklog/di/AppModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package us.kikin.android.gamingbacklog.di | ||
|
||
import android.app.Application | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import us.kikin.android.gamingbacklog.data.manager.LocalUserManagerImpl | ||
import us.kikin.android.gamingbacklog.domain.manager.LocalUserManager | ||
import us.kikin.android.gamingbacklog.domain.usecase.AppEntryUseCases | ||
import us.kikin.android.gamingbacklog.domain.usecase.ReadAppEntry | ||
import us.kikin.android.gamingbacklog.domain.usecase.SaveAppEntry | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object AppModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideLocalUserManager( | ||
application: Application | ||
): LocalUserManager = LocalUserManagerImpl(application) | ||
|
||
|
||
@Provides | ||
@Singleton | ||
fun provideAppEntryUseCases( | ||
localUserManager: LocalUserManager | ||
): AppEntryUseCases = AppEntryUseCases( | ||
readAppEntry = ReadAppEntry(localUserManager), | ||
saveAppEntry = SaveAppEntry(localUserManager) | ||
) | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/us/kikin/android/gamingbacklog/domain/usecase/AppEntryUseCases.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package us.kikin.android.gamingbacklog.domain.usecase | ||
|
||
data class AppEntryUseCases( | ||
val readAppEntry: ReadAppEntry, | ||
val saveAppEntry: SaveAppEntry, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters