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

Commit 7063de5c authored by Hasib Prince's avatar Hasib Prince
Browse files

Enum is introduced for app sources

parent e2918ba8
Loading
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
    <ID>MagicNumber:ApkSignatureManager.kt$ApkSignatureManager$1024</ID>
    <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.&lt;no name provided&gt;$3</ID>
    <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.&lt;no name provided&gt;$4</ID>
    <ID>MagicNumber:ApplicationApiImpl.kt$ApplicationApiImpl$3</ID>
    <ID>MagicNumber:ApplicationFragment.kt$ApplicationFragment$100f</ID>
    <ID>MagicNumber:ApplicationFragment.kt$ApplicationFragment$15</ID>
    <ID>MagicNumber:ApplicationFragment.kt$ApplicationFragment$3</ID>
@@ -74,8 +73,6 @@
    <ID>MaxLineLength:AppPrivacyInfo.kt$AppPrivacyInfo</ID>
    <ID>MaxLineLength:ApplicationApi.kt$ApplicationApi$suspend fun getGplayAppsByCategory(authData: AuthData, category: String, pageUrl: String?): ResultSupreme&lt;Pair&lt;List&lt;Application&gt;, String&gt;&gt;</ID>
    <ID>MaxLineLength:ApplicationApiImpl.kt$ApplicationApiImpl$(cleanApkAppsRepository.getAppDetails(result.apps[0]._id) as Response&lt;CleanApkApplication&gt;).body()?.app</ID>
    <ID>MaxLineLength:ApplicationApiImpl.kt$ApplicationApiImpl$val hasGplayLimitedResult = gplayHomes.any { fusedHome -&gt; fusedHome.list.size &lt; THRESHOLD_LIMITED_RESULT_HOME_PAGE }</ID>
    <ID>MaxLineLength:ApplicationDiffUtil.kt$ApplicationDiffUtil$((oldItem.trackers == LIST_OF_NULL &amp;&amp; newItem.trackers.isEmpty()) || oldItem.trackers == newItem.trackers)</ID>
    <ID>MaxLineLength:ApplicationFragment.kt$ApplicationFragment.Companion$"https://gitlab.e.foundation/e/os/apps/-/blob/main/app/src/main/java/foundation/e/apps/data/exodus/repositories/PrivacyScoreRepositoryImpl.kt"</ID>
    <ID>MaxLineLength:CommonUtilsModule.kt$CommonUtilsModule$*</ID>
    <ID>MaxLineLength:DownloadManager.kt$DownloadManager$Timber.e("Download Issue: $downloadId : DownloadManager returns status: $status but the failed because: reason: $reason")</ID>
@@ -83,9 +80,6 @@
    <ID>MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$Timber.d("===&gt; updateDownloadStatus: ${fusedDownload.name}: $downloadId: $numberOfDownloadedItems/${fusedDownload.downloadIdMap.size}")</ID>
    <ID>MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$if</ID>
    <ID>MaxLineLength:DownloadManagerUtils.kt$DownloadManagerUtils$numberOfDownloadedItems == fusedDownload.downloadIdMap.size &amp;&amp; numberOfDownloadedItems == fusedDownload.downloadURLList.size</ID>
    <ID>MaxLineLength:DownloadProgressLD.kt$DownloadProgressLD$cursor.getLong(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR))</ID>
    <ID>MaxLineLength:DownloadProgressLD.kt$DownloadProgressLD$cursor.getLong(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES))</ID>
    <ID>MaxLineLength:DownloadProgressLD.kt$DownloadProgressLD$status == DownloadManager.STATUS_SUCCESSFUL || status == DownloadManager.STATUS_FAILED</ID>
    <ID>MaxLineLength:FdroidRepository.kt$FdroidRepository$override suspend</ID>
    <ID>MaxLineLength:FusedManagerImpl.kt$FusedManagerImpl$.</ID>
    <ID>MaxLineLength:FusedManagerImpl.kt$FusedManagerImpl$return</ID>
@@ -120,8 +114,6 @@
    <ID>ReturnCount:AppPrivacyInfoRepositoryImpl.kt$AppPrivacyInfoRepositoryImpl$override suspend fun getAppPrivacyInfo( application: Application, appHandle: String ): Result&lt;AppPrivacyInfo&gt;</ID>
    <ID>ReturnCount:AppPrivacyInfoRepositoryImpl.kt$AppPrivacyInfoRepositoryImpl$private fun getAppPrivacyInfo( application: Application, appTrackerData: List&lt;Report&gt;, ): AppPrivacyInfo</ID>
    <ID>ReturnCount:ApplicationApiImpl.kt$ApplicationApiImpl$override fun isAnyFusedAppUpdated( newApplications: List&lt;Application&gt;, oldApplications: List&lt;Application&gt; ): Boolean</ID>
    <ID>ReturnCount:ApplicationApiImpl.kt$ApplicationApiImpl$override fun isHomeDataUpdated( newHomeData: List&lt;Home&gt;, oldHomeData: List&lt;Home&gt; ): Boolean</ID>
    <ID>ReturnCount:ApplicationApiImpl.kt$ApplicationApiImpl$private fun areFusedAppsUpdated( oldHome: Home, newHome: Home, ): Boolean</ID>
    <ID>ReturnCount:DownloadManager.kt$DownloadManager$fun getSizeRequired(downloadId: Long): Long</ID>
    <ID>ReturnCount:DownloadManager.kt$DownloadManager$private fun sanitizeStatus(downloadId: Long, status: Int, reason: Int): Int</ID>
    <ID>ReturnCount:Extensions.kt$fun Context.isNetworkAvailable(): Boolean</ID>
+3 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ class ApplicationDataManager @Inject constructor(
        return application.restriction != Constants.Restriction.NOT_RESTRICTED
    }

    /**
    /*
     * Some apps are simply not visible.
     * Example: com.skype.m2
     */
@@ -83,7 +83,7 @@ class ApplicationDataManager @Inject constructor(
        return kotlin.runCatching { gplayRepository.getAppDetails(application.package_name) }.isSuccess
    }

    /**
    /*
     * Some apps are visible but not downloadable.
     * Example: com.riotgames.league.wildrift
     */
@@ -103,7 +103,7 @@ class ApplicationDataManager @Inject constructor(
        }
    }

    /**
    /*
     * Get fused app installation status.
     * Applicable for both native apps and PWAs.
     *
+11 −7
Original line number Diff line number Diff line
@@ -59,10 +59,14 @@ class HomeApiImpl @Inject constructor(

    companion object {
        private const val THRESHOLD_LIMITED_RESULT_HOME_PAGE = 4
        private const val WEIGHT_PWA = 1
        private const val WEIGHT_OPEN_SOURCE = 2
        private const val WEIGHT_GPLAY = 3
    }

    private enum class AppSourceWeight {
        GPLAY,
        OPEN_SOURCE,
        PWA
    }

    override suspend fun fetchHomeScreenData(authData: AuthData): LiveData<ResultSupreme<List<Home>>> {
        val list = mutableListOf<Home>()
        var resultGplay: FusedHomeDeferred? = null
@@ -120,11 +124,11 @@ class HomeApiImpl @Inject constructor(
        }

        setHomeErrorMessage(result.getResultStatus(), source)
        priorList.sortByDescending {
        priorList.sortBy {
            when (it.source) {
                ApplicationApi.APP_TYPE_OPEN -> WEIGHT_OPEN_SOURCE
                ApplicationApi.APP_TYPE_PWA -> WEIGHT_PWA
                else -> WEIGHT_GPLAY
                ApplicationApi.APP_TYPE_OPEN -> AppSourceWeight.OPEN_SOURCE.ordinal
                ApplicationApi.APP_TYPE_PWA -> AppSourceWeight.PWA.ordinal
                else -> AppSourceWeight.GPLAY.ordinal
            }
        }

+18 −0
Original line number Diff line number Diff line
/*
 * Copyright MURENA SAS 2023
 * Apps  Quickly and easily install Android apps onto your device!
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package foundation.e.apps.di

import dagger.Binds