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