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.picker.category.data.repository
18 
19 import com.android.wallpaper.model.Category
20 import com.android.wallpaper.picker.data.category.CategoryModel
21 import kotlinx.coroutines.flow.StateFlow
22 
23 /**
24  * This is the common repository interface that is responsible for communicating with wallpaper
25  * category data clients and also convert them to CategoryData classes.
26  */
27 interface WallpaperCategoryRepository {
28     val systemCategories: StateFlow<List<CategoryModel>>
29     val myPhotosCategory: StateFlow<CategoryModel?>
30     val onDeviceCategory: StateFlow<CategoryModel?>
31     val thirdPartyAppCategory: StateFlow<List<CategoryModel>>
32     val thirdPartyLiveWallpaperCategory: StateFlow<List<CategoryModel>>
33     val isDefaultCategoriesFetched: StateFlow<Boolean>
34 
getMyPhotosFetchedCategorynull35     fun getMyPhotosFetchedCategory(): Category?
36 
37     fun getOnDeviceFetchedCategories(): Category?
38 
39     fun getThirdPartyFetchedCategories(): List<Category>
40 
41     fun getSystemFetchedCategories(): List<Category>
42 
43     fun getThirdPartyLiveWallpaperFetchedCategories(): List<Category>
44 
45     suspend fun fetchMyPhotosCategory()
46 
47     suspend fun refreshNetworkCategories()
48 
49     /**
50      * ThirdPartyAppCategories represent third-party apps that offer static wallpapers which users
51      * can set as their wallpapers.
52      */
53     suspend fun refreshThirdPartyAppCategories()
54 
55     /**
56      * ThirdPartyLiveWallpaperCategories represent third-party apps that offer live wallpapers which
57      * users can set as their wallpapers.
58      */
59     suspend fun refreshThirdPartyLiveWallpaperCategories()
60 }
61