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

Commit 7c4f92b4 authored by Hasib Prince's avatar Hasib Prince
Browse files

resolved conflict

parents db970a78 6f44f76b
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -22,8 +22,10 @@ buildDebug:
      - app/build/outputs/apk/debug/

test:
  allow_failure: true
  stage: debug
  stage: release
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: always
  script:
    - ./gradlew test -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl"
  artifacts:
+15 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ plugins {

def versionMajor = 2
def versionMinor = 5
def versionPatch = 5
def versionPatch = 8

def getGitHash = { ->
    def stdOut = new ByteArrayOutputStream()
@@ -133,6 +133,12 @@ android {
    kotlin.sourceSets.all {
        languageSettings.optIn("kotlin.RequiresOptIn")
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
}

kapt {
@@ -146,7 +152,9 @@ allOpen {
}

dependencies {
    implementation project(":modules")

    implementation project(':modules')

    // TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628
    api files('libs/splitinstall-lib.jar')

@@ -162,6 +170,7 @@ dependencies {
    implementation "androidx.datastore:datastore-preferences:1.0.0"
    implementation 'com.facebook.shimmer:shimmer:0.5.0'
    implementation 'androidx.core:core-google-shortcuts:1.0.0'
    implementation 'androidx.test.ext:junit-ktx:1.1.5'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
    testImplementation "com.google.truth:truth:1.1.3"
    testImplementation 'junit:junit:4.13.2'
@@ -250,4 +259,8 @@ dependencies {

    // elib
    implementation 'foundation.e:elib:0.0.1-alpha11'

    testImplementation 'org.mockito:mockito-core:5.0.0'
    testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'
    testImplementation 'org.robolectric:robolectric:4.9'
}
+0 −1
Original line number Diff line number Diff line
@@ -20,6 +20,5 @@ package foundation.e.apps.data.enums

enum class Origin {
    CLEANAPK,
    GITLAB,
    GPLAY
}
+0 −1
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ class FusedAPIRepository @Inject constructor(private val fusedAPIImpl: FusedApi)
    }

    suspend fun updateFusedDownloadWithDownloadingInfo(
        authData: AuthData,
        origin: Origin,
        fusedDownload: FusedDownload
    ) {
+33 −22
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ 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
import com.aurora.gplayapi.SearchSuggestEntry
import com.aurora.gplayapi.data.models.App
@@ -62,6 +62,7 @@ import foundation.e.apps.data.fused.utils.CategoryType
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.runFlowWithTimeout
import foundation.e.apps.data.preference.PreferenceManagerModule
import foundation.e.apps.install.pkg.PWAManagerModule
import foundation.e.apps.install.pkg.PkgManagerModule
@@ -79,7 +80,7 @@ import javax.inject.Inject
import javax.inject.Named
import javax.inject.Singleton

typealias GplaySearchResultFlow = Flow<ResultSupreme<Pair<List<FusedApp>, Boolean>>>
typealias GplaySearchResultLiveData = LiveData<ResultSupreme<Pair<List<FusedApp>, Boolean>>>
typealias FusedHomeDeferred = Deferred<ResultSupreme<List<FusedHome>>>

@Singleton
@@ -254,8 +255,9 @@ class FusedApiImpl @Inject constructor(
         */
        return liveData {
            val packageSpecificResults = ArrayList<FusedApp>()

            fetchPackageSpecificResult(authData, query, packageSpecificResults).let {
                if (it.data?.second == true) { // if there are no data to load
                if (it.data?.second != true) { // if there are no data to load
                    emit(it)
                    return@liveData
                }
@@ -289,7 +291,7 @@ class FusedApiImpl @Inject constructor(
                        query,
                        searchResult,
                        packageSpecificResults
                    ).asLiveData()
                    )
                )
            }
        }
@@ -333,10 +335,18 @@ class FusedApiImpl @Inject constructor(
        query: String,
        searchResult: MutableList<FusedApp>,
        packageSpecificResults: ArrayList<FusedApp>
    ): GplaySearchResultFlow = getGplaySearchResult(query).map {
        if (it.first.isNotEmpty()) {
            searchResult.addAll(it.first)
    ): GplaySearchResultLiveData {
        return runFlowWithTimeout(
            {
                getGplaySearchResult(query)
            }, {
            it.second
        }, {
            Pair(listOf(), false) // empty data for timeout
        }
        ).map {
            if (it.isSuccess()) {
                searchResult.addAll(it.data!!.first)
                ResultSupreme.Success(
                    Pair(
                        filterWithKeywordSearch(
@@ -344,9 +354,13 @@ class FusedApiImpl @Inject constructor(
                            packageSpecificResults,
                            query
                        ),
                it.second
                        it.data!!.second
                    )
                )
            } else {
                it
            }
        }
    }

    private suspend fun fetchOpenSourceSearchResult(
@@ -409,10 +423,10 @@ class FusedApiImpl @Inject constructor(
         * Also send true in the pair to signal more results being loaded.
         */
        if (status != ResultStatus.OK) {
            return ResultSupreme.create(status, Pair(packageSpecificResults, true))
        }
            return ResultSupreme.create(status, Pair(packageSpecificResults, false))
        }
        return ResultSupreme.create(status, Pair(packageSpecificResults, true))
    }

    /*
             * The list packageSpecificResults may contain apps with duplicate package names.
@@ -537,9 +551,6 @@ class FusedApiImpl @Inject constructor(
                fusedDownload.files = downloadList
                list.addAll(downloadList.map { it.url })
            }

            Origin.GITLAB -> {
            }
        }
        fusedDownload.downloadURLList = list
    }
Loading