Loading app/src/main/java/foundation/e/apps/data/application/apps/AppsApiImpl.kt +5 −3 Original line number Diff line number Diff line Loading @@ -104,12 +104,14 @@ class AppsApiImpl @Inject constructor( val applicationList = mutableListOf<Application>() val playStore = stores.getStore(Source.PLAY_STORE) as? PlayStoreRepository val apps = playStore?.getAppsDetails(packageNameList).orEmpty() val response = handleNetworkResult { playStore?.getAppsDetails(packageNameList).orEmpty() } val apps = response.data ?: emptyList() for (app in apps) { handleFilteredApps(app, applicationList) } return Pair(applicationList, ResultStatus.OK) return Pair(applicationList, response.getResultStatus()) } /* Loading app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt +5 −5 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ class PlayStoreRepository @Inject constructor( withContext(Dispatchers.IO) { var appDetails: List<GplayApp> = getAppDetailsHelper().getAppByPackageName(packageNames) if (!isEmulator() && appDetails.any { it.versionCode == 0L } && isAnonymousUser()) { if (!isEmulator() && appDetails.all { it.versionCode == 0L } && isAnonymousUser()) { // Google Play returns limited result ( i.e. version code being 0) with a stale token, // so we need to refresh authentication to get a new token. Timber.i("Version code is 0.") Loading @@ -168,13 +168,13 @@ class PlayStoreRepository @Inject constructor( appDetails = getAppDetailsHelper().getAppByPackageName(packageNames) if (appDetails.any { it.versionCode == 0L }) { Timber.w("After refreshing auth, version code is still 0. Giving up installation.") throw IllegalStateException("App version code cannot be 0") if (appDetails.all { it.versionCode == 0L }) { Timber.w("After refreshing auth, version code is still 0.") } } appDetails.map { it.toApplication(context) } appDetails.filterNot { it.packageName.isBlank() || it.versionCode == 0L } .map { it.toApplication(context) } } override suspend fun getAppDetails(packageName: String): Application = Loading Loading
app/src/main/java/foundation/e/apps/data/application/apps/AppsApiImpl.kt +5 −3 Original line number Diff line number Diff line Loading @@ -104,12 +104,14 @@ class AppsApiImpl @Inject constructor( val applicationList = mutableListOf<Application>() val playStore = stores.getStore(Source.PLAY_STORE) as? PlayStoreRepository val apps = playStore?.getAppsDetails(packageNameList).orEmpty() val response = handleNetworkResult { playStore?.getAppsDetails(packageNameList).orEmpty() } val apps = response.data ?: emptyList() for (app in apps) { handleFilteredApps(app, applicationList) } return Pair(applicationList, ResultStatus.OK) return Pair(applicationList, response.getResultStatus()) } /* Loading
app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt +5 −5 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ class PlayStoreRepository @Inject constructor( withContext(Dispatchers.IO) { var appDetails: List<GplayApp> = getAppDetailsHelper().getAppByPackageName(packageNames) if (!isEmulator() && appDetails.any { it.versionCode == 0L } && isAnonymousUser()) { if (!isEmulator() && appDetails.all { it.versionCode == 0L } && isAnonymousUser()) { // Google Play returns limited result ( i.e. version code being 0) with a stale token, // so we need to refresh authentication to get a new token. Timber.i("Version code is 0.") Loading @@ -168,13 +168,13 @@ class PlayStoreRepository @Inject constructor( appDetails = getAppDetailsHelper().getAppByPackageName(packageNames) if (appDetails.any { it.versionCode == 0L }) { Timber.w("After refreshing auth, version code is still 0. Giving up installation.") throw IllegalStateException("App version code cannot be 0") if (appDetails.all { it.versionCode == 0L }) { Timber.w("After refreshing auth, version code is still 0.") } } appDetails.map { it.toApplication(context) } appDetails.filterNot { it.packageName.isBlank() || it.versionCode == 0L } .map { it.toApplication(context) } } override suspend fun getAppDetails(packageName: String): Application = Loading