• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 
17 package com.android.wallpaper.testing
18 
19 import com.android.wallpaper.picker.category.domain.interactor.CuratedPhotosInteractor
20 import com.android.wallpaper.picker.data.PhotosErrorData
21 import com.android.wallpaper.picker.data.category.CategoryModel
22 import com.android.wallpaper.picker.data.category.CollectionCategoryData
23 import com.android.wallpaper.picker.data.category.CommonCategoryData
24 import com.android.wallpaper.picker.data.category.PhotoCategoryModel
25 import javax.inject.Inject
26 import javax.inject.Singleton
27 import kotlinx.coroutines.flow.Flow
28 import kotlinx.coroutines.flow.MutableStateFlow
29 import kotlinx.coroutines.flow.StateFlow
30 
31 @Singleton
32 class FakeCuratedPhotosInteractorImpl @Inject constructor() : CuratedPhotosInteractor {
33     private val _category = MutableStateFlow(threeCuratedPhotos)
34 
35     override val category: Flow<PhotoCategoryModel>
36         get() = _category
37 
38     override val dismissBanner: StateFlow<Boolean>
39         get() = TODO("Not yet implemented")
40 
setBannerDismissednull41     override fun setBannerDismissed(dismissed: Boolean) {
42         TODO("Not yet implemented")
43     }
44 
setCategorynull45     fun setCategory(newCategory: PhotoCategoryModel) {
46         _category.value = newCategory
47     }
48 
49     companion object {
50         val curatedPhotosTitle = "Curated Photos Title"
51         val twoCuratedPhotos =
52             PhotoCategoryModel(
53                 CategoryModel(
54                     CommonCategoryData(curatedPhotosTitle, "image_wallpapers", 51),
55                     collectionCategoryData =
56                         CollectionCategoryData(
57                             wallpaperModels =
58                                 mutableListOf(
59                                     WallpaperModelUtils.getStaticWallpaperModel(
60                                         "wallpaper1",
61                                         "collection1",
62                                     ),
63                                     WallpaperModelUtils.getStaticWallpaperModel(
64                                         "wallpaper2",
65                                         "collection1",
66                                     ),
67                                 ),
68                             thumbAsset = TestAsset(TestStaticWallpaperInfo.COLOR_DEFAULT, false),
69                             featuredThumbnailIndex = 0,
70                             isSingleWallpaperCategory = false,
71                         ),
72                 ),
73                 PhotosErrorData.OK,
74                 null,
75             )
76 
77         val threeCuratedPhotos =
78             PhotoCategoryModel(
79                 CategoryModel(
80                     CommonCategoryData(curatedPhotosTitle, "image_wallpapers", 51),
81                     collectionCategoryData =
82                         CollectionCategoryData(
83                             wallpaperModels =
84                                 mutableListOf(
85                                     WallpaperModelUtils.getStaticWallpaperModel(
86                                         "wallpaper1",
87                                         "collection1",
88                                     ),
89                                     WallpaperModelUtils.getStaticWallpaperModel(
90                                         "wallpaper2",
91                                         "collection1",
92                                     ),
93                                     WallpaperModelUtils.getStaticWallpaperModel(
94                                         "wallpaper3",
95                                         "collection1",
96                                     ),
97                                     WallpaperModelUtils.getStaticWallpaperModel(
98                                         "wallpaper4",
99                                         "collection1",
100                                     ),
101                                     WallpaperModelUtils.getStaticWallpaperModel(
102                                         "wallpaper5",
103                                         "collection1",
104                                     ),
105                                     WallpaperModelUtils.getStaticWallpaperModel(
106                                         "wallpaper6",
107                                         "collection1",
108                                     ),
109                                 ),
110                             thumbAsset = TestAsset(TestStaticWallpaperInfo.COLOR_DEFAULT, false),
111                             featuredThumbnailIndex = 0,
112                             isSingleWallpaperCategory = false,
113                         ),
114                 ),
115                 PhotosErrorData.OK,
116                 null,
117             )
118     }
119 }
120