|
| 1 | +/* |
| 2 | + * Copyright 2019 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.samples.apps.iosched.tests.di |
| 18 | + |
| 19 | +import com.google.samples.apps.iosched.MainApplication |
| 20 | +import com.google.samples.apps.iosched.di.ActivityBindingModule |
| 21 | +import com.google.samples.apps.iosched.di.AppModule |
| 22 | +import com.google.samples.apps.iosched.di.SignInModule |
| 23 | +import com.google.samples.apps.iosched.shared.di.BroadcastReceiverBindingModule |
| 24 | +import com.google.samples.apps.iosched.shared.di.FeatureFlagsModule |
| 25 | +import com.google.samples.apps.iosched.shared.di.ServiceBindingModule |
| 26 | +import com.google.samples.apps.iosched.shared.di.SharedModule |
| 27 | +import com.google.samples.apps.iosched.shared.di.ViewModelModule |
| 28 | +import com.google.samples.apps.iosched.ui.signin.SignInViewModelDelegateModule |
| 29 | +import com.google.samples.apps.iosched.ui.theme.ThemedActivityDelegateModule |
| 30 | +import dagger.Component |
| 31 | +import dagger.android.AndroidInjector |
| 32 | +import dagger.android.support.AndroidSupportInjectionModule |
| 33 | +import javax.inject.Singleton |
| 34 | + |
| 35 | +/** |
| 36 | + * Main component of the app for instrumentation tests, |
| 37 | + * created and persisted in the MainTestApplication class. |
| 38 | + * |
| 39 | + * Whenever a new module is created, it should be added to the list of modules. |
| 40 | + * [AndroidSupportInjectionModule] is the module from Dagger.Android that helps with the |
| 41 | + * generation and location of subcomponents. |
| 42 | + */ |
| 43 | +@Singleton |
| 44 | +@Component( |
| 45 | + modules = [ |
| 46 | + AndroidSupportInjectionModule::class, |
| 47 | + AppModule::class, |
| 48 | + // Test Module that overrides CoroutinesModule |
| 49 | + TestCoroutinesModule::class, |
| 50 | + ActivityBindingModule::class, |
| 51 | + BroadcastReceiverBindingModule::class, |
| 52 | + ViewModelModule::class, |
| 53 | + ServiceBindingModule::class, |
| 54 | + SharedModule::class, |
| 55 | + FeatureFlagsModule::class, |
| 56 | + SignInModule::class, |
| 57 | + SignInViewModelDelegateModule::class, |
| 58 | + ThemedActivityDelegateModule::class |
| 59 | + ] |
| 60 | +) |
| 61 | +interface TestAppComponent : AndroidInjector<MainApplication> { |
| 62 | + @Component.Builder |
| 63 | + abstract class Builder : AndroidInjector.Builder<MainApplication>() |
| 64 | +} |
0 commit comments