-
Notifications
You must be signed in to change notification settings - Fork 0
37 data layer and dagger di #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9b52e77
UPGRADE | #37 Build SetUp for Data layer and DI
AlexisTercero55 3f7e54f
NEW | #38 Dagger implementation
AlexisTercero55 98cb7a6
NEW | #38 Home Module
AlexisTercero55 00e68a4
NEW | #39 Data Layer definition
AlexisTercero55 e418a82
CHANGE | #38 AppScope: MainActivity.kt and DI
AlexisTercero55 9286213
CHANGE | #38 LoginUseCase.kt DI setup
AlexisTercero55 2b3cc42
CHANGE | #38 LogoutUseCase.kt DI setup
AlexisTercero55 e6581ff
CHANGE | #38 LoginViewModel.kt DI setup
AlexisTercero55 d67e147
NEW | #40 SessionState.kt Auth feature
AlexisTercero55 b6b6899
CHANGE | #38 HeaderViewModel DI SetUp
AlexisTercero55 c27c140
CHANGE | #38 HomeViewModel DI SetUp
AlexisTercero55 7c0e954
UPDATE | #37 Add google-services to CI/CD
AlexisTercero55 193f8d4
NEW | #37 DaggerGraphTest
AlexisTercero55 f6648b7
FIX | #37 DaggerGraphTest
AlexisTercero55 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -30,3 +30,4 @@ replay_pid* | |
| .idea/ | ||
| .gradle/ | ||
| build/ | ||
| /app/google-services.json | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,33 @@ | ||
| /** | ||
| * ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗██╗ ██╗██████╗ ██╗ ██████╗ | ||
| * ██╔══██╗██║ ██║██╔═══██╗ ██╔════╝╚══██╔══╝██║ ██║██╔══██╗██║██╔═══██╗ | ||
| * ██████╔╝███████║██║ ██║ ███████╗ ██║ ██║ ██║██║ ██║██║██║ ██║ | ||
| * ██╔══██╗██╔══██║██║ ██║ ╚════██║ ██║ ██║ ██║██║ ██║██║██║ ██║ | ||
| * ██║ ██║██║ ██║╚██████╔╝ ███████║ ██║ ╚██████╔╝██████╔╝██║╚██████╔╝ | ||
| * ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ | ||
| * | ||
| * ========================================================================== | ||
| * File: RhoStudioUIApp.kt | ||
| * Author: Alexis Tercero | ||
| * Email: alexis.tercero@rho.studio | ||
| * Date: 2026-08-17 | ||
| * ========================================================================== | ||
| * Description: | ||
| * Main Application class for RhoStudio UI. Responsible for initializing | ||
| * core services including Firebase and the dependency injection framework. | ||
| * ========================================================================== | ||
| */ | ||
| package com.rho.studio.ui | ||
|
|
||
| import android.app.Application | ||
| import com.google.firebase.FirebaseApp | ||
| import com.rho.studio.ui.di.ComponentManager | ||
|
|
||
| class RhoStudioUIApp : Application() { | ||
|
|
||
| override fun onCreate() { | ||
| super.onCreate() | ||
| FirebaseApp.initializeApp(this) | ||
| ComponentManager.init(this) | ||
| } | ||
| } |
This file contains hidden or 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,45 @@ | ||
| /** | ||
| * ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗██╗ ██╗██████╗ ██╗ ██████╗ | ||
| * ██╔══██╗██║ ██║██╔═══██╗ ██╔════╝╚══██╔══╝██║ ██║██╔══██╗██║██╔═══██╗ | ||
| * ██████╔╝███████║██║ ██║ ███████╗ ██║ ██║ ██║██║ ██║██║██║ ██║ | ||
| * ██╔══██╗██╔══██║██║ ██║ ╚════██║ ██║ ██║ ██║██║ ██║██║██║ ██║ | ||
| * ██║ ██║██║ ██║╚██████╔╝ ███████║ ██║ ╚██████╔╝██████╔╝██║╚██████╔╝ | ||
| * ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ | ||
| * | ||
| * ============================================================================================== | ||
| * File: AppComponent.kt | ||
| * Author: Alexis Tercero | ||
| * Email: alexis.tercero@rho.studio | ||
| * Date: 2026-08-14 | ||
| * ============================================================================================== | ||
| * Description: Root Dagger component for the application. | ||
| * Responsible for bridging the core data layers with the UI layer and | ||
| * managing the application-wide dependency graph. | ||
| * ============================================================================================== | ||
| */ | ||
| package com.rho.studio.ui.di | ||
|
|
||
| import com.rho.studio.ui.MainActivity | ||
| import com.rho.studio.ui.core.data.di.CoreComponent | ||
| import com.rho.studio.ui.core.ui.di.DaggerViewModelFactory | ||
| import com.rho.studio.ui.features.auth.di.AuthModule | ||
| import dagger.Component | ||
| import javax.inject.Scope | ||
|
|
||
| @Scope | ||
| @Retention(AnnotationRetention.RUNTIME) | ||
| annotation class AppScope | ||
|
|
||
| @AppScope | ||
| @Component( | ||
| dependencies = [CoreComponent::class], | ||
| modules = [AuthModule::class, com.rho.studio.ui.core.ui.di.UIModule::class] | ||
| ) | ||
| interface AppComponent { | ||
| fun inject(activity: MainActivity) | ||
|
|
||
| // Exposed for UserComponent | ||
| fun coreComponent(): CoreComponent | ||
|
|
||
| fun viewModelFactory(): DaggerViewModelFactory | ||
| } |
60 changes: 60 additions & 0 deletions
60
app/src/main/java/com/rho/studio/ui/di/ComponentManager.kt
This file contains hidden or 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,60 @@ | ||
| /** | ||
| * ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗██╗ ██╗██████╗ ██╗ ██████╗ | ||
| * ██╔══██╗██║ ██║██╔═══██╗ ██╔════╝╚══██╔══╝██║ ██║██╔══██╗██║██╔═══██╗ | ||
| * ██████╔╝███████║██║ ██║ ███████╗ ██║ ██║ ██║██║ ██║██║██║ ██║ | ||
| * ██╔══██╗██╔══██║██║ ██║ ╚════██║ ██║ ██║ ██║██║ ██║██║██║ ██║ | ||
| * ██║ ██║██║ ██║╚██████╔╝ ███████║ ██║ ╚██████╔╝██████╔╝██║╚██████╔╝ | ||
| * ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ | ||
| * | ||
| * ============================================================================================== | ||
| * File: ComponentManager.kt | ||
| * Author: Alexis Tercero | ||
| * Email: alexis.tercero@rho.studio | ||
| * Date: 2026-08-14 | ||
| * ============================================================================================== | ||
| * Description: Centralized manager for the Dagger component hierarchy. | ||
| * Handles the lifecycle of global (App) and scoped (User) components. | ||
| * Enables session-based dependency injection by providing mechanisms to | ||
| * initialize and tear down the UserComponent upon login/logout. | ||
| * ============================================================================================== | ||
| */ | ||
| package com.rho.studio.ui.di | ||
|
|
||
| import android.content.Context | ||
| import com.rho.studio.ui.core.data.di.CoreComponent | ||
| import com.rho.studio.ui.core.data.di.CoreModule | ||
| import com.rho.studio.ui.core.data.di.DaggerCoreComponent | ||
|
|
||
| object ComponentManager { | ||
|
|
||
| private lateinit var coreComponent: CoreComponent | ||
| private lateinit var appComponent: AppComponent | ||
| private var userComponent: UserComponent? = null | ||
|
|
||
| fun init(context: Context) { | ||
| CoreModule.init(context) | ||
| coreComponent = DaggerCoreComponent.builder() | ||
| .build() | ||
|
|
||
| appComponent = DaggerAppComponent.builder() | ||
| .coreComponent(coreComponent) | ||
| .build() | ||
| } | ||
|
|
||
| fun getAppComponent(): AppComponent = appComponent | ||
|
|
||
| fun createUserComponent(): UserComponent { | ||
| if (userComponent == null) { | ||
| userComponent = DaggerUserComponent.builder() | ||
| .coreComponent(coreComponent) | ||
| .build() | ||
| } | ||
| return userComponent!! | ||
| } | ||
|
|
||
| fun destroyUserComponent() { | ||
| userComponent = null | ||
| } | ||
|
|
||
| fun getUserComponent(): UserComponent? = userComponent | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.