Loading app/src/main/java/foundation/e/apps/api/StoreApiRepository.kt +1 −1 Original line number Diff line number Diff line Loading @@ -2,5 +2,5 @@ package foundation.e.apps.api interface StoreApiRepository { suspend fun getHomeScreenData(): Any fun getSearchResult(query: String): Any suspend fun getSearchResult(query: String): Any } No newline at end of file app/src/main/java/foundation/e/apps/api/cleanapk/CleanApkAppsRepository.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line package foundation.e.apps.api.cleanapk import foundation.e.apps.api.StoreApiRepository import foundation.e.apps.api.cleanapk.data.home.HomeScreen import retrofit2.Response class CleanApkAppsRepository( private val cleanAPKInterface: CleanAPKInterface, private val cleanApkAppDetailApi: CleanApkAppDetailApi ) : StoreApiRepository { override suspend fun getHomeScreenData(): Response<HomeScreen> { return cleanAPKInterface.getHomeScreenData( CleanAPKInterface.APP_TYPE_ANY, CleanAPKInterface.APP_SOURCE_FOSS ) } override suspend fun getSearchResult(query: String): Any { return cleanAPKInterface.searchApps( query, CleanAPKInterface.APP_TYPE_ANY, CleanAPKInterface.APP_SOURCE_FOSS, 20, 1, null ) } } No newline at end of file app/src/main/java/foundation/e/apps/api/cleanapk/CleanApkPWARepository.kt 0 → 100644 +19 −0 Original line number Diff line number Diff line package foundation.e.apps.api.cleanapk import foundation.e.apps.api.StoreApiRepository class CleanApkPWARepository( private val cleanAPKInterface: CleanAPKInterface, private val cleanApkAppDetailApi: CleanApkAppDetailApi ) : StoreApiRepository { override suspend fun getHomeScreenData(): Any { return cleanAPKInterface.getHomeScreenData( CleanAPKInterface.APP_TYPE_PWA, CleanAPKInterface.APP_SOURCE_ANY ) } override suspend fun getSearchResult(query: String): Any { TODO("Not yet implemented") } } No newline at end of file app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt +8 −10 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import foundation.e.apps.api.cleanapk.CleanAPKInterface import foundation.e.apps.api.cleanapk.CleanAPKRepository import foundation.e.apps.api.cleanapk.data.categories.Categories import foundation.e.apps.api.cleanapk.data.home.Home import foundation.e.apps.api.cleanapk.data.home.HomeScreen import foundation.e.apps.api.cleanapk.data.search.Search import foundation.e.apps.api.fdroid.FdroidWebInterface import foundation.e.apps.api.fused.data.FusedApp Loading Loading @@ -66,6 +67,7 @@ import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.toList import kotlinx.coroutines.withTimeout import retrofit2.Response import timber.log.Timber import javax.inject.Inject import javax.inject.Named Loading @@ -80,6 +82,8 @@ class FusedAPIImpl @Inject constructor( private val preferenceManagerModule: PreferenceManagerModule, private val fdroidWebInterface: FdroidWebInterface, @Named("gplayRepository") private val gplayRepository: StoreApiRepository, @Named("cleanApkAppsRepository") private val cleanApkAppsRepository: StoreApiRepository, @Named("cleanApkPWARepository") private val cleanApkPWARepository: StoreApiRepository, @ApplicationContext private val context: Context ) { Loading Loading @@ -156,20 +160,14 @@ class FusedAPIImpl @Inject constructor( }) Source.OPEN -> runCodeBlockWithTimeout({ val response = cleanAPKRepository.getHomeScreenData( CleanAPKInterface.APP_TYPE_ANY, CleanAPKInterface.APP_SOURCE_FOSS ).body() val response = (cleanApkAppsRepository.getHomeScreenData() as Response<HomeScreen>).body() response?.home?.let { priorList.addAll(generateCleanAPKHome(it, APP_TYPE_OPEN)) } }) Source.PWA -> runCodeBlockWithTimeout({ val response = cleanAPKRepository.getHomeScreenData( CleanAPKInterface.APP_TYPE_PWA, CleanAPKInterface.APP_SOURCE_ANY ).body() val response = (cleanApkPWARepository.getHomeScreenData() as Response<HomeScreen>).body() response?.home?.let { priorList.addAll(generateCleanAPKHome(it, APP_TYPE_PWA)) } Loading Loading @@ -318,7 +316,7 @@ class FusedAPIImpl @Inject constructor( ) } private fun fetchGplaySearchResults( private suspend fun fetchGplaySearchResults( query: String, authData: AuthData, searchResult: MutableList<FusedApp>, Loading Loading @@ -1203,7 +1201,7 @@ class FusedAPIImpl @Inject constructor( } } private fun getGplaySearchResult( private suspend fun getGplaySearchResult( query: String, authData: AuthData ): LiveData<Pair<List<FusedApp>, Boolean>> { Loading app/src/main/java/foundation/e/apps/api/gplay/GplayRepository.kt +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class GplayRepository @Inject constructor( return homeScreenData } override fun getSearchResult(query: String): LiveData<Pair<List<App>, Boolean>> { override suspend fun getSearchResult(query: String): LiveData<Pair<List<App>, Boolean>> { return liveData { withContext(Dispatchers.IO) { /* Loading Loading
app/src/main/java/foundation/e/apps/api/StoreApiRepository.kt +1 −1 Original line number Diff line number Diff line Loading @@ -2,5 +2,5 @@ package foundation.e.apps.api interface StoreApiRepository { suspend fun getHomeScreenData(): Any fun getSearchResult(query: String): Any suspend fun getSearchResult(query: String): Any } No newline at end of file
app/src/main/java/foundation/e/apps/api/cleanapk/CleanApkAppsRepository.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line package foundation.e.apps.api.cleanapk import foundation.e.apps.api.StoreApiRepository import foundation.e.apps.api.cleanapk.data.home.HomeScreen import retrofit2.Response class CleanApkAppsRepository( private val cleanAPKInterface: CleanAPKInterface, private val cleanApkAppDetailApi: CleanApkAppDetailApi ) : StoreApiRepository { override suspend fun getHomeScreenData(): Response<HomeScreen> { return cleanAPKInterface.getHomeScreenData( CleanAPKInterface.APP_TYPE_ANY, CleanAPKInterface.APP_SOURCE_FOSS ) } override suspend fun getSearchResult(query: String): Any { return cleanAPKInterface.searchApps( query, CleanAPKInterface.APP_TYPE_ANY, CleanAPKInterface.APP_SOURCE_FOSS, 20, 1, null ) } } No newline at end of file
app/src/main/java/foundation/e/apps/api/cleanapk/CleanApkPWARepository.kt 0 → 100644 +19 −0 Original line number Diff line number Diff line package foundation.e.apps.api.cleanapk import foundation.e.apps.api.StoreApiRepository class CleanApkPWARepository( private val cleanAPKInterface: CleanAPKInterface, private val cleanApkAppDetailApi: CleanApkAppDetailApi ) : StoreApiRepository { override suspend fun getHomeScreenData(): Any { return cleanAPKInterface.getHomeScreenData( CleanAPKInterface.APP_TYPE_PWA, CleanAPKInterface.APP_SOURCE_ANY ) } override suspend fun getSearchResult(query: String): Any { TODO("Not yet implemented") } } No newline at end of file
app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt +8 −10 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import foundation.e.apps.api.cleanapk.CleanAPKInterface import foundation.e.apps.api.cleanapk.CleanAPKRepository import foundation.e.apps.api.cleanapk.data.categories.Categories import foundation.e.apps.api.cleanapk.data.home.Home import foundation.e.apps.api.cleanapk.data.home.HomeScreen import foundation.e.apps.api.cleanapk.data.search.Search import foundation.e.apps.api.fdroid.FdroidWebInterface import foundation.e.apps.api.fused.data.FusedApp Loading Loading @@ -66,6 +67,7 @@ import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.toList import kotlinx.coroutines.withTimeout import retrofit2.Response import timber.log.Timber import javax.inject.Inject import javax.inject.Named Loading @@ -80,6 +82,8 @@ class FusedAPIImpl @Inject constructor( private val preferenceManagerModule: PreferenceManagerModule, private val fdroidWebInterface: FdroidWebInterface, @Named("gplayRepository") private val gplayRepository: StoreApiRepository, @Named("cleanApkAppsRepository") private val cleanApkAppsRepository: StoreApiRepository, @Named("cleanApkPWARepository") private val cleanApkPWARepository: StoreApiRepository, @ApplicationContext private val context: Context ) { Loading Loading @@ -156,20 +160,14 @@ class FusedAPIImpl @Inject constructor( }) Source.OPEN -> runCodeBlockWithTimeout({ val response = cleanAPKRepository.getHomeScreenData( CleanAPKInterface.APP_TYPE_ANY, CleanAPKInterface.APP_SOURCE_FOSS ).body() val response = (cleanApkAppsRepository.getHomeScreenData() as Response<HomeScreen>).body() response?.home?.let { priorList.addAll(generateCleanAPKHome(it, APP_TYPE_OPEN)) } }) Source.PWA -> runCodeBlockWithTimeout({ val response = cleanAPKRepository.getHomeScreenData( CleanAPKInterface.APP_TYPE_PWA, CleanAPKInterface.APP_SOURCE_ANY ).body() val response = (cleanApkPWARepository.getHomeScreenData() as Response<HomeScreen>).body() response?.home?.let { priorList.addAll(generateCleanAPKHome(it, APP_TYPE_PWA)) } Loading Loading @@ -318,7 +316,7 @@ class FusedAPIImpl @Inject constructor( ) } private fun fetchGplaySearchResults( private suspend fun fetchGplaySearchResults( query: String, authData: AuthData, searchResult: MutableList<FusedApp>, Loading Loading @@ -1203,7 +1201,7 @@ class FusedAPIImpl @Inject constructor( } } private fun getGplaySearchResult( private suspend fun getGplaySearchResult( query: String, authData: AuthData ): LiveData<Pair<List<FusedApp>, Boolean>> { Loading
app/src/main/java/foundation/e/apps/api/gplay/GplayRepository.kt +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class GplayRepository @Inject constructor( return homeScreenData } override fun getSearchResult(query: String): LiveData<Pair<List<App>, Boolean>> { override suspend fun getSearchResult(query: String): LiveData<Pair<List<App>, Boolean>> { return liveData { withContext(Dispatchers.IO) { /* Loading