Loading app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt +19 −26 Original line number Diff line number Diff line Loading @@ -694,7 +694,7 @@ class FusedApiImpl @Inject constructor( appList: List<App>, ): ResultSupreme<List<FusedApp>> { val filteredFusedApps = mutableListOf<FusedApp>() val status = runCodeWithTimeout({ return handleResultFromAppSources { appList.forEach { val filter = getAppFilterLevel(it, authData) if (filter.isUnFiltered()) { Loading @@ -705,9 +705,8 @@ class FusedApiImpl @Inject constructor( ) } } }) return ResultSupreme.create(status, filteredFusedApps) filteredFusedApps } } /** Loading Loading @@ -786,7 +785,7 @@ class FusedApiImpl @Inject constructor( var response: FusedApp? = null val status = runCodeWithTimeout({ val result = handleResultFromAppSources { response = if (origin == Origin.CLEANAPK) { (cleanApkAppsRepository.getAppDetails(id) as Response<Application>).body()?.app } else { Loading @@ -799,9 +798,10 @@ class FusedApiImpl @Inject constructor( it.updateSource() it.updateFilterLevel(authData) } }) response } return Pair(response ?: FusedApp(), status) return Pair(result.data ?: FusedApp(), result.getResultStatus()) } /* Loading Loading @@ -839,9 +839,9 @@ class FusedApiImpl @Inject constructor( val gplayCategoryResult = fetchGplayCategories( type, ) categoriesList.addAll(gplayCategoryResult.second) apiStatus = gplayCategoryResult.first errorApplicationCategory = gplayCategoryResult.third categoriesList.addAll(gplayCategoryResult.data ?: listOf()) apiStatus = gplayCategoryResult.getResultStatus() errorApplicationCategory = APP_TYPE_ANY } return Pair(apiStatus, errorApplicationCategory) Loading @@ -849,25 +849,18 @@ class FusedApiImpl @Inject constructor( private suspend fun fetchGplayCategories( type: CategoryType, ): Triple<ResultStatus, List<FusedCategory>, String> { var errorApplicationCategory = "" var apiStatus = ResultStatus.OK ): ResultSupreme<List<FusedCategory>> { val categoryList = mutableListOf<FusedCategory>() runCodeWithTimeout({ return handleResultFromAppSources { val playResponse = gplayRepository.getCategories(type).map { app -> val category = app.transformToFusedCategory() updateCategoryDrawable(category) category } categoryList.addAll(playResponse) }, { errorApplicationCategory = APP_TYPE_ANY apiStatus = ResultStatus.TIMEOUT }, { errorApplicationCategory = APP_TYPE_ANY apiStatus = ResultStatus.UNKNOWN }) return Triple(apiStatus, categoryList, errorApplicationCategory) categoryList } } private suspend fun fetchPWACategories( Loading Loading @@ -1131,6 +1124,7 @@ class FusedApiImpl @Inject constructor( is SocketTimeoutException -> "Timeout" else -> "Unknown" } return (e.localizedMessage?.ifBlank { ERROR_GPLAY_API } ?: ERROR_GPLAY_API) + "Status: $status" } Loading Loading @@ -1437,7 +1431,7 @@ class FusedApiImpl @Inject constructor( var fusedAppList: MutableList<FusedApp> = mutableListOf() var nextPageUrl = "" val status = runCodeWithTimeout({ return handleResultFromAppSources { val streamCluster = gplayRepository.getAppsByCategory(category, pageUrl) as StreamCluster Loading @@ -1450,8 +1444,7 @@ class FusedApiImpl @Inject constructor( if (!nextPageUrl.isNullOrEmpty()) { fusedAppList.add(FusedApp(isPlaceHolder = true)) } }) return ResultSupreme.create(status, Pair(fusedAppList, nextPageUrl)) Pair(fusedAppList, nextPageUrl) } } } Loading
app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt +19 −26 Original line number Diff line number Diff line Loading @@ -694,7 +694,7 @@ class FusedApiImpl @Inject constructor( appList: List<App>, ): ResultSupreme<List<FusedApp>> { val filteredFusedApps = mutableListOf<FusedApp>() val status = runCodeWithTimeout({ return handleResultFromAppSources { appList.forEach { val filter = getAppFilterLevel(it, authData) if (filter.isUnFiltered()) { Loading @@ -705,9 +705,8 @@ class FusedApiImpl @Inject constructor( ) } } }) return ResultSupreme.create(status, filteredFusedApps) filteredFusedApps } } /** Loading Loading @@ -786,7 +785,7 @@ class FusedApiImpl @Inject constructor( var response: FusedApp? = null val status = runCodeWithTimeout({ val result = handleResultFromAppSources { response = if (origin == Origin.CLEANAPK) { (cleanApkAppsRepository.getAppDetails(id) as Response<Application>).body()?.app } else { Loading @@ -799,9 +798,10 @@ class FusedApiImpl @Inject constructor( it.updateSource() it.updateFilterLevel(authData) } }) response } return Pair(response ?: FusedApp(), status) return Pair(result.data ?: FusedApp(), result.getResultStatus()) } /* Loading Loading @@ -839,9 +839,9 @@ class FusedApiImpl @Inject constructor( val gplayCategoryResult = fetchGplayCategories( type, ) categoriesList.addAll(gplayCategoryResult.second) apiStatus = gplayCategoryResult.first errorApplicationCategory = gplayCategoryResult.third categoriesList.addAll(gplayCategoryResult.data ?: listOf()) apiStatus = gplayCategoryResult.getResultStatus() errorApplicationCategory = APP_TYPE_ANY } return Pair(apiStatus, errorApplicationCategory) Loading @@ -849,25 +849,18 @@ class FusedApiImpl @Inject constructor( private suspend fun fetchGplayCategories( type: CategoryType, ): Triple<ResultStatus, List<FusedCategory>, String> { var errorApplicationCategory = "" var apiStatus = ResultStatus.OK ): ResultSupreme<List<FusedCategory>> { val categoryList = mutableListOf<FusedCategory>() runCodeWithTimeout({ return handleResultFromAppSources { val playResponse = gplayRepository.getCategories(type).map { app -> val category = app.transformToFusedCategory() updateCategoryDrawable(category) category } categoryList.addAll(playResponse) }, { errorApplicationCategory = APP_TYPE_ANY apiStatus = ResultStatus.TIMEOUT }, { errorApplicationCategory = APP_TYPE_ANY apiStatus = ResultStatus.UNKNOWN }) return Triple(apiStatus, categoryList, errorApplicationCategory) categoryList } } private suspend fun fetchPWACategories( Loading Loading @@ -1131,6 +1124,7 @@ class FusedApiImpl @Inject constructor( is SocketTimeoutException -> "Timeout" else -> "Unknown" } return (e.localizedMessage?.ifBlank { ERROR_GPLAY_API } ?: ERROR_GPLAY_API) + "Status: $status" } Loading Loading @@ -1437,7 +1431,7 @@ class FusedApiImpl @Inject constructor( var fusedAppList: MutableList<FusedApp> = mutableListOf() var nextPageUrl = "" val status = runCodeWithTimeout({ return handleResultFromAppSources { val streamCluster = gplayRepository.getAppsByCategory(category, pageUrl) as StreamCluster Loading @@ -1450,8 +1444,7 @@ class FusedApiImpl @Inject constructor( if (!nextPageUrl.isNullOrEmpty()) { fusedAppList.add(FusedApp(isPlaceHolder = true)) } }) return ResultSupreme.create(status, Pair(fusedAppList, nextPageUrl)) Pair(fusedAppList, nextPageUrl) } } }