• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.DefaultRecentWallpaperManager
22 import com.android.wallpaper.module.DefaultWallpaperPreferences
23 import com.android.wallpaper.module.Injector
24 import com.android.wallpaper.module.PartnerProvider
25 import com.android.wallpaper.module.RecentWallpaperManager
26 import com.android.wallpaper.module.WallpaperPicker2Injector
27 import com.android.wallpaper.module.WallpaperPreferences
28 import com.android.wallpaper.module.logging.NoOpUserEventLogger
29 import com.android.wallpaper.module.logging.UserEventLogger
30 import com.android.wallpaper.picker.category.domain.interactor.CategoriesLoadingStatusInteractor
31 import com.android.wallpaper.picker.category.domain.interactor.CategoryInteractor
32 import com.android.wallpaper.picker.category.domain.interactor.CreativeCategoryInteractor
33 import com.android.wallpaper.picker.category.domain.interactor.CuratedPhotosInteractor
34 import com.android.wallpaper.picker.category.domain.interactor.OnDeviceWallpapersInteractor
35 import com.android.wallpaper.picker.category.domain.interactor.ThirdPartyCategoryInteractor
36 import com.android.wallpaper.picker.category.domain.interactor.implementations.CategoryInteractorImpl
37 import com.android.wallpaper.picker.category.domain.interactor.implementations.CreativeCategoryInteractorImpl
38 import com.android.wallpaper.picker.category.domain.interactor.implementations.DefaultCategoriesLoadingStatusInteractor
39 import com.android.wallpaper.picker.category.domain.interactor.implementations.DefaultCuratedPhotosInteractorImpl
40 import com.android.wallpaper.picker.category.domain.interactor.implementations.DefaultOnDeviceWallpapersInteractor
41 import com.android.wallpaper.picker.category.domain.interactor.implementations.ThirdPartyCategoryInteractorImpl
42 import com.android.wallpaper.picker.category.ui.binder.BannerProvider
43 import com.android.wallpaper.picker.category.ui.binder.DefaultBannerProvider
44 import com.android.wallpaper.picker.category.ui.view.providers.IndividualPickerFactory
45 import com.android.wallpaper.picker.category.ui.view.providers.implementation.DefaultIndividualPickerFactory
46 import com.android.wallpaper.picker.category.wrapper.DefaultWallpaperCategoryWrapper
47 import com.android.wallpaper.picker.category.wrapper.WallpaperCategoryWrapper
48 import com.android.wallpaper.picker.common.preview.ui.binder.DefaultWorkspaceCallbackBinder
49 import com.android.wallpaper.picker.common.preview.ui.binder.WorkspaceCallbackBinder
50 import com.android.wallpaper.picker.customization.ui.binder.CustomizationOptionsBinder
51 import com.android.wallpaper.picker.customization.ui.binder.DefaultCustomizationOptionsBinder
52 import com.android.wallpaper.picker.customization.ui.binder.DefaultToolbarBinder
53 import com.android.wallpaper.picker.customization.ui.binder.ToolbarBinder
54 import com.android.wallpaper.picker.preview.ui.util.DefaultImageEffectDialogUtil
55 import com.android.wallpaper.picker.preview.ui.util.ImageEffectDialogUtil
56 import com.android.wallpaper.util.converter.DefaultPhotosErrorConvertor
57 import com.android.wallpaper.util.converter.DefaultWallpaperModelFactory
58 import com.android.wallpaper.util.converter.PhotosErrorConvertor
59 import com.android.wallpaper.util.converter.WallpaperModelFactory
60 import dagger.Binds
61 import dagger.Module
62 import dagger.Provides
63 import dagger.hilt.InstallIn
64 import dagger.hilt.components.SingletonComponent
65 import javax.inject.Singleton
66 
67 @Module
68 @InstallIn(SingletonComponent::class)
69 abstract class WallpaperPicker2AppModule {
70 
bindBannerProvidernull71     @Binds @Singleton abstract fun bindBannerProvider(impl: DefaultBannerProvider): BannerProvider
72 
73     @Binds
74     @Singleton
75     abstract fun bindCreativeCategoryInteractor(
76         impl: CreativeCategoryInteractorImpl
77     ): CreativeCategoryInteractor
78 
79     @Binds
80     @Singleton
81     abstract fun bindCuratedPhotosInteractor(
82         impl: DefaultCuratedPhotosInteractorImpl
83     ): CuratedPhotosInteractor
84 
85     @Binds
86     @Singleton
87     abstract fun bindCustomizationOptionsBinder(
88         impl: DefaultCustomizationOptionsBinder
89     ): CustomizationOptionsBinder
90 
91     @Binds
92     @Singleton
93     abstract fun bindEffectsController(impl: DefaultEffectsController): EffectsController
94 
95     @Binds
96     @Singleton
97     abstract fun bindGoogleCategoryInteractor(impl: CategoryInteractorImpl): CategoryInteractor
98 
99     @Binds
100     @Singleton
101     abstract fun bindOnDeviceWallpapersInteractor(
102         impl: DefaultOnDeviceWallpapersInteractor
103     ): OnDeviceWallpapersInteractor
104 
105     @Binds
106     @Singleton
107     abstract fun bindImageEffectDialogUtil(
108         impl: DefaultImageEffectDialogUtil
109     ): ImageEffectDialogUtil
110 
111     @Binds
112     @Singleton
113     abstract fun bindIndividualPickerFactory(
114         impl: DefaultIndividualPickerFactory
115     ): IndividualPickerFactory
116 
117     @Binds @Singleton abstract fun bindInjector(impl: WallpaperPicker2Injector): Injector
118 
119     @Binds
120     @Singleton
121     abstract fun bindLoadingStatusInteractor(
122         impl: DefaultCategoriesLoadingStatusInteractor
123     ): CategoriesLoadingStatusInteractor
124 
125     @Binds
126     @Singleton
127     abstract fun bindPartnerProvider(impl: DefaultPartnerProvider): PartnerProvider
128 
129     @Binds
130     @Singleton
131     abstract fun bindPhotosErrorConvertor(impl: DefaultPhotosErrorConvertor): PhotosErrorConvertor
132 
133     @Binds
134     @Singleton
135     abstract fun bindThirdPartyCategoryInteractor(
136         impl: ThirdPartyCategoryInteractorImpl
137     ): ThirdPartyCategoryInteractor
138 
139     @Binds @Singleton abstract fun bindToolbarBinder(impl: DefaultToolbarBinder): ToolbarBinder
140 
141     @Binds
142     @Singleton
143     abstract fun bindWallpaperCategoryWrapper(
144         impl: DefaultWallpaperCategoryWrapper
145     ): WallpaperCategoryWrapper
146 
147     @Binds
148     @Singleton
149     abstract fun bindWallpaperModelFactory(
150         impl: DefaultWallpaperModelFactory
151     ): WallpaperModelFactory
152 
153     @Binds
154     @Singleton
155     abstract fun bindWallpaperPreferences(impl: DefaultWallpaperPreferences): WallpaperPreferences
156 
157     @Binds
158     @Singleton
159     abstract fun bindWorkspaceCallbackBinder(
160         impl: DefaultWorkspaceCallbackBinder
161     ): WorkspaceCallbackBinder
162 
163     @Binds
164     @Singleton
165     abstract fun bindRecentWallpaperManager(
166         impl: DefaultRecentWallpaperManager
167     ): RecentWallpaperManager
168 
169     companion object {
170 
171         @Provides
172         @Singleton
173         fun provideUserEventLogger(): UserEventLogger {
174             return NoOpUserEventLogger()
175         }
176     }
177 }
178