1 /*
2  * Copyright (C) 2023 The Android Open Source Project
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  *      http://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 package com.android.wallpaper.modules
17 
18 import com.android.wallpaper.effects.DefaultEffectsController
19 import com.android.wallpaper.effects.EffectsController
20 import com.android.wallpaper.module.DefaultPartnerProvider
21 import com.android.wallpaper.module.DefaultWallpaperPreferences
22 import com.android.wallpaper.module.Injector
23 import com.android.wallpaper.module.PartnerProvider
24 import com.android.wallpaper.module.WallpaperPicker2Injector
25 import com.android.wallpaper.module.WallpaperPreferences
26 import com.android.wallpaper.module.logging.NoOpUserEventLogger
27 import com.android.wallpaper.module.logging.UserEventLogger
28 import com.android.wallpaper.picker.category.domain.interactor.CategoriesLoadingStatusInteractor
29 import com.android.wallpaper.picker.category.domain.interactor.CategoryInteractor
30 import com.android.wallpaper.picker.category.domain.interactor.CreativeCategoryInteractor
31 import com.android.wallpaper.picker.category.domain.interactor.ThirdPartyCategoryInteractor
32 import com.android.wallpaper.picker.category.domain.interactor.implementations.CategoryInteractorImpl
33 import com.android.wallpaper.picker.category.domain.interactor.implementations.CreativeCategoryInteractorImpl
34 import com.android.wallpaper.picker.category.domain.interactor.implementations.DefaultCategoriesLoadingStatusInteractor
35 import com.android.wallpaper.picker.category.domain.interactor.implementations.ThirdPartyCategoryInteractorImpl
36 import com.android.wallpaper.picker.category.ui.view.providers.IndividualPickerFactory
37 import com.android.wallpaper.picker.category.ui.view.providers.implementation.DefaultIndividualPickerFactory
38 import com.android.wallpaper.picker.category.wrapper.DefaultWallpaperCategoryWrapper
39 import com.android.wallpaper.picker.category.wrapper.WallpaperCategoryWrapper
40 import com.android.wallpaper.picker.common.preview.ui.binder.DefaultWorkspaceCallbackBinder
41 import com.android.wallpaper.picker.common.preview.ui.binder.WorkspaceCallbackBinder
42 import com.android.wallpaper.picker.customization.ui.binder.CustomizationOptionsBinder
43 import com.android.wallpaper.picker.customization.ui.binder.DefaultCustomizationOptionsBinder
44 import com.android.wallpaper.picker.customization.ui.binder.DefaultToolbarBinder
45 import com.android.wallpaper.picker.customization.ui.binder.ToolbarBinder
46 import com.android.wallpaper.picker.preview.ui.util.DefaultImageEffectDialogUtil
47 import com.android.wallpaper.picker.preview.ui.util.ImageEffectDialogUtil
48 import com.android.wallpaper.util.converter.DefaultWallpaperModelFactory
49 import com.android.wallpaper.util.converter.WallpaperModelFactory
50 import dagger.Binds
51 import dagger.Module
52 import dagger.Provides
53 import dagger.hilt.InstallIn
54 import dagger.hilt.components.SingletonComponent
55 import javax.inject.Singleton
56 
57 @Module
58 @InstallIn(SingletonComponent::class)
59 abstract class WallpaperPicker2AppModule {
60 
61     @Binds
62     @Singleton
bindCreativeCategoryInteractornull63     abstract fun bindCreativeCategoryInteractor(
64         impl: CreativeCategoryInteractorImpl
65     ): CreativeCategoryInteractor
66 
67     @Binds
68     @Singleton
69     abstract fun bindCustomizationOptionsBinder(
70         impl: DefaultCustomizationOptionsBinder
71     ): CustomizationOptionsBinder
72 
73     @Binds
74     @Singleton
75     abstract fun bindEffectsController(impl: DefaultEffectsController): EffectsController
76 
77     @Binds
78     @Singleton
79     abstract fun bindGoogleCategoryInteractor(impl: CategoryInteractorImpl): CategoryInteractor
80 
81     @Binds
82     @Singleton
83     abstract fun bindImageEffectDialogUtil(
84         impl: DefaultImageEffectDialogUtil
85     ): ImageEffectDialogUtil
86 
87     @Binds
88     @Singleton
89     abstract fun bindThirdPartyCategoryInteractor(
90         impl: ThirdPartyCategoryInteractorImpl
91     ): ThirdPartyCategoryInteractor
92 
93     @Binds
94     @Singleton
95     abstract fun bindIndividualPickerFactory(
96         impl: DefaultIndividualPickerFactory
97     ): IndividualPickerFactory
98 
99     @Binds @Singleton abstract fun bindInjector(impl: WallpaperPicker2Injector): Injector
100 
101     @Binds
102     @Singleton
103     abstract fun bindLoadingStatusInteractor(
104         impl: DefaultCategoriesLoadingStatusInteractor
105     ): CategoriesLoadingStatusInteractor
106 
107     @Binds
108     @Singleton
109     abstract fun bindPartnerProvider(impl: DefaultPartnerProvider): PartnerProvider
110 
111     @Binds @Singleton abstract fun bindToolbarBinder(impl: DefaultToolbarBinder): ToolbarBinder
112 
113     @Binds
114     @Singleton
115     abstract fun bindWallpaperCategoryWrapper(
116         impl: DefaultWallpaperCategoryWrapper
117     ): WallpaperCategoryWrapper
118 
119     @Binds
120     @Singleton
121     abstract fun bindWallpaperModelFactory(
122         impl: DefaultWallpaperModelFactory
123     ): WallpaperModelFactory
124 
125     @Binds
126     @Singleton
127     abstract fun bindWallpaperPreferences(impl: DefaultWallpaperPreferences): WallpaperPreferences
128 
129     @Binds
130     @Singleton
131     abstract fun bindWorkspaceCallbackBinder(
132         impl: DefaultWorkspaceCallbackBinder
133     ): WorkspaceCallbackBinder
134 
135     companion object {
136 
137         @Provides
138         @Singleton
139         fun provideUserEventLogger(): UserEventLogger {
140             return NoOpUserEventLogger()
141         }
142     }
143 }
144