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

Commit 0fa8f697 authored by Hasib Prince's avatar Hasib Prince
Browse files

Merge branch '333-fix_fetch_onDemand_module' into 'main'

fixed: hanlded exception of fetchOnDemandModule

See merge request !434
parents 39712490 762d6401
Loading
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import foundation.e.apps.data.AppSourcesContainer
import foundation.e.apps.data.cleanapk.CleanApkDownloadInfoFetcher
import foundation.e.apps.data.enums.Origin
import foundation.e.apps.data.fusedDownload.models.FusedDownload
import foundation.e.apps.data.handleNetworkResult
import javax.inject.Inject

class DownloadInfoApiImpl @Inject constructor(
@@ -34,18 +35,22 @@ class DownloadInfoApiImpl @Inject constructor(
        versionCode: Int,
        offerType: Int
    ): String? {
        val list = appSources.gplayRepo.getOnDemandModule(
        val result = handleNetworkResult {
            appSources.gplayRepo.getOnDemandModule(
                packageName,
                moduleName,
                versionCode,
                offerType,
            )
        }

        for (element in list) {
        if (result.isSuccess()) {
            for (element in result.data!!) { // isSuccess() checks ensures null safety of data
                if (element.name == "$moduleName.apk") {
                    return element.url
                }
            }
        }

        return null
    }