Loading app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -90,8 +90,8 @@ android { buildTypes { debug { // versionNameSuffix ".debug" // applicationIdSuffix ".debug" versionNameSuffix ".debug" applicationIdSuffix ".debug" signingConfig signingConfigs.debugConfig proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } Loading app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt +1 −35 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ package foundation.e.apps.data.fused import android.content.Context import android.text.format.Formatter import androidx.lifecycle.LiveData import androidx.lifecycle.asLiveData import androidx.lifecycle.liveData import androidx.lifecycle.map import com.aurora.gplayapi.Constants Loading Loading @@ -65,19 +64,15 @@ import foundation.e.apps.data.fused.utils.CategoryUtils import foundation.e.apps.data.fusedDownload.models.FusedDownload import foundation.e.apps.data.gplay.GplayStoreRepository import foundation.e.apps.data.gplay.utils.GplayHttpRequestException import foundation.e.apps.data.gplay.utils.runFlowWithTimeout import foundation.e.apps.data.login.exceptions.GPlayException import foundation.e.apps.data.login.exceptions.UnknownSourceException import foundation.e.apps.data.preference.PreferenceManagerModule import foundation.e.apps.install.pkg.PWAManagerModule import foundation.e.apps.install.pkg.PkgManagerModule import foundation.e.apps.ui.home.model.HomeChildFusedAppDiffUtil import foundation.e.apps.ui.search.SearchViewModel import kotlinx.coroutines.Deferred import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.withTimeout import retrofit2.Response Loading Loading @@ -290,15 +285,6 @@ class FusedApiImpl @Inject constructor( ) } // if (preferenceManagerModule.isGplaySelected()) { // emitSource( // fetchGplaySearchResults( // query, // searchResult, // packageSpecificResults // ).asLiveData() // ) // } return finalSearchResult } Loading Loading @@ -335,26 +321,6 @@ class FusedApiImpl @Inject constructor( ) } // private suspend fun fetchGplaySearchResults( // query: String, // searchResult: MutableList<FusedApp>, // packageSpecificResults: ArrayList<FusedApp> // ): GplaySearchResultFlow = getGplaySearchResult(query).map { // if (it.first.isNotEmpty()) { // searchResult.addAll(it.first) // } // ResultSupreme.Success( // Pair( // filterWithKeywordSearch( // searchResult, // packageSpecificResults, // query // ), // it.second // ) // ) // } private suspend fun fetchOpenSourceSearchResult( cleanApkResults: MutableList<FusedApp>, query: String, Loading app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepository.kt +0 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import foundation.e.apps.data.BaseStoreRepository import foundation.e.apps.data.fused.utils.CategoryType import kotlinx.coroutines.flow.Flow interface GplayStoreRepository : BaseStoreRepository { suspend fun getSearchResult(query: String, subBundle: MutableSet<SearchBundle.SubBundle>?): Pair<List<App>, MutableSet<SearchBundle.SubBundle>> Loading app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepositoryImpl.kt +13 −137 Original line number Diff line number Diff line Loading @@ -39,10 +39,6 @@ import foundation.e.apps.data.fused.utils.CategoryType import foundation.e.apps.data.gplay.utils.GPlayHttpClient import foundation.e.apps.data.login.LoginSourceRepository import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.withContext import timber.log.Timber import javax.inject.Inject Loading Loading @@ -77,54 +73,6 @@ class GplayStoreRepositoryImpl @Inject constructor( context.getString(R.string.movers_shakers_games) to mapOf(Chart.MOVERS_SHAKERS to TopChartsHelper.Type.GAME), ) // override suspend fun getSearchResult( // query: String, // ): Flow<Pair<List<App>, Boolean>> { // return flow { // // /* // * Variable names and logic made same as that of Aurora store. // * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5171 // */ // var authData = loginSourceRepository.gplayAuth ?: return@flow // // val searchHelper = // SearchHelper(authData).using(gPlayHttpClient) // val searchBundle = searchHelper.searchResults(query) // // val initialReplacedList = mutableListOf<App>() // val INITIAL_LIMIT = 4 // // emitReplacedList( // this@flow, // initialReplacedList, // INITIAL_LIMIT, // searchBundle, // true, // ) // // var nextSubBundleSet: MutableSet<SearchBundle.SubBundle> // do { // nextSubBundleSet = fetchNextSubBundle( // searchBundle, // searchHelper, // this@flow, // initialReplacedList, // INITIAL_LIMIT // ) // } while (nextSubBundleSet.isNotEmpty()) // // /* // * If initialReplacedList size is less than INITIAL_LIMIT, // * it means the results were very less and nothing has been emitted so far. // * Hence emit the list. // */ // if (initialReplacedList.size < INITIAL_LIMIT) { // emitInMain(this@flow, initialReplacedList, false) // } // }.flowOn(Dispatchers.IO) // } override suspend fun getSearchResult( query: String, subBundle: MutableSet<SearchBundle.SubBundle>? Loading @@ -137,15 +85,14 @@ class GplayStoreRepositoryImpl @Inject constructor( subBundle?.let { val searchResult = searchHelper.next(it) Timber.d("fetching next page search data...") return emitSearchResult(searchResult) return getSearchResultPair(searchResult) } val searchResult = searchHelper.searchResults(query) return emitSearchResult(searchResult) return getSearchResultPair(searchResult) } private fun emitSearchResult( private fun getSearchResultPair( searchBundle: SearchBundle ): Pair<MutableList<App>, MutableSet<SearchBundle.SubBundle>> { val apps = searchBundle.appList Loading @@ -153,31 +100,6 @@ class GplayStoreRepositoryImpl @Inject constructor( return Pair(apps, searchBundle.subBundles) } private suspend fun fetchNextSubBundle( searchBundle: SearchBundle, searchHelper: SearchHelper, scope: FlowCollector<Pair<List<App>, Boolean>>, accumulationList: MutableList<App>, accumulationLimit: Int, ): MutableSet<SearchBundle.SubBundle> { val nextSubBundleSet = searchBundle.subBundles val newSearchBundle = searchHelper.next(nextSubBundleSet) if (newSearchBundle.appList.isNotEmpty()) { searchBundle.apply { subBundles.clear() subBundles.addAll(newSearchBundle.subBundles) emitReplacedList( scope, accumulationList, accumulationLimit, newSearchBundle, nextSubBundleSet.isNotEmpty(), ) } } return nextSubBundleSet } override suspend fun getSearchSuggestions(query: String): List<SearchSuggestEntry> { val authData = loginSourceRepository.gplayAuth ?: return listOf() Loading Loading @@ -243,52 +165,6 @@ class GplayStoreRepositoryImpl @Inject constructor( return if (type == CategoryType.APPLICATION) Category.Type.APPLICATION else Category.Type.GAME } private suspend fun emitReplacedList( scope: FlowCollector<Pair<List<App>, Boolean>>, accumulationList: MutableList<App>, accumulationLimit: Int, searchBundle: SearchBundle, moreToEmit: Boolean, ) { searchBundle.appList.forEach { when { accumulationList.size < accumulationLimit - 1 -> { /* * If initial limit is 4, add apps to list (without emitting) * till 2 apps. */ accumulationList.add(it) } accumulationList.size == accumulationLimit - 1 -> { /* * If initial limit is 4, and we have reached till 3 apps, * add the 4th app and emit the list. */ accumulationList.add(it) scope.emit(Pair(accumulationList, moreToEmit)) emitInMain(scope, accumulationList, moreToEmit) } accumulationList.size == accumulationLimit -> { /* * If initial limit is 4, and we have emitted 4 apps, * for all rest of the apps, emit each app one by one. */ emitInMain(scope, listOf(it), moreToEmit) } } } } private suspend fun emitInMain( scope: FlowCollector<Pair<List<App>, Boolean>>, it: List<App>, moreToEmit: Boolean ) { scope.emit(Pair(it, moreToEmit)) } private suspend fun getTopApps( type: TopChartsHelper.Type, chart: Chart, Loading app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt +0 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package foundation.e.apps.install.workmanager import android.content.Context import android.net.ConnectivityManager import android.net.NetworkCapabilities import android.os.Environment import android.os.StatFs import com.aurora.gplayapi.exceptions.ApiException Loading Loading
app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -90,8 +90,8 @@ android { buildTypes { debug { // versionNameSuffix ".debug" // applicationIdSuffix ".debug" versionNameSuffix ".debug" applicationIdSuffix ".debug" signingConfig signingConfigs.debugConfig proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } Loading
app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt +1 −35 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ package foundation.e.apps.data.fused import android.content.Context import android.text.format.Formatter import androidx.lifecycle.LiveData import androidx.lifecycle.asLiveData import androidx.lifecycle.liveData import androidx.lifecycle.map import com.aurora.gplayapi.Constants Loading Loading @@ -65,19 +64,15 @@ import foundation.e.apps.data.fused.utils.CategoryUtils import foundation.e.apps.data.fusedDownload.models.FusedDownload import foundation.e.apps.data.gplay.GplayStoreRepository import foundation.e.apps.data.gplay.utils.GplayHttpRequestException import foundation.e.apps.data.gplay.utils.runFlowWithTimeout import foundation.e.apps.data.login.exceptions.GPlayException import foundation.e.apps.data.login.exceptions.UnknownSourceException import foundation.e.apps.data.preference.PreferenceManagerModule import foundation.e.apps.install.pkg.PWAManagerModule import foundation.e.apps.install.pkg.PkgManagerModule import foundation.e.apps.ui.home.model.HomeChildFusedAppDiffUtil import foundation.e.apps.ui.search.SearchViewModel import kotlinx.coroutines.Deferred import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.withTimeout import retrofit2.Response Loading Loading @@ -290,15 +285,6 @@ class FusedApiImpl @Inject constructor( ) } // if (preferenceManagerModule.isGplaySelected()) { // emitSource( // fetchGplaySearchResults( // query, // searchResult, // packageSpecificResults // ).asLiveData() // ) // } return finalSearchResult } Loading Loading @@ -335,26 +321,6 @@ class FusedApiImpl @Inject constructor( ) } // private suspend fun fetchGplaySearchResults( // query: String, // searchResult: MutableList<FusedApp>, // packageSpecificResults: ArrayList<FusedApp> // ): GplaySearchResultFlow = getGplaySearchResult(query).map { // if (it.first.isNotEmpty()) { // searchResult.addAll(it.first) // } // ResultSupreme.Success( // Pair( // filterWithKeywordSearch( // searchResult, // packageSpecificResults, // query // ), // it.second // ) // ) // } private suspend fun fetchOpenSourceSearchResult( cleanApkResults: MutableList<FusedApp>, query: String, Loading
app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepository.kt +0 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import foundation.e.apps.data.BaseStoreRepository import foundation.e.apps.data.fused.utils.CategoryType import kotlinx.coroutines.flow.Flow interface GplayStoreRepository : BaseStoreRepository { suspend fun getSearchResult(query: String, subBundle: MutableSet<SearchBundle.SubBundle>?): Pair<List<App>, MutableSet<SearchBundle.SubBundle>> Loading
app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepositoryImpl.kt +13 −137 Original line number Diff line number Diff line Loading @@ -39,10 +39,6 @@ import foundation.e.apps.data.fused.utils.CategoryType import foundation.e.apps.data.gplay.utils.GPlayHttpClient import foundation.e.apps.data.login.LoginSourceRepository import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.withContext import timber.log.Timber import javax.inject.Inject Loading Loading @@ -77,54 +73,6 @@ class GplayStoreRepositoryImpl @Inject constructor( context.getString(R.string.movers_shakers_games) to mapOf(Chart.MOVERS_SHAKERS to TopChartsHelper.Type.GAME), ) // override suspend fun getSearchResult( // query: String, // ): Flow<Pair<List<App>, Boolean>> { // return flow { // // /* // * Variable names and logic made same as that of Aurora store. // * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5171 // */ // var authData = loginSourceRepository.gplayAuth ?: return@flow // // val searchHelper = // SearchHelper(authData).using(gPlayHttpClient) // val searchBundle = searchHelper.searchResults(query) // // val initialReplacedList = mutableListOf<App>() // val INITIAL_LIMIT = 4 // // emitReplacedList( // this@flow, // initialReplacedList, // INITIAL_LIMIT, // searchBundle, // true, // ) // // var nextSubBundleSet: MutableSet<SearchBundle.SubBundle> // do { // nextSubBundleSet = fetchNextSubBundle( // searchBundle, // searchHelper, // this@flow, // initialReplacedList, // INITIAL_LIMIT // ) // } while (nextSubBundleSet.isNotEmpty()) // // /* // * If initialReplacedList size is less than INITIAL_LIMIT, // * it means the results were very less and nothing has been emitted so far. // * Hence emit the list. // */ // if (initialReplacedList.size < INITIAL_LIMIT) { // emitInMain(this@flow, initialReplacedList, false) // } // }.flowOn(Dispatchers.IO) // } override suspend fun getSearchResult( query: String, subBundle: MutableSet<SearchBundle.SubBundle>? Loading @@ -137,15 +85,14 @@ class GplayStoreRepositoryImpl @Inject constructor( subBundle?.let { val searchResult = searchHelper.next(it) Timber.d("fetching next page search data...") return emitSearchResult(searchResult) return getSearchResultPair(searchResult) } val searchResult = searchHelper.searchResults(query) return emitSearchResult(searchResult) return getSearchResultPair(searchResult) } private fun emitSearchResult( private fun getSearchResultPair( searchBundle: SearchBundle ): Pair<MutableList<App>, MutableSet<SearchBundle.SubBundle>> { val apps = searchBundle.appList Loading @@ -153,31 +100,6 @@ class GplayStoreRepositoryImpl @Inject constructor( return Pair(apps, searchBundle.subBundles) } private suspend fun fetchNextSubBundle( searchBundle: SearchBundle, searchHelper: SearchHelper, scope: FlowCollector<Pair<List<App>, Boolean>>, accumulationList: MutableList<App>, accumulationLimit: Int, ): MutableSet<SearchBundle.SubBundle> { val nextSubBundleSet = searchBundle.subBundles val newSearchBundle = searchHelper.next(nextSubBundleSet) if (newSearchBundle.appList.isNotEmpty()) { searchBundle.apply { subBundles.clear() subBundles.addAll(newSearchBundle.subBundles) emitReplacedList( scope, accumulationList, accumulationLimit, newSearchBundle, nextSubBundleSet.isNotEmpty(), ) } } return nextSubBundleSet } override suspend fun getSearchSuggestions(query: String): List<SearchSuggestEntry> { val authData = loginSourceRepository.gplayAuth ?: return listOf() Loading Loading @@ -243,52 +165,6 @@ class GplayStoreRepositoryImpl @Inject constructor( return if (type == CategoryType.APPLICATION) Category.Type.APPLICATION else Category.Type.GAME } private suspend fun emitReplacedList( scope: FlowCollector<Pair<List<App>, Boolean>>, accumulationList: MutableList<App>, accumulationLimit: Int, searchBundle: SearchBundle, moreToEmit: Boolean, ) { searchBundle.appList.forEach { when { accumulationList.size < accumulationLimit - 1 -> { /* * If initial limit is 4, add apps to list (without emitting) * till 2 apps. */ accumulationList.add(it) } accumulationList.size == accumulationLimit - 1 -> { /* * If initial limit is 4, and we have reached till 3 apps, * add the 4th app and emit the list. */ accumulationList.add(it) scope.emit(Pair(accumulationList, moreToEmit)) emitInMain(scope, accumulationList, moreToEmit) } accumulationList.size == accumulationLimit -> { /* * If initial limit is 4, and we have emitted 4 apps, * for all rest of the apps, emit each app one by one. */ emitInMain(scope, listOf(it), moreToEmit) } } } } private suspend fun emitInMain( scope: FlowCollector<Pair<List<App>, Boolean>>, it: List<App>, moreToEmit: Boolean ) { scope.emit(Pair(it, moreToEmit)) } private suspend fun getTopApps( type: TopChartsHelper.Type, chart: Chart, Loading
app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt +0 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package foundation.e.apps.install.workmanager import android.content.Context import android.net.ConnectivityManager import android.net.NetworkCapabilities import android.os.Environment import android.os.StatFs import com.aurora.gplayapi.exceptions.ApiException Loading