mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 02:07:01 +05:30
src: make LobstersRepository a singleton
Earlier both LobstersViewModel and LobstersPagingSource were getting a different instance of LobstersRepository. This lead to cache issues where LobstersPagingSource filled the cache but it was not available to the LobstersViewModel. Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
This commit is contained in:
parent
9ce33bba75
commit
0fcf584b01
4 changed files with 32 additions and 8 deletions
|
@ -5,7 +5,7 @@ import dagger.Lazy
|
|||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ViewModelComponent
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import dev.msfjarvis.lobsters.data.api.LobstersApi
|
||||
import okhttp3.OkHttpClient
|
||||
import retrofit2.Retrofit
|
||||
|
@ -13,7 +13,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory
|
|||
import retrofit2.create
|
||||
|
||||
@Module
|
||||
@InstallIn(ViewModelComponent::class)
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object ApiModule {
|
||||
|
||||
@Provides
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue