Skip to content
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

Update dagger to v2.48 #3066

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ androidx-lifecycle = "2.6.1"
androidx-room = "2.5.2"
androidx-viewpager2 = "1.0.0"
androidx-work = "2.8.1"
dagger = "2.47"
dagger = "2.48"
eventbus = "3.3.1"
facebook = "16.2.0"
facebook-flipper = "0.213.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class AppsFlyerModule {
@Binds
@IntoSet
@EagerSingleton(threadMode = EagerSingleton.ThreadMode.MAIN)
abstract fun AppsFlyerAnalyticsService.eagerSingleton(): Any
abstract fun eagerSingleton(service: AppsFlyerAnalyticsService): Any

@Multibinds
abstract fun deepLinkResolvers(): Set<AppsFlyerDeepLinkResolver>
Expand Down
22 changes: 12 additions & 10 deletions library/api/src/main/kotlin/org/cru/godtools/api/ApiModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,43 +112,45 @@ object ApiModule {

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.analyticsApi() = create<AnalyticsApi>()
fun analyticsApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): AnalyticsApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.attachmentsApi() = create<AttachmentsApi>()
fun attachmentsApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): AttachmentsApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.authApi() = create<AuthApi>()
fun authApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): AuthApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.followupApi() = create<FollowupApi>()
fun followupApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): FollowupApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.languagesApi() = create<LanguagesApi>()
fun languagesApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): LanguagesApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.toolsApi() = create<ToolsApi>()
fun toolsApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): ToolsApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.translationsApi() = create<TranslationsApi>()
fun translationsApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): TranslationsApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API_AUTHENTICATED) Retrofit.userApi() = create<UserApi>()
fun userApi(@Named(MOBILE_CONTENT_API_AUTHENTICATED) retrofit: Retrofit): UserApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API_AUTHENTICATED) Retrofit.userCountersApi() = create<UserCountersApi>()
fun userCountersApi(
@Named(MOBILE_CONTENT_API_AUTHENTICATED) retrofit: Retrofit,
): UserCountersApi = retrofit.create()

@Provides
@Reusable
fun @receiver:Named(MOBILE_CONTENT_API) Retrofit.viewsApi() = create<ViewsApi>()
fun viewsApi(@Named(MOBILE_CONTENT_API) retrofit: Retrofit): ViewsApi = retrofit.create()

@Provides
@Singleton
Expand Down
44 changes: 24 additions & 20 deletions library/db/src/main/kotlin/org/cru/godtools/db/DatabaseModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,75 +40,79 @@ object DatabaseModule {

@Provides
@Reusable
internal fun GodToolsRoomDatabase.attachmentsRepository(legacyDb: GodToolsDatabase): AttachmentsRepository {
internal fun attachmentsRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): AttachmentsRepository {
legacyDb.triggerDataMigration()
return attachmentsRepository
return db.attachmentsRepository
}

@Provides
@Reusable
internal fun LegacyDownloadedFilesRepository.downloadedFilesRepository(
internal fun downloadedFilesRepository(
repository: LegacyDownloadedFilesRepository,
legacyDb: GodToolsDatabase,
): DownloadedFilesRepository {
legacyDb.triggerDataMigration()
return this
return repository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.languagesRepository(legacyDb: GodToolsDatabase): LanguagesRepository {
internal fun languagesRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): LanguagesRepository {
legacyDb.triggerDataMigration()
return languagesRepository
return db.languagesRepository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.followupsRepository(legacyDb: GodToolsDatabase): FollowupsRepository {
internal fun followupsRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): FollowupsRepository {
legacyDb.triggerDataMigration()
return followupsRepository
return db.followupsRepository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.globalActivityRepository(legacyDb: GodToolsDatabase): GlobalActivityRepository {
internal fun globalActivityRepository(
db: GodToolsRoomDatabase,
legacyDb: GodToolsDatabase,
): GlobalActivityRepository {
legacyDb.triggerDataMigration()
return globalActivityRepository
return db.globalActivityRepository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.trainingTipsRepository(legacyDb: GodToolsDatabase): TrainingTipsRepository {
internal fun trainingTipsRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): TrainingTipsRepository {
legacyDb.triggerDataMigration()
return trainingTipsRepository
return db.trainingTipsRepository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.userRepository(): UserRepository = userRepository
internal fun userRepository(db: GodToolsRoomDatabase): UserRepository = db.userRepository

@Provides
@Reusable
internal fun GodToolsRoomDatabase.userCountersRepository(legacyDb: GodToolsDatabase): UserCountersRepository {
internal fun userCountersRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): UserCountersRepository {
legacyDb.triggerDataMigration()
return userCountersRepository
return db.userCountersRepository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.lastSyncTimeRepository(): LastSyncTimeRepository = lastSyncTimeRepository
internal fun lastSyncTimeRepository(db: GodToolsRoomDatabase): LastSyncTimeRepository = db.lastSyncTimeRepository

@Provides
@Reusable
internal fun GodToolsRoomDatabase.toolsRepository(legacyDb: GodToolsDatabase): ToolsRepository {
internal fun toolsRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): ToolsRepository {
legacyDb.triggerDataMigration()
return toolsRepository
return db.toolsRepository
}

@Provides
@Reusable
internal fun GodToolsRoomDatabase.translationsRepository(legacyDb: GodToolsDatabase): TranslationsRepository {
internal fun translationsRepository(db: GodToolsRoomDatabase, legacyDb: GodToolsDatabase): TranslationsRepository {
legacyDb.triggerDataMigration()
return translationsRepository
return db.translationsRepository
}

private fun GodToolsDatabase.triggerDataMigration() {
Expand Down