Skip to content

Commit c11275b

Browse files
committed
📦 NEW: inject repository using hilt
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
1 parent 9a9d2c6 commit c11275b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.github.swent.echo.di
2+
3+
import android.app.Application
4+
import com.github.swent.echo.data.repository.Repository
5+
import com.github.swent.echo.data.repository.RepositoryImpl
6+
import com.github.swent.echo.data.repository.datasources.RemoteDataSource
7+
import com.github.swent.echo.data.repository.datasources.Supabase
8+
import dagger.Module
9+
import dagger.Provides
10+
import dagger.hilt.InstallIn
11+
import dagger.hilt.components.SingletonComponent
12+
import io.github.jan.supabase.SupabaseClient
13+
14+
@Module
15+
@InstallIn(SingletonComponent::class)
16+
object RepositoryModule {
17+
18+
@Provides
19+
fun provideRepository(application: Application, supabaseClient: SupabaseClient): Repository {
20+
val remoteDataSource: RemoteDataSource = Supabase(supabaseClient)
21+
22+
return RepositoryImpl(remoteDataSource)
23+
}
24+
}

0 commit comments

Comments
 (0)