Skip to content

Commit

Permalink
code refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
itszechs committed Jan 21, 2024
1 parent ee2dda4 commit 57a0427
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
16 changes: 0 additions & 16 deletions app/src/main/java/zechs/drive/stream/di/ApiModule.kt
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
package zechs.drive.stream.di

import android.content.Context
import com.google.gson.Gson
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import dagger.Lazy
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import zechs.drive.stream.BuildConfig
import zechs.drive.stream.data.local.AccountsDao
import zechs.drive.stream.data.model.StarredAdapter
import zechs.drive.stream.data.remote.DriveApi
import zechs.drive.stream.data.remote.GithubApi
import zechs.drive.stream.data.remote.TokenApi
import zechs.drive.stream.data.repository.DriveRepository
import zechs.drive.stream.data.repository.GithubRepository
import zechs.drive.stream.data.repository.TokenAuthenticator
import zechs.drive.stream.utils.FirstRunProfileMigrator
import zechs.drive.stream.utils.SessionManager
import zechs.drive.stream.utils.util.Constants.Companion.GITHUB_API
import zechs.drive.stream.utils.util.Constants.Companion.GOOGLE_ACCOUNTS_URL
Expand Down Expand Up @@ -156,15 +151,4 @@ object ApiModule {
return GithubRepository(githubApi)
}

@Provides
@Singleton
fun provideFirstRunProfileMigrator(
@ApplicationContext appContext: Context,
gson: Gson,
sessionManager: SessionManager,
accountsManager: AccountsDao,
): FirstRunProfileMigrator {
return FirstRunProfileMigrator(appContext, gson, sessionManager, accountsManager)
}

}
12 changes: 12 additions & 0 deletions app/src/main/java/zechs/drive/stream/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import zechs.drive.stream.data.local.AccountsDao
import zechs.drive.stream.utils.AppSettings
import zechs.drive.stream.utils.FirstRunProfileMigrator
import zechs.drive.stream.utils.SessionManager
import javax.inject.Singleton

Expand Down Expand Up @@ -37,4 +38,15 @@ object AppModule {
@ApplicationContext appContext: Context
): AppSettings = AppSettings(appContext)

@Provides
@Singleton
fun provideFirstRunProfileMigrator(
@ApplicationContext appContext: Context,
gson: Gson,
sessionManager: SessionManager,
accountsManager: AccountsDao,
): FirstRunProfileMigrator {
return FirstRunProfileMigrator(appContext, gson, sessionManager, accountsManager)
}

}

0 comments on commit 57a0427

Please sign in to comment.