Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da72ceeb authored by Hasib Prince's avatar Hasib Prince
Browse files

some more refactoring

parent b656005b
Loading
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -18,14 +18,9 @@

package foundation.e.apps.api

import foundation.e.apps.api.fused.utils.CategoryType

interface StoreRepository {
interface BaseStoreRepository {
    suspend fun getHomeScreenData(): Any
    suspend fun getSearchResult(query: String, searchBy: String? = null): Any
    suspend fun getSearchSuggestions(query: String): Any
    suspend fun getAppsByCategory(category: String, paginationParameter: Any? = null): Any
    suspend fun getCategories(type: CategoryType? = null): Any
    suspend fun getAppDetails(packageNameOrId: String): Any?
    suspend fun getAppsDetails(packageNamesOrIds: List<String>): Any
}
+0 −6
Original line number Diff line number Diff line
package foundation.e.apps.api


interface DownloadInfoFetcher {
    suspend fun getDownloadInfo(idOrPackageName: String, versionCode: Any? = null, offerType: Int = -1): Any
}
 No newline at end of file
+0 −12
Original line number Diff line number Diff line
package foundation.e.apps.api

import foundation.e.apps.manager.database.fusedDownload.FusedDownload

interface OnDemandModuleFetcher {
    suspend fun getOnDemandModule(
        packageName: String,
        moduleName: String,
        versionCode: Int,
        offerType: Int
    ): Any
}
 No newline at end of file
+16 −16
Original line number Diff line number Diff line
@@ -29,15 +29,15 @@ import javax.inject.Inject

@OpenForTesting
class CleanAPKRepository @Inject constructor(
    private val cleanAPKInterface: CleanAPKInterface,
    private val cleanApkAppDetailApi: CleanApkAppDetailApi
    private val cleanAPKRetrofit: CleanApkRetrofit,
    private val cleanApkAppDetailsRetrofit: CleanApkAppDetailsRetrofit
) {

    suspend fun getHomeScreenData(
        type: String = CleanAPKInterface.APP_TYPE_ANY,
        source: String = CleanAPKInterface.APP_SOURCE_ANY
        type: String = CleanApkRetrofit.APP_TYPE_ANY,
        source: String = CleanApkRetrofit.APP_SOURCE_ANY
    ): Response<HomeScreen> {
        return cleanAPKInterface.getHomeScreenData(type, source)
        return cleanAPKRetrofit.getHomeScreenData(type, source)
    }

    suspend fun getAppOrPWADetailsByID(
@@ -45,28 +45,28 @@ class CleanAPKRepository @Inject constructor(
        architectures: List<String>? = null,
        type: String? = null
    ): Response<Application> {
        return cleanApkAppDetailApi.getAppOrPWADetailsByID(id, architectures, type)
        return cleanApkAppDetailsRetrofit.getAppOrPWADetailsByID(id, architectures, type)
    }

    suspend fun searchApps(
        keyword: String,
        source: String = CleanAPKInterface.APP_SOURCE_FOSS,
        type: String = CleanAPKInterface.APP_TYPE_ANY,
        source: String = CleanApkRetrofit.APP_SOURCE_FOSS,
        type: String = CleanApkRetrofit.APP_TYPE_ANY,
        nres: Int = 20,
        page: Int = 1,
        by: String? = null
    ): Response<Search> {
        return cleanAPKInterface.searchApps(keyword, source, type, nres, page, by)
        return cleanAPKRetrofit.searchApps(keyword, source, type, nres, page, by)
    }

    suspend fun listApps(
        category: String,
        source: String = CleanAPKInterface.APP_SOURCE_FOSS,
        type: String = CleanAPKInterface.APP_TYPE_ANY,
        source: String = CleanApkRetrofit.APP_SOURCE_FOSS,
        type: String = CleanApkRetrofit.APP_TYPE_ANY,
        nres: Int = 20,
        page: Int = 1,
    ): Response<Search> {
        return cleanAPKInterface.listApps(category, source, type, nres, page)
        return cleanAPKRetrofit.listApps(category, source, type, nres, page)
    }

    suspend fun getDownloadInfo(
@@ -74,13 +74,13 @@ class CleanAPKRepository @Inject constructor(
        version: String? = null,
        architecture: String? = null
    ): Response<Download> {
        return cleanAPKInterface.getDownloadInfo(id, version, architecture)
        return cleanAPKRetrofit.getDownloadInfo(id, version, architecture)
    }

    suspend fun getCategoriesList(
        type: String = CleanAPKInterface.APP_TYPE_ANY,
        source: String = CleanAPKInterface.APP_SOURCE_ANY
        type: String = CleanApkRetrofit.APP_TYPE_ANY,
        source: String = CleanApkRetrofit.APP_SOURCE_ANY
    ): Response<Categories> {
        return cleanAPKInterface.getCategoriesList(type, source)
        return cleanAPKRetrofit.getCategoriesList(type, source)
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query

interface CleanApkAppDetailApi {
interface CleanApkAppDetailsRetrofit {

    companion object {
        // API endpoints
Loading