1 /*
<lambda>null2  * 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.CategoryInteractor
20 import com.android.wallpaper.picker.data.category.CategoryModel
21 import com.android.wallpaper.picker.data.category.CommonCategoryData
22 import javax.inject.Inject
23 import javax.inject.Singleton
24 import kotlinx.coroutines.flow.Flow
25 import kotlinx.coroutines.flow.flow
26 
27 /** This class implements the business logic in assembling ungrouped category models */
28 @Singleton
29 class FakeCategoryInteractor @Inject constructor() : CategoryInteractor {
30     override val categories: Flow<List<CategoryModel>> = flow {
31         // stubbing the list of single section categories
32         val categoryModels =
33             generateCategoryData().map { commonCategoryData ->
34                 CategoryModel(commonCategoryData, null, null, null)
35             }
36 
37         // Emit the list of categories
38         emit(categoryModels)
39     }
40 
41     override fun refreshNetworkCategories() {
42         // empty
43     }
44 
45     override fun refreshThirdPartyLiveWallpaperCategories() {
46         TODO("Not yet implemented")
47     }
48 
49     private fun generateCategoryData(): List<CommonCategoryData> {
50         val dataList =
51             listOf(
52                 CommonCategoryData("Celestial Dreamscape", "celestial_dreamscapes", 1),
53                 CommonCategoryData("Geometric Fusion", "geometric_fusion", 2),
54                 CommonCategoryData("Neon Metropolis", "neon_metropolis", 3),
55                 CommonCategoryData("Whispering Wilderness", "whispering_wilderness", 4),
56                 CommonCategoryData("Retro Wave", "retro_wave", 5),
57                 CommonCategoryData("Abstract Expressionism", "abstract_expressionism", 6),
58                 CommonCategoryData("Cyberpunk Cityscape", "cyberpunk_cityscape", 7),
59                 CommonCategoryData("Floral Fantasy", "floral_fantasy", 8),
60                 CommonCategoryData("Cosmic Nebula", "cosmic_nebula", 9),
61                 CommonCategoryData("Minimalist Lines", "minimalist_lines", 10),
62                 CommonCategoryData("Watercolor Wonder", "watercolor_wonder", 11),
63                 CommonCategoryData("Urban Graffiti", "urban_graffiti", 12),
64                 CommonCategoryData("Vintage Botanicals", "vintage_botanicals", 13),
65                 CommonCategoryData("Pastel Dreams", "pastel_dreams", 14),
66                 CommonCategoryData("Polygonal Paradise", "polygonal_paradise", 15),
67                 CommonCategoryData("Oceanic Depths", "oceanic_depths", 16),
68                 CommonCategoryData("Fractal Fantasia", "fractal_fantasia", 17),
69             )
70         return dataList
71     }
72 }
73