diff --git a/app/build.gradle b/app/build.gradle index a5901449dd2a..d5f75aff4631 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' +apply plugin: 'com.squareup.anvil' apply from: '../versioning.gradle' apply from: "$rootDir/spotless.gradle" @@ -19,7 +20,7 @@ android { targetSdkVersion target_sdk versionCode buildVersionCode() versionName buildVersionName() - testInstrumentationRunner "com.duckduckgo.app.TestRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" archivesBaseName = "duckduckgo-$versionName" vectorDrawables.useSupportLibrary = true @@ -114,6 +115,7 @@ android { dependencies { implementation project(path: ':statistics') implementation project(path: ':common') + implementation project(path: ':di') implementation AndroidX.legacy.supportV4 debugImplementation Square.leakCanary.android @@ -180,10 +182,7 @@ dependencies { implementation AndroidX.work.rxJava2 // Dagger - kapt Google.dagger.android.processor kapt Google.dagger.compiler - kaptAndroidTest "com.google.dagger:dagger-android-processor:_" - kaptAndroidTest "com.google.dagger:dagger-compiler:_" // Glide implementation "com.github.bumptech.glide:glide:_" diff --git a/app/src/androidTest/java/com/duckduckgo/app/TestApplication.kt b/app/src/androidTest/java/com/duckduckgo/app/TestApplication.kt deleted file mode 100644 index 56d7c7580aae..000000000000 --- a/app/src/androidTest/java/com/duckduckgo/app/TestApplication.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.duckduckgo.app - -import com.duckduckgo.app.di.DaggerTestAppComponent -import com.duckduckgo.app.global.DuckDuckGoApplication -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.test.TestCoroutineScope - -class TestApplication : DuckDuckGoApplication() { - - /** - * Use TestAppComponents for android tests which lets us provide alternative test modules - * - * See [com.duckduckgo.app.di.TestAppComponent] - */ - - @ExperimentalCoroutinesApi - private val applicationCoroutineScope = TestCoroutineScope(SupervisorJob()) - - @ExperimentalCoroutinesApi - override fun configureDependencyInjection() { - daggerAppComponent = DaggerTestAppComponent.builder() - .application(this) - .applicationCoroutineScope(applicationCoroutineScope) - .build() - daggerAppComponent.inject(this) - } -} diff --git a/app/src/androidTest/java/com/duckduckgo/app/TestExtensions.kt b/app/src/androidTest/java/com/duckduckgo/app/TestExtensions.kt index 254a8d117ae6..afa35bfc7e8f 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/TestExtensions.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/TestExtensions.kt @@ -20,7 +20,8 @@ import androidx.annotation.UiThread import androidx.lifecycle.LiveData import androidx.lifecycle.Observer import androidx.test.platform.app.InstrumentationRegistry -import com.duckduckgo.app.di.TestAppComponent +import com.duckduckgo.app.di.AppComponent +import com.duckduckgo.app.global.DuckDuckGoApplication import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit @@ -38,10 +39,10 @@ fun LiveData.blockingObserve(): T? { return value } -fun getApp(): TestApplication { - return InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as TestApplication +fun getApp(): DuckDuckGoApplication { + return InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as DuckDuckGoApplication } -fun getDaggerComponent(): TestAppComponent { - return getApp().daggerAppComponent as TestAppComponent +fun getDaggerComponent(): AppComponent { + return getApp().daggerAppComponent as AppComponent } diff --git a/app/src/androidTest/java/com/duckduckgo/app/di/StubAppConfigurationDownloadModule.kt b/app/src/androidTest/java/com/duckduckgo/app/di/StubAppConfigurationDownloadModule.kt index 0676b903d445..0c540d3c9d98 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/di/StubAppConfigurationDownloadModule.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/di/StubAppConfigurationDownloadModule.kt @@ -17,11 +17,17 @@ package com.duckduckgo.app.di import com.duckduckgo.app.job.ConfigurationDownloader +import com.duckduckgo.di.scopes.AppObjectGraph +import com.squareup.anvil.annotations.ContributesTo import dagger.Module import dagger.Provides import io.reactivex.Completable @Module +@ContributesTo( + scope = AppObjectGraph::class, + replaces = [AppConfigurationDownloaderModule::class] +) class StubAppConfigurationDownloadModule { @Provides diff --git a/app/src/androidTest/java/com/duckduckgo/app/di/StubDatabaseModule.kt b/app/src/androidTest/java/com/duckduckgo/app/di/StubDatabaseModule.kt index 35cd2ff24f59..aee25ef32db0 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/di/StubDatabaseModule.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/di/StubDatabaseModule.kt @@ -22,11 +22,17 @@ import androidx.room.Room import com.duckduckgo.app.browser.httpauth.RealWebViewHttpAuthStore import com.duckduckgo.app.browser.httpauth.WebViewHttpAuthStore import com.duckduckgo.app.global.db.AppDatabase +import com.duckduckgo.di.scopes.AppObjectGraph +import com.squareup.anvil.annotations.ContributesTo import dagger.Module import dagger.Provides import javax.inject.Singleton @Module(includes = [DaoModule::class]) +@ContributesTo( + scope = AppObjectGraph::class, + replaces = [DatabaseModule::class] +) class StubDatabaseModule { @Provides diff --git a/app/src/androidTest/java/com/duckduckgo/app/di/StubJobSchedulerModule.kt b/app/src/androidTest/java/com/duckduckgo/app/di/StubJobSchedulerModule.kt index dd7a98da7448..a348f8355dd9 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/di/StubJobSchedulerModule.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/di/StubJobSchedulerModule.kt @@ -25,11 +25,17 @@ import com.duckduckgo.app.job.AndroidWorkScheduler import com.duckduckgo.app.job.JobCleaner import com.duckduckgo.app.job.WorkScheduler import com.duckduckgo.app.notification.AndroidNotificationScheduler +import com.duckduckgo.di.scopes.AppObjectGraph +import com.squareup.anvil.annotations.ContributesTo import dagger.Module import dagger.Provides import javax.inject.Singleton @Module +@ContributesTo( + scope = AppObjectGraph::class, + replaces = [JobsModule::class] +) class StubJobSchedulerModule { @Singleton diff --git a/app/src/androidTest/java/com/duckduckgo/app/di/StubStatisticsModule.kt b/app/src/androidTest/java/com/duckduckgo/app/di/StubStatisticsModule.kt index 79d9af5bc4b7..9644040acab0 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/di/StubStatisticsModule.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/di/StubStatisticsModule.kt @@ -26,6 +26,8 @@ import com.duckduckgo.app.statistics.api.StatisticsService import com.duckduckgo.app.statistics.api.StatisticsUpdater import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.app.statistics.store.StatisticsDataStore +import com.duckduckgo.di.scopes.AppObjectGraph +import com.squareup.anvil.annotations.ContributesTo import dagger.Module import dagger.Provides import io.reactivex.Completable @@ -33,6 +35,10 @@ import retrofit2.Retrofit import javax.inject.Singleton @Module +@ContributesTo( + scope = AppObjectGraph::class, + replaces = [StatisticsModule::class] +) class StubStatisticsModule { @Provides diff --git a/app/src/androidTest/java/com/duckduckgo/app/di/TestAppComponent.kt b/app/src/androidTest/java/com/duckduckgo/app/di/TestAppComponent.kt deleted file mode 100644 index 3a085449c413..000000000000 --- a/app/src/androidTest/java/com/duckduckgo/app/di/TestAppComponent.kt +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.duckduckgo.app.di - -import android.app.Application -import com.duckduckgo.app.browser.autocomplete.BrowserAutoCompleteModule -import com.duckduckgo.app.browser.certificates.CertificateTrustedStoreModule -import com.duckduckgo.app.browser.di.BrowserModule -import com.duckduckgo.app.browser.favicon.FaviconModule -import com.duckduckgo.app.browser.rating.di.RatingModule -import com.duckduckgo.app.global.exception.UncaughtExceptionModule -import com.duckduckgo.app.global.plugins.worker.WorkerPluginsModule -import com.duckduckgo.app.httpsupgrade.di.HttpsUpgraderModule -import com.duckduckgo.app.onboarding.di.OnboardingModule -import com.duckduckgo.app.onboarding.di.WelcomePageModule -import com.duckduckgo.app.surrogates.di.ResourceSurrogateModule -import com.duckduckgo.app.trackerdetection.di.TrackerDetectionModule -import com.duckduckgo.app.usage.di.AppUsageModule -import dagger.BindsInstance -import dagger.Component -import dagger.android.support.AndroidSupportInjectionModule -import kotlinx.coroutines.CoroutineScope -import retrofit2.Retrofit -import javax.inject.Named -import javax.inject.Singleton - -@Singleton -@Component( - modules = [ - - /* test doubled modules */ - StubDatabaseModule::class, - StubJobSchedulerModule::class, - StubAppConfigurationDownloadModule::class, - StubStatisticsModule::class, - - /* real modules */ - WorkerPluginsModule::class, - ApplicationModule::class, - WorkerModule::class, - AndroidBindingModule::class, - AndroidSupportInjectionModule::class, - NetworkModule::class, - StoreModule::class, - JsonModule::class, - SystemComponentsModule::class, - BrowserModule::class, - BrowserAutoCompleteModule::class, - HttpsUpgraderModule::class, - ResourceSurrogateModule::class, - TrackerDetectionModule::class, - NotificationModule::class, - OnboardingModule::class, - VariantModule::class, - FaviconModule::class, - PrivacyModule::class, - WidgetModule::class, - RatingModule::class, - AppUsageModule::class, - FileModule::class, - UncaughtExceptionModule::class, - StoreReferralModule::class, - CoroutinesModule::class, - CertificateTrustedStoreModule::class, - WelcomePageModule::class - ] -) -interface TestAppComponent : AppComponent { - - @Component.Builder - interface Builder { - - @BindsInstance - fun application(application: Application): Builder - - @BindsInstance - fun applicationCoroutineScope(@AppCoroutineScope applicationCoroutineScope: CoroutineScope): Builder - - fun build(): TestAppComponent - } - - @Named("api") - fun retrofit(): Retrofit -} diff --git a/app/src/main/java/com/duckduckgo/app/di/AndroidBindingModule.kt b/app/src/main/java/com/duckduckgo/app/di/AndroidBindingModule.kt deleted file mode 100644 index d92de0e486a6..000000000000 --- a/app/src/main/java/com/duckduckgo/app/di/AndroidBindingModule.kt +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2017 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.duckduckgo.app.di - -import com.duckduckgo.app.about.AboutDuckDuckGoActivity -import com.duckduckgo.app.bookmarks.ui.BookmarksActivity -import com.duckduckgo.app.brokensite.BrokenSiteActivity -import com.duckduckgo.app.browser.BrowserActivity -import com.duckduckgo.app.browser.BrowserTabFragment -import com.duckduckgo.app.browser.DownloadConfirmationFragment -import com.duckduckgo.app.browser.rating.ui.AppEnjoymentDialogFragment -import com.duckduckgo.app.browser.rating.ui.GiveFeedbackDialogFragment -import com.duckduckgo.app.browser.rating.ui.RateAppDialogFragment -import com.duckduckgo.app.feedback.ui.common.FeedbackActivity -import com.duckduckgo.app.feedback.ui.initial.InitialFeedbackFragment -import com.duckduckgo.app.feedback.ui.negative.brokensite.BrokenSiteNegativeFeedbackFragment -import com.duckduckgo.app.feedback.ui.negative.mainreason.MainReasonNegativeFeedbackFragment -import com.duckduckgo.app.feedback.ui.negative.openended.ShareOpenEndedFeedbackFragment -import com.duckduckgo.app.feedback.ui.negative.subreason.SubReasonNegativeFeedbackFragment -import com.duckduckgo.app.feedback.ui.positive.initial.PositiveFeedbackLandingFragment -import com.duckduckgo.app.fire.FireActivity -import com.duckduckgo.app.fire.fireproofwebsite.ui.FireproofWebsitesActivity -import com.duckduckgo.app.globalprivacycontrol.ui.GlobalPrivacyControlActivity -import com.duckduckgo.app.icon.ui.ChangeIconActivity -import com.duckduckgo.app.job.AppConfigurationJobService -import com.duckduckgo.app.launch.LaunchBridgeActivity -import com.duckduckgo.app.location.ui.LocationPermissionsActivity -import com.duckduckgo.app.location.ui.SiteLocationPermissionDialog -import com.duckduckgo.app.notification.NotificationHandlerService -import com.duckduckgo.app.onboarding.ui.OnboardingActivity -import com.duckduckgo.app.onboarding.ui.page.DefaultBrowserPage -import com.duckduckgo.app.onboarding.ui.page.WelcomePage -import com.duckduckgo.app.privacy.ui.* -import com.duckduckgo.app.settings.SettingsActivity -import com.duckduckgo.app.survey.ui.SurveyActivity -import com.duckduckgo.app.systemsearch.SystemSearchActivity -import com.duckduckgo.app.tabs.ui.TabSwitcherActivity -import com.duckduckgo.app.widget.ui.AddWidgetInstructionsActivity -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AndroidBindingModule { - - /* Activities */ - - @ActivityScoped - @ContributesAndroidInjector - abstract fun launchActivity(): LaunchBridgeActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun onboardingActivityExperiment(): OnboardingActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun systemSearchActivity(): SystemSearchActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun browserActivity(): BrowserActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun tabsActivity(): TabSwitcherActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun privacyDashboardActivity(): PrivacyDashboardActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun scorecardActivity(): ScorecardActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun trackerNetworksActivity(): TrackerNetworksActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun privacyTermsActivity(): PrivacyPracticesActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun whitelistActivity(): WhitelistActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun feedbackActivity(): FeedbackActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun brokenSiteActivity(): BrokenSiteActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun userSurveyActivity(): SurveyActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun addWidgetInstructionsActivity(): AddWidgetInstructionsActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun settingsActivity(): SettingsActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun bookmarksActivity(): BookmarksActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun fireproofWebsitesActivity(): FireproofWebsitesActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun fireActivity(): FireActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun aboutDuckDuckGoActivity(): AboutDuckDuckGoActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun changeAppIconActivity(): ChangeIconActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun locationPermissionsActivity(): LocationPermissionsActivity - - @ActivityScoped - @ContributesAndroidInjector - abstract fun globalPrivacyControlActivity(): GlobalPrivacyControlActivity - - /* Fragments */ - - @ContributesAndroidInjector - abstract fun browserTabFragment(): BrowserTabFragment - - @ContributesAndroidInjector - abstract fun downloadConfirmationFragment(): DownloadConfirmationFragment - - @ContributesAndroidInjector - abstract fun onboardingDefaultBrowserFragment(): DefaultBrowserPage - - @ContributesAndroidInjector - abstract fun appEnjoymentDialogFragment(): AppEnjoymentDialogFragment - - @ContributesAndroidInjector - abstract fun giveFeedbackDialogFragment(): GiveFeedbackDialogFragment - - @ContributesAndroidInjector - abstract fun rateAppDialogFragment(): RateAppDialogFragment - - @ContributesAndroidInjector - abstract fun initialfFeedbackFragment(): InitialFeedbackFragment - - @ContributesAndroidInjector - abstract fun positiveFeedbackLandingFragment(): PositiveFeedbackLandingFragment - - @ContributesAndroidInjector - abstract fun shareOpenEndedPositiveFeedbackFragment(): ShareOpenEndedFeedbackFragment - - @ContributesAndroidInjector - abstract fun mainReasonNegativeFeedbackFragment(): MainReasonNegativeFeedbackFragment - - @ContributesAndroidInjector - abstract fun disambiguationNegativeFeedbackFragment(): SubReasonNegativeFeedbackFragment - - @ContributesAndroidInjector - abstract fun brokenSiteNegativeFeedbackFragment(): BrokenSiteNegativeFeedbackFragment - - @ContributesAndroidInjector - abstract fun welcomePage(): WelcomePage - - @ContributesAndroidInjector - abstract fun siteLocationPermissionDialog(): SiteLocationPermissionDialog - - /* Services */ - - @Suppress("DEPRECATION") - @ContributesAndroidInjector - abstract fun jobService(): AppConfigurationJobService - - @ContributesAndroidInjector - abstract fun notificationHandlerService(): NotificationHandlerService - -} diff --git a/app/src/main/java/com/duckduckgo/app/di/AppComponent.kt b/app/src/main/java/com/duckduckgo/app/di/AppComponent.kt index 824656a6fc9b..4ea47a2ca7f9 100644 --- a/app/src/main/java/com/duckduckgo/app/di/AppComponent.kt +++ b/app/src/main/java/com/duckduckgo/app/di/AppComponent.kt @@ -31,22 +31,26 @@ import com.duckduckgo.app.onboarding.di.WelcomePageModule import com.duckduckgo.app.surrogates.di.ResourceSurrogateModule import com.duckduckgo.app.trackerdetection.di.TrackerDetectionModule import com.duckduckgo.app.usage.di.AppUsageModule +import com.duckduckgo.di.scopes.AppObjectGraph import com.duckduckgo.widget.SearchWidget +import com.squareup.anvil.annotations.MergeComponent import dagger.BindsInstance import dagger.Component import dagger.android.AndroidInjector import dagger.android.support.AndroidSupportInjectionModule import kotlinx.coroutines.CoroutineScope +import retrofit2.Retrofit +import javax.inject.Named import javax.inject.Singleton @Singleton -@Component( +@MergeComponent( + scope = AppObjectGraph::class, modules = [ WorkerPluginsModule::class, ApplicationModule::class, JobsModule::class, WorkerModule::class, - AndroidBindingModule::class, AndroidSupportInjectionModule::class, NetworkModule::class, AppConfigurationDownloaderModule::class, @@ -92,4 +96,8 @@ interface AppComponent : AndroidInjector { } fun inject(searchWidget: SearchWidget) + + // accessor to Retrofit instance for test only only for test + @Named("api") + fun retrofit(): Retrofit } diff --git a/app/src/main/java/com/duckduckgo/app/di/component/AboutDuckDuckGoActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/AboutDuckDuckGoActivityComponent.kt new file mode 100644 index 000000000000..dc5dc5e076c2 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/AboutDuckDuckGoActivityComponent.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.about.AboutDuckDuckGoActivity +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface AboutDuckDuckGoActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface AboutDuckDuckGoActivityComponentProvider { + fun provideAboutDuckDuckGoActivityComponentFactory(): AboutDuckDuckGoActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class AboutDuckDuckGoActivityBindingModule { + @Binds + @IntoMap + @ClassKey(AboutDuckDuckGoActivity::class) + abstract fun bindAboutDuckDuckGoActivityComponentFactory(factory: AboutDuckDuckGoActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/AddWidgetInstructionsActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/AddWidgetInstructionsActivityComponent.kt new file mode 100644 index 000000000000..5e441946077a --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/AddWidgetInstructionsActivityComponent.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.widget.ui.AddWidgetInstructionsActivity +import com.duckduckgo.di.scopes.AppObjectGraph +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface AddWidgetInstructionsActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface AddWidgetInstructionsActivityComponentProvider { + fun provideAddWidgetInstructionsActivityComponentFactory(): AddWidgetInstructionsActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class AddWidgetInstructionsActivityBindingModule { + @Binds + @IntoMap + @ClassKey(AddWidgetInstructionsActivity::class) + abstract fun bindAddWidgetInstructionsActivityComponentFactory(factory: AddWidgetInstructionsActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/AppConfigurationJobServiceComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/AppConfigurationJobServiceComponent.kt new file mode 100644 index 000000000000..557538214754 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/AppConfigurationJobServiceComponent.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.job.AppConfigurationJobService +import com.duckduckgo.di.scopes.AppObjectGraph +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface AppConfigurationJobServiceComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface AppConfigurationJobServiceComponentProvider { + fun provideAppConfigurationJobServiceComponentFactory(): AppConfigurationJobServiceComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class AppConfigurationJobServiceBindingModule { + @Binds + @IntoMap + @ClassKey(AppConfigurationJobService::class) + abstract fun bindAppConfigurationJobServiceComponentFactory(factory: AppConfigurationJobServiceComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/AppEnjoymentDialogFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/AppEnjoymentDialogFragmentComponent.kt new file mode 100644 index 000000000000..108a253b04b7 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/AppEnjoymentDialogFragmentComponent.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.browser.rating.ui.AppEnjoymentDialogFragment +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface AppEnjoymentDialogFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface AppEnjoymentDialogFragmentComponentProvider { + fun provideAppEnjoymentDialogFragmentComponentFactory(): AppEnjoymentDialogFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class AppEnjoymentDialogFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(AppEnjoymentDialogFragment::class) + abstract fun bindAppEnjoymentDialogFragmentComponentFactory(factory: AppEnjoymentDialogFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/BookmarksActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/BookmarksActivityComponent.kt new file mode 100644 index 000000000000..bedd99c7f392 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/BookmarksActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.bookmarks.ui.BookmarksActivity +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface BookmarksActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface BookmarksActivityComponentProvider { + fun provideBookmarksActivityComponentFactory(): BookmarksActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class BookmarksActivityBindingModule { + @Binds + @IntoMap + @ClassKey(BookmarksActivity::class) + abstract fun bindBookmarksActivityComponentFactory(factory: BookmarksActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/BrokenSiteActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/BrokenSiteActivityComponent.kt new file mode 100644 index 000000000000..769046211972 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/BrokenSiteActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.brokensite.BrokenSiteActivity +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface BrokenSiteActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface BrokenSiteActivityComponentProvider { + fun provideBrokenSiteActivityComponentFactory(): BrokenSiteActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class BrokenSiteActivityBindingModule { + @Binds + @IntoMap + @ClassKey(BrokenSiteActivity::class) + abstract fun bindBrokenSiteActivityComponentFactory(factory: BrokenSiteActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/BrokenSiteNegativeFeedbackFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/BrokenSiteNegativeFeedbackFragmentComponent.kt new file mode 100644 index 000000000000..aff14f7835e4 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/BrokenSiteNegativeFeedbackFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.negative.brokensite.BrokenSiteNegativeFeedbackFragment +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface BrokenSiteNegativeFeedbackFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface BrokenSiteNegativeFeedbackFragmentComponentProvider { + fun provideBrokenSiteNegativeFeedbackFragmentComponentFactory(): BrokenSiteNegativeFeedbackFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class BrokenSiteNegativeFeedbackFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(BrokenSiteNegativeFeedbackFragment::class) + abstract fun bindBrokenSiteNegativeFeedbackFragmentComponentFactory(factory: BrokenSiteNegativeFeedbackFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/BrowserActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/BrowserActivityComponent.kt new file mode 100644 index 000000000000..52d401f7a19d --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/BrowserActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.browser.BrowserActivity +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface BrowserActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface BrowserActivityComponentProvider { + fun provideBrowserActivityComponentFactory(): BrowserActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class BrowserActivityBindingModule { + @Binds + @IntoMap + @ClassKey(BrowserActivity::class) + abstract fun bindBrowserActivityComponentFactory(factory: BrowserActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/BrowserTabFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/BrowserTabFragmentComponent.kt new file mode 100644 index 000000000000..e2f3790cc494 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/BrowserTabFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.browser.BrowserTabFragment +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface BrowserTabFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface BrowserTabFragmentComponentProvider { + fun provideBrowserTabFragmentComponentFactory(): BrowserTabFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class BrowserTabFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(BrowserTabFragment::class) + abstract fun bindBrowserTabFragmentComponentFactory(factory: BrowserTabFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/ChangeIconActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/ChangeIconActivityComponent.kt new file mode 100644 index 000000000000..3d77e7400b5b --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/ChangeIconActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.icon.ui.ChangeIconActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface ChangeIconActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface ChangeIconActivityComponentProvider { + fun provideChangeIconActivityComponentFactory(): ChangeIconActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class ChangeIconActivityBindingModule { + @Binds + @IntoMap + @ClassKey(ChangeIconActivity::class) + abstract fun bindChangeIconActivityComponentFactory(factory: ChangeIconActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/DefaultBrowserPageComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/DefaultBrowserPageComponent.kt new file mode 100644 index 000000000000..1c8c05a1bf2b --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/DefaultBrowserPageComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.onboarding.ui.page.DefaultBrowserPage +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface DefaultBrowserPageComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface DefaultBrowserPageComponentProvider { + fun provideDefaultBrowserPageComponentFactory(): DefaultBrowserPageComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class DefaultBrowserPageBindingModule { + @Binds + @IntoMap + @ClassKey(DefaultBrowserPage::class) + abstract fun bindDefaultBrowserPageComponentFactory(factory: DefaultBrowserPageComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/DownloadConfirmationFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/DownloadConfirmationFragmentComponent.kt new file mode 100644 index 000000000000..9c20893842ef --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/DownloadConfirmationFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.browser.DownloadConfirmationFragment +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface DownloadConfirmationFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface DownloadConfirmationFragmentComponentProvider { + fun provideDownloadConfirmationFragmentComponentFactory(): DownloadConfirmationFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class DownloadConfirmationFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(DownloadConfirmationFragment::class) + abstract fun bindDownloadConfirmationFragmentComponentFactory(factory: DownloadConfirmationFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/FeedbackActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/FeedbackActivityComponent.kt new file mode 100644 index 000000000000..9702da7aa841 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/FeedbackActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.common.FeedbackActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface FeedbackActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface FeedbackActivityComponentProvider { + fun provideFeedbackActivityComponentFactory(): FeedbackActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class FeedbackActivityBindingModule { + @Binds + @IntoMap + @ClassKey(FeedbackActivity::class) + abstract fun bindFeedbackActivityComponentFactory(factory: FeedbackActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/FireActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/FireActivityComponent.kt new file mode 100644 index 000000000000..5585ebe0b35c --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/FireActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.fire.FireActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface FireActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface FireActivityComponentProvider { + fun provideFireActivityComponentFactory(): FireActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class FireActivityBindingModule { + @Binds + @IntoMap + @ClassKey(FireActivity::class) + abstract fun bindFireActivityComponentFactory(factory: FireActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/FireproofWebsitesActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/FireproofWebsitesActivityComponent.kt new file mode 100644 index 000000000000..2f5f91c06693 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/FireproofWebsitesActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.fire.fireproofwebsite.ui.FireproofWebsitesActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface FireproofWebsitesActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface FireproofWebsitesActivityComponentProvider { + fun provideFireproofWebsitesActivityComponentFactory(): FireproofWebsitesActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class FireproofWebsitesActivityBindingModule { + @Binds + @IntoMap + @ClassKey(FireproofWebsitesActivity::class) + abstract fun bindFireproofWebsitesActivityComponentFactory(factory: FireproofWebsitesActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/GiveFeedbackDialogFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/GiveFeedbackDialogFragmentComponent.kt new file mode 100644 index 000000000000..be5b2a396459 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/GiveFeedbackDialogFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.browser.rating.ui.GiveFeedbackDialogFragment +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface GiveFeedbackDialogFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface GiveFeedbackDialogFragmentComponentProvider { + fun provideGiveFeedbackDialogFragmentComponentFactory(): GiveFeedbackDialogFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class GiveFeedbackDialogFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(GiveFeedbackDialogFragment::class) + abstract fun bindGiveFeedbackDialogFragmentComponentFactory(factory: GiveFeedbackDialogFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/GlobalPrivacyControlActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/GlobalPrivacyControlActivityComponent.kt new file mode 100644 index 000000000000..7d5d16772899 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/GlobalPrivacyControlActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.globalprivacycontrol.ui.GlobalPrivacyControlActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface GlobalPrivacyControlActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface GlobalPrivacyControlActivityComponentProvider { + fun provideGlobalPrivacyControlActivityComponentFactory(): GlobalPrivacyControlActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class GlobalPrivacyControlActivityBindingModule { + @Binds + @IntoMap + @ClassKey(GlobalPrivacyControlActivity::class) + abstract fun bindGlobalPrivacyControlActivityComponentFactory(factory: GlobalPrivacyControlActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/InitialFeedbackFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/InitialFeedbackFragmentComponent.kt new file mode 100644 index 000000000000..60059c607bbc --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/InitialFeedbackFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.initial.InitialFeedbackFragment +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface InitialFeedbackFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface InitialFeedbackFragmentComponentProvider { + fun provideInitialFeedbackFragmentComponentFactory(): InitialFeedbackFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class InitialFeedbackFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(InitialFeedbackFragment::class) + abstract fun bindInitialFeedbackFragmentComponentFactory(factory: InitialFeedbackFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/LaunchBridgeActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/LaunchBridgeActivityComponent.kt new file mode 100644 index 000000000000..b0ad3da9f202 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/LaunchBridgeActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.launch.LaunchBridgeActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface LaunchBridgeActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface LaunchBridgeActivityComponentProvider { + fun provideLaunchBridgeActivityComponentFactory(): LaunchBridgeActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class LaunchBridgeActivityBindingModule { + @Binds + @IntoMap + @ClassKey(LaunchBridgeActivity::class) + abstract fun bindLaunchBridgeActivityComponentFactory(factory: LaunchBridgeActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/LocationPermissionsActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/LocationPermissionsActivityComponent.kt new file mode 100644 index 000000000000..58f722c332aa --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/LocationPermissionsActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.location.ui.LocationPermissionsActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface LocationPermissionsActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface LocationPermissionsActivityComponentProvider { + fun provideLocationPermissionsActivityComponentFactory(): LocationPermissionsActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class LocationPermissionsActivityBindingModule { + @Binds + @IntoMap + @ClassKey(LocationPermissionsActivity::class) + abstract fun bindLocationPermissionsActivityComponentFactory(factory: LocationPermissionsActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/MainReasonNegativeFeedbackFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/MainReasonNegativeFeedbackFragmentComponent.kt new file mode 100644 index 000000000000..2958ab942825 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/MainReasonNegativeFeedbackFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.negative.mainreason.MainReasonNegativeFeedbackFragment +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface MainReasonNegativeFeedbackFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface MainReasonNegativeFeedbackFragmentComponentProvider { + fun provideMainReasonNegativeFeedbackFragmentComponentFactory(): MainReasonNegativeFeedbackFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class MainReasonNegativeFeedbackFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(MainReasonNegativeFeedbackFragment::class) + abstract fun bindMainReasonNegativeFeedbackFragmentComponentFactory(factory: MainReasonNegativeFeedbackFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/NotificationHandlerServiceComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/NotificationHandlerServiceComponent.kt new file mode 100644 index 000000000000..fc814a12c840 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/NotificationHandlerServiceComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.notification.NotificationHandlerService +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface NotificationHandlerServiceComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface NotificationHandlerServiceComponentProvider { + fun provideNotificationHandlerServiceComponentFactory(): NotificationHandlerServiceComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class NotificationHandlerServiceBindingModule { + @Binds + @IntoMap + @ClassKey(NotificationHandlerService::class) + abstract fun bindNotificationHandlerServiceComponentFactory(factory: NotificationHandlerServiceComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/OnboardingActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/OnboardingActivityComponent.kt new file mode 100644 index 000000000000..20f656956417 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/OnboardingActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.onboarding.ui.OnboardingActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface OnboardingActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface OnboardingActivityComponentProvider { + fun provideOnboardingActivityComponentFactory(): OnboardingActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class OnboardingActivityBindingModule { + @Binds + @IntoMap + @ClassKey(OnboardingActivity::class) + abstract fun bindOnboardingActivityComponentFactory(factory: OnboardingActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/PositiveFeedbackLandingFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/PositiveFeedbackLandingFragmentComponent.kt new file mode 100644 index 000000000000..aa8ad75b9322 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/PositiveFeedbackLandingFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.positive.initial.PositiveFeedbackLandingFragment +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface PositiveFeedbackLandingFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface PositiveFeedbackLandingFragmentComponentProvider { + fun providePositiveFeedbackLandingFragmentComponentFactory(): PositiveFeedbackLandingFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class PositiveFeedbackLandingFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(PositiveFeedbackLandingFragment::class) + abstract fun bindPositiveFeedbackLandingFragmentComponentFactory(factory: PositiveFeedbackLandingFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/PrivacyDashboardActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/PrivacyDashboardActivityComponent.kt new file mode 100644 index 000000000000..41b21a8dbb05 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/PrivacyDashboardActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.privacy.ui.PrivacyDashboardActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface PrivacyDashboardActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface PrivacyDashboardActivityComponentProvider { + fun providePrivacyDashboardActivityComponentFactory(): PrivacyDashboardActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class PrivacyDashboardActivityBindingModule { + @Binds + @IntoMap + @ClassKey(PrivacyDashboardActivity::class) + abstract fun bindPrivacyDashboardActivityComponentFactory(factory: PrivacyDashboardActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/PrivacyPracticesActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/PrivacyPracticesActivityComponent.kt new file mode 100644 index 000000000000..ec56bcd85928 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/PrivacyPracticesActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.privacy.ui.PrivacyPracticesActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface PrivacyPracticesActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface PrivacyPracticesActivityComponentProvider { + fun providePrivacyPracticesActivityComponentFactory(): PrivacyPracticesActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class PrivacyPracticesActivityBindingModule { + @Binds + @IntoMap + @ClassKey(PrivacyPracticesActivity::class) + abstract fun bindPrivacyPracticesActivityComponentFactory(factory: PrivacyPracticesActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/RateAppDialogFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/RateAppDialogFragmentComponent.kt new file mode 100644 index 000000000000..d71467e90736 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/RateAppDialogFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.browser.rating.ui.RateAppDialogFragment +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface RateAppDialogFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface RateAppDialogFragmentComponentProvider { + fun provideRateAppDialogFragmentComponentFactory(): RateAppDialogFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class RateAppDialogFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(RateAppDialogFragment::class) + abstract fun bindRateAppDialogFragmentComponentFactory(factory: RateAppDialogFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/ScorecardActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/ScorecardActivityComponent.kt new file mode 100644 index 000000000000..4e602b1f3597 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/ScorecardActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.privacy.ui.ScorecardActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface ScorecardActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface ScorecardActivityComponentProvider { + fun provideScorecardActivityComponentFactory(): ScorecardActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class ScorecardActivityBindingModule { + @Binds + @IntoMap + @ClassKey(ScorecardActivity::class) + abstract fun bindScorecardActivityComponentFactory(factory: ScorecardActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/SettingsActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/SettingsActivityComponent.kt new file mode 100644 index 000000000000..2f8f98dfb5e4 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/SettingsActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.settings.SettingsActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface SettingsActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface SettingsActivityComponentProvider { + fun provideSettingsActivityComponentFactory(): SettingsActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class SettingsActivityBindingModule { + @Binds + @IntoMap + @ClassKey(SettingsActivity::class) + abstract fun bindSettingsActivityComponentFactory(factory: SettingsActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/ShareOpenEndedFeedbackFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/ShareOpenEndedFeedbackFragmentComponent.kt new file mode 100644 index 000000000000..45fd8ec0843a --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/ShareOpenEndedFeedbackFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.negative.openended.ShareOpenEndedFeedbackFragment +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface ShareOpenEndedFeedbackFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface ShareOpenEndedFeedbackFragmentComponentProvider { + fun provideShareOpenEndedFeedbackFragmentComponentFactory(): ShareOpenEndedFeedbackFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class ShareOpenEndedFeedbackFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(ShareOpenEndedFeedbackFragment::class) + abstract fun bindShareOpenEndedFeedbackFragmentComponentFactory(factory: ShareOpenEndedFeedbackFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/SiteLocationPermissionDialogComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/SiteLocationPermissionDialogComponent.kt new file mode 100644 index 000000000000..a067d04b3ce8 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/SiteLocationPermissionDialogComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.location.ui.SiteLocationPermissionDialog +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface SiteLocationPermissionDialogComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface SiteLocationPermissionDialogComponentProvider { + fun provideSiteLocationPermissionDialogComponentFactory(): SiteLocationPermissionDialogComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class SiteLocationPermissionDialogBindingModule { + @Binds + @IntoMap + @ClassKey(SiteLocationPermissionDialog::class) + abstract fun bindSiteLocationPermissionDialogComponentFactory(factory: SiteLocationPermissionDialogComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/SubReasonNegativeFeedbackFragmentComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/SubReasonNegativeFeedbackFragmentComponent.kt new file mode 100644 index 000000000000..daa3970f786b --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/SubReasonNegativeFeedbackFragmentComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.feedback.ui.negative.subreason.SubReasonNegativeFeedbackFragment +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface SubReasonNegativeFeedbackFragmentComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface SubReasonNegativeFeedbackFragmentComponentProvider { + fun provideSubReasonNegativeFeedbackFragmentComponentFactory(): SubReasonNegativeFeedbackFragmentComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class SubReasonNegativeFeedbackFragmentBindingModule { + @Binds + @IntoMap + @ClassKey(SubReasonNegativeFeedbackFragment::class) + abstract fun bindSubReasonNegativeFeedbackFragmentComponentFactory(factory: SubReasonNegativeFeedbackFragmentComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/SurveyActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/SurveyActivityComponent.kt new file mode 100644 index 000000000000..b782d24828c1 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/SurveyActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.survey.ui.SurveyActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface SurveyActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface SurveyActivityComponentProvider { + fun provideSurveyActivityComponentFactory(): SurveyActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class SurveyActivityBindingModule { + @Binds + @IntoMap + @ClassKey(SurveyActivity::class) + abstract fun bindSurveyActivityComponentFactory(factory: SurveyActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/SystemSearchActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/SystemSearchActivityComponent.kt new file mode 100644 index 000000000000..c954b564ece3 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/SystemSearchActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.systemsearch.SystemSearchActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface SystemSearchActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface SystemSearchActivityComponentProvider { + fun provideSystemSearchActivityComponentFactory(): SystemSearchActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class SystemSearchActivityBindingModule { + @Binds + @IntoMap + @ClassKey(SystemSearchActivity::class) + abstract fun bindSystemSearchActivityComponentFactory(factory: SystemSearchActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/TabSwitcherActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/TabSwitcherActivityComponent.kt new file mode 100644 index 000000000000..a9431c1780d8 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/TabSwitcherActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.tabs.ui.TabSwitcherActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface TabSwitcherActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface TabSwitcherActivityComponentProvider { + fun provideTabSwitcherActivityComponentFactory(): TabSwitcherActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class TabSwitcherActivityBindingModule { + @Binds + @IntoMap + @ClassKey(TabSwitcherActivity::class) + abstract fun bindTabSwitcherActivityComponentFactory(factory: TabSwitcherActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/TrackerNetworksActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/TrackerNetworksActivityComponent.kt new file mode 100644 index 000000000000..dd7a88b6bb3e --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/TrackerNetworksActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.privacy.ui.TrackerNetworksActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface TrackerNetworksActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface TrackerNetworksActivityComponentProvider { + fun provideTrackerNetworksActivityComponentFactory(): TrackerNetworksActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class TrackerNetworksActivityBindingModule { + @Binds + @IntoMap + @ClassKey(TrackerNetworksActivity::class) + abstract fun bindTrackerNetworksActivityComponentFactory(factory: TrackerNetworksActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/WelcomePageComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/WelcomePageComponent.kt new file mode 100644 index 000000000000..02bad87ebac3 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/WelcomePageComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.onboarding.ui.page.WelcomePage +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface WelcomePageComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface WelcomePageComponentProvider { + fun provideWelcomePageComponentFactory(): WelcomePageComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class WelcomePageBindingModule { + @Binds + @IntoMap + @ClassKey(WelcomePage::class) + abstract fun bindWelcomePageComponentFactory(factory: WelcomePageComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/app/src/main/java/com/duckduckgo/app/di/component/WhitelistActivityComponent.kt b/app/src/main/java/com/duckduckgo/app/di/component/WhitelistActivityComponent.kt new file mode 100644 index 000000000000..7b3005af9772 --- /dev/null +++ b/app/src/main/java/com/duckduckgo/app/di/component/WhitelistActivityComponent.kt @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.app.di.component + +import com.duckduckgo.app.di.ActivityScoped +import com.duckduckgo.app.privacy.ui.WhitelistActivity +import com.duckduckgo.di.scopes.AppObjectGraph + +import com.duckduckgo.di.scopes.ActivityObjectGraph +import com.squareup.anvil.annotations.ContributesTo +import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.Binds +import dagger.Module +import dagger.Subcomponent +import dagger.android.AndroidInjector +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@ActivityScoped +@MergeSubcomponent( + scope = ActivityObjectGraph::class +) +interface WhitelistActivityComponent : AndroidInjector { + @Subcomponent.Factory + interface Factory : AndroidInjector.Factory +} + +@ContributesTo(AppObjectGraph::class) +interface WhitelistActivityComponentProvider { + fun provideWhitelistActivityComponentFactory(): WhitelistActivityComponent.Factory +} + +@Module +@ContributesTo(AppObjectGraph::class) +abstract class WhitelistActivityBindingModule { + @Binds + @IntoMap + @ClassKey(WhitelistActivity::class) + abstract fun bindWhitelistActivityComponentFactory(factory: WhitelistActivityComponent.Factory): AndroidInjector.Factory<*> +} diff --git a/build.gradle b/build.gradle index a78ca9fe0184..8a33af38d27f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ buildscript { ext.kotlin_version = '1.4.10' ext.spotless = "5.7.0" + ext.anvil_version = "2.0.1" ext.min_sdk = 21 ext.target_sdk = 29 @@ -14,9 +15,10 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:4.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless" + classpath "com.squareup.anvil:gradle-plugin:$anvil_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/di/.gitignore b/di/.gitignore new file mode 100644 index 000000000000..42afabfd2abe --- /dev/null +++ b/di/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/src/androidTest/java/com/duckduckgo/app/TestRunner.kt b/di/build.gradle similarity index 57% rename from app/src/androidTest/java/com/duckduckgo/app/TestRunner.kt rename to di/build.gradle index 839fef7c79c8..8c4598fd60d9 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/TestRunner.kt +++ b/di/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 DuckDuckGo + * Copyright (c) 2020 DuckDuckGo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,14 @@ * limitations under the License. */ -package com.duckduckgo.app +plugins { + id 'com.android.library' + id 'kotlin-android' +} -import android.app.Application -import android.content.Context -import androidx.test.runner.AndroidJUnitRunner +apply from: "$rootProject.projectDir/gradle/android-library.gradle" -@Suppress("unused") -class TestRunner : AndroidJUnitRunner() { - override fun newApplication(cl: ClassLoader, className: String, context: Context): Application { - return super.newApplication(cl, TestApplication::class.java.name, context) - } +dependencies { + implementation Google.dagger + implementation Kotlin.stdlib.jdk7 } diff --git a/di/consumer-rules.pro b/di/consumer-rules.pro new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/di/proguard-rules.pro b/di/proguard-rules.pro new file mode 100644 index 000000000000..481bb4348141 --- /dev/null +++ b/di/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/di/src/main/AndroidManifest.xml b/di/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..d62fcbdde1ae --- /dev/null +++ b/di/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/di/src/main/java/com/duckduckgo/di/scopes/ActivityObjectGraph.kt b/di/src/main/java/com/duckduckgo/di/scopes/ActivityObjectGraph.kt new file mode 100644 index 000000000000..dfec3f5a46b5 --- /dev/null +++ b/di/src/main/java/com/duckduckgo/di/scopes/ActivityObjectGraph.kt @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2020. Aitor Viana + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.duckduckgo.di.scopes + +abstract class ActivityObjectGraph private constructor() diff --git a/di/src/main/java/com/duckduckgo/di/scopes/AppObjectGraph.kt b/di/src/main/java/com/duckduckgo/di/scopes/AppObjectGraph.kt new file mode 100644 index 000000000000..22420b76f82f --- /dev/null +++ b/di/src/main/java/com/duckduckgo/di/scopes/AppObjectGraph.kt @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2020. Aitor Viana + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.duckduckgo.di.scopes + +abstract class AppObjectGraph private constructor() diff --git a/settings.gradle b/settings.gradle index f3b9f4b2e302..6c2d9fcf48bb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,6 +7,7 @@ buildscript { RefreshVersionsSetup.bootstrap(settings) +include ':di' include ':app' include ':statistics' include ':common'