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

Commit 5839b0bf authored by Jonathan Klee's avatar Jonathan Klee
Browse files

feat: introduce F-Droid store

parent 4cecfd66
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -123,6 +123,11 @@ android {
        buildConfigField "String", "USER_AGENT", "\"${retrieveKey("user_agent", "Dalvik/2.1.0 (Linux; U; Android %s)")}\""
        buildConfigField "String", "FDROID_HOST", "\"${fdroidHost}\""
        buildConfigField "String", "FDROID_REPO_BASE_URL", "\"https://${fdroidHost}/repo/\""
        buildConfigField(
            "String",
            "FDROID_DEFAULT_ICON_URL",
            "\"https://${fdroidHost}/assets/ic_repo_app_default_KNN008Z2K7VNPZOFLMTry3JkfFYPxVGDopS1iwWe5wo=.png\""
        )

        def parentalControlPkgName = "foundation.e.parentalcontrol"

+16 −0
Original line number Diff line number Diff line
@@ -28,7 +28,10 @@ import androidx.work.ExistingPeriodicWorkPolicy
import dagger.hilt.android.HiltAndroidApp
import foundation.e.apps.data.Constants.TAG_APP_INSTALL_STATE
import foundation.e.apps.data.Constants.TAG_AUTHDATA_DUMP
import foundation.e.apps.data.Stores
import foundation.e.apps.data.di.qualifiers.IoCoroutineScope
import foundation.e.apps.data.enums.Source
import foundation.e.apps.data.fdroid.index.FdroidIndexRepository
import foundation.e.apps.data.install.pkg.AppLoungePackageManager
import foundation.e.apps.data.install.pkg.PkgManagerBR
import foundation.e.apps.data.install.updates.UpdatesWorkManager
@@ -83,6 +86,12 @@ class AppLoungeApplication : Application(), Configuration.Provider {
    @Inject
    lateinit var installOrchestrator: InstallOrchestrator

    @Inject
    lateinit var fdroidIndexRepository: FdroidIndexRepository

    @Inject
    lateinit var stores: Stores

    @RequiresApi(Build.VERSION_CODES.TIRAMISU)
    override fun onCreate() {
        super.onCreate()
@@ -131,6 +140,13 @@ class AppLoungeApplication : Application(), Configuration.Provider {
                )
            }

            if (stores.isStoreEnabled(Source.FDROID)) {
                coroutineScope.launch {
                    runCatching { fdroidIndexRepository.getIndex() }
                        .onFailure { Timber.w(it, "Failed to prefetch F-Droid index") }
                }
            }

            removeStalledInstallationFromDb()
            installOrchestrator.init()
        }
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ object Constants {
    const val PREFERENCE_SHOW_FOSS = "showFOSSApplications"
    const val PREFERENCE_SHOW_PWA = "showPWAApplications"
    const val PREFERENCE_SHOW_GPLAY = "showAllApplications"
    const val PREFERENCE_SHOW_FDROID = "showFDroidApplications"

    const val ACTION_AUTHDATA_DUMP = "foundation.e.apps.action.DUMP_GACCOUNT_INFO"
    const val TAG_AUTHDATA_DUMP = "AUTHDATA_DUMP"
+11 −0
Original line number Diff line number Diff line
@@ -22,9 +22,11 @@ package foundation.e.apps.data
import foundation.e.apps.data.cleanapk.repositories.CleanApkAppsRepository
import foundation.e.apps.data.cleanapk.repositories.CleanApkPwaRepository
import foundation.e.apps.data.enums.Source
import foundation.e.apps.data.enums.Source.FDROID
import foundation.e.apps.data.enums.Source.OPEN_SOURCE
import foundation.e.apps.data.enums.Source.PLAY_STORE
import foundation.e.apps.data.enums.Source.PWA
import foundation.e.apps.data.fdroid.store.FdroidStoreRepository
import foundation.e.apps.data.playstore.PlayStoreRepository
import foundation.e.apps.domain.preferences.AppPreferencesRepository
import kotlinx.coroutines.flow.MutableStateFlow
@@ -37,6 +39,7 @@ import javax.inject.Singleton
@Singleton
class Stores @Inject constructor(
    playStoreRepository: PlayStoreRepository,
    fdroidStoreRepository: FdroidStoreRepository,
    cleanApkAppsRepository: CleanApkAppsRepository,
    cleanApkPwaRepository: CleanApkPwaRepository,
    appPreferencesRepository: AppPreferencesRepository
@@ -44,6 +47,7 @@ class Stores @Inject constructor(

    private val storeConfigs: Map<Source, StoreConfig> = buildStoreConfigs(
        playStoreRepository,
        fdroidStoreRepository,
        cleanApkAppsRepository,
        cleanApkPwaRepository,
        appPreferencesRepository
@@ -105,6 +109,7 @@ internal data class StoreConfig(

internal fun buildStoreConfigs(
    playStoreRepository: PlayStoreRepository,
    fdroidStoreRepository: FdroidStoreRepository,
    cleanApkAppsRepository: CleanApkAppsRepository,
    cleanApkPwaRepository: CleanApkPwaRepository,
    appPreferencesRepository: AppPreferencesRepository
@@ -115,6 +120,12 @@ internal fun buildStoreConfigs(
        enable = { appPreferencesRepository.enablePlayStore() },
        disable = { appPreferencesRepository.disablePlayStore() },
    ),
    FDROID to StoreConfig(
        repository = fdroidStoreRepository,
        isEnabled = { appPreferencesRepository.isFdroidSelected() },
        enable = { appPreferencesRepository.enableFdroid() },
        disable = { appPreferencesRepository.disableFdroid() },
    ),
    OPEN_SOURCE to StoreConfig(
        repository = cleanApkAppsRepository,
        isEnabled = { appPreferencesRepository.isOpenSourceSelected() },
+3 −1
Original line number Diff line number Diff line
@@ -59,7 +59,9 @@ class ApplicationDataManager @Inject constructor(
        return when {
            application.package_name.isBlank() -> FilterLevel.UNKNOWN
            !application.isFree && application.price.isBlank() -> FilterLevel.UI
            application.source == Source.PWA || application.source == Source.OPEN_SOURCE -> FilterLevel.NONE
            application.source == Source.PWA ||
                application.source == Source.OPEN_SOURCE ||
                application.source == Source.FDROID -> FilterLevel.NONE
            application.source == Source.SYSTEM_APP -> FilterLevel.NONE
            !isRestricted(application) -> FilterLevel.NONE
            !isApplicationVisible(application) -> FilterLevel.DATA
Loading