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

Commit 354c30a7 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge branch '7492-main-blocklist' into 'main'

refactor: move warning list to this repo and also add versioning

See merge request !771
parents 0eacbba0 ec1c979a
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ class DownloadManager @Inject constructor(
            directoryFile.mkdirs()
        }

        val downloadFile = File("$cacheDir/$fileName")
        val downloadFile = File(directoryFile, fileName)

        return downloadFile(url, downloadFile, downloadCompleted)
    }
+6 −6
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
package foundation.e.apps.data.blockedApps

import foundation.e.apps.data.DownloadManager
import foundation.e.apps.data.install.FileManager
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.serialization.json.Json
import timber.log.Timber
@@ -36,9 +35,11 @@ class BlockedAppRepository @Inject constructor(
) {

    companion object {
        private const val WARNING_LIST_VERSION = 1
        private const val WARNING_LIST_DIRECTORY = "warning_list"
        private const val WARNING_LIST_FILE_NAME = "$WARNING_LIST_VERSION.json"
        private const val APP_WARNING_LIST_FILE_URL =
            "https://gitlab.e.foundation/e/os/blocklist-app-lounge/-/raw/main/app-lounge-warning-list.json?inline=false"
        private const val WARNING_LIST_FILE_NAME = "app-lounge-warning-list.json"
            "https://gitlab.e.foundation/e/os/apps/-/raw/main/blocklist/$WARNING_LIST_FILE_NAME?inline=false"
    }

    private var blockedAppInfoList: AppWarningInfo? = null
@@ -61,6 +62,7 @@ class BlockedAppRepository @Inject constructor(
        suspendCancellableCoroutine { continuation ->
            downloadManager.downloadFileInCache(
                APP_WARNING_LIST_FILE_URL,
                subDirectoryPath = WARNING_LIST_DIRECTORY,
                fileName = WARNING_LIST_FILE_NAME
            ) { success, _ ->
                if (success) {
@@ -73,9 +75,7 @@ class BlockedAppRepository @Inject constructor(

    private fun parseBlockedAppDataFromFile() {
        blockedAppInfoList = try {
            val outputPath = "$cacheDir/warning_list/"
            FileManager.moveFile("$cacheDir/", WARNING_LIST_FILE_NAME, outputPath)
            val downloadedFile = File(outputPath + WARNING_LIST_FILE_NAME)
            val downloadedFile = File("$cacheDir/$WARNING_LIST_DIRECTORY/$WARNING_LIST_FILE_NAME")
            Timber.d("Blocked list file exists: ${downloadedFile.exists()}")
            val blockedAppInfoJson = String(downloadedFile.inputStream().readBytes())
            Timber.d("Blocked list file contents: $blockedAppInfoJson")
+4 −3
Original line number Diff line number Diff line
@@ -14,7 +14,8 @@ import org.junit.Test
class BlockedAppRepositoryTest {

    private val tempDir = Files.createTempDirectory("blockedAppsTest").toFile()
    private val warningFileName = "app-lounge-warning-list.json"
    private val warningListDirectory = File(tempDir, "warning_list").apply { mkdirs() }
    private val warningFileName = "1.json"

    @After
    fun tearDown() {
@@ -27,7 +28,7 @@ class BlockedAppRepositoryTest {
        every {
            downloadManager.downloadFileInCache(any(), any(), any(), any())
        } answers {
            File(tempDir, warningFileName).writeText(
            File(warningListDirectory, warningFileName).writeText(
                """
                {
                  "not_working_apps": ["bad.app"],
@@ -56,7 +57,7 @@ class BlockedAppRepositoryTest {
        every {
            downloadManager.downloadFileInCache(any(), any(), any(), any())
        } answers {
            File(tempDir, warningFileName).writeText("{invalid")
            File(warningListDirectory, warningFileName).writeText("{invalid")
            val callback = arg<((Boolean, String) -> Unit)?>(3)
            callback?.invoke(true, "")
            1L

blocklist/1.json

0 → 100644
+125 −0
Original line number Diff line number Diff line
{
  "not_working_apps": [],
  "zero_privacy_apps": [
    "com.facebook.katana",
    "com.facebook.lite",
    "com.facebook.orca",
    "com.google.android.gm",
    "com.google.android.youtube",
    "com.google.android.googlequicksearchbox",
    "com.google.android.apps.searchlite",
    "com.google.android.apps.docs",
    "com.google.android.apps.docs.editors.sheets",
    "com.google.android.apps.docs.editors.docs",
    "com.google.android.apps.docs.editors.slides",
    "com.google.android.calendar",
    "com.google.android.apps.tachyon",
    "com.google.android.apps.subscriptions.red",
    "com.google.android.apps.tasks",
    "com.google.android.keep",
    "com.google.android.apps.photos",
    "com.google.android.apps.maps",
    "com.google.android.apps.dynamite",
    "com.google.android.apps.magazines",
    "com.google.android.apps.messaging",
    "com.google.android.dialer",
    "com.google.android.apps.nbu.files",
    "com.google.android.apps.translate",
    "com.google.android.tts",
    "com.google.android.apps.wellbeing",
    "com.google.android.apps.walletnfcrel",
    "com.google.android.apps.googleassistant",
    "com.google.android.apps.chromecast.app",
    "com.google.android.videos",
    "com.google.android.apps.books",
    "com.google.android.play.games",
    "com.google.ar.lens",
    "com.google.android.apps.authenticator2",
    "com.microsoft.office.outlook",
    "com.azure.authenticator",
    "com.ms.office365admin",
    "com.microsoft.office.officehubrow",
    "com.microsoft.skydrive",
    "com.microsoft.sharepoint",
    "com.microsoft.teams",
    "com.microsoft.emmx",
    "com.microsoft.copilot",
    "com.microsoft.office.onenote",
    "com.touchtype.swiftkey",
    "com.microsoft.todos",
    "com.microsoft.launcher",
    "com.microsoft.bing",
    "com.microsoft.windowsintune.companyportal",
    "com.amazon.mShop.android.shopping",
    "com.paypal.android.p2pmobile",
    "com.pinterest",
    "com.spotify.music",
    "com.instagram.android",
    "com.instagram.lite",
    "com.ubercab",
    "com.zhiliaoapp.musically",
    "com.flickr.android",
    "com.twitter.android",
    "com.linkedin.android",
    "com.reddit.frontpage",
    "com.wikihow.wikihowapp",
    "com.cnn.mobile.android.phone",
    "com.walmart.wmtevents",
    "com.emn8.mobilem8.nativeapp.bkuk",
    "air.com.unit9.bkFrApp",
    "com.bk.ch",
    "re.burgerking.royaume",
    "es.burgerking.android",
    "fr.antilles.burgerking",
    "com.burgerking.uae",
    "ru.burgerking",
    "be.burgerbrandsbelgium.burgerking",
    "com.mcdonalds.app.uk",
    "com.md.mcdonalds.gomcdo",
    "com.mcdonalds.mobileapp",
    "de.mcdonalds.mcdonaldsinfoapp"
  ],
  "third_party_store_apps": [
    "com.aurora.store",
    "com.aurora.adroid",
    "org.fdroid.fdroid",
    "org.fdroid.basic",
    "org.fdroid.nearby",
    "eu.bubu1.fdroidclassic",
    "com.machiav3lli.fdroid",
    "com.looker.droidify",
    "nya.kitsunyan.foxydroid",
    "org.gdroid.gdroid",
    "app.accrescent.client",
    "com.tomclaw.appsend",
    "in.sunilpaulmathew.izzyondroid",
    "dev.imranr.obtainium",
    "dev.imranr.obtainium.fdroid",
    "app.skydroid",
    "store.zap.app",
    "cm.aptoide.pt",
    "com.taptap.global",
    "com.farsitel.bazaar",
    "ir.mservices.market",
    "com.gamefun.apk2u",
    "com.amazon.venezia",
    "com.sec.android.app.samsungapps",
    "com.qooapp.qoohelper",
    "com.uptodown",
    "com.slideme.sam.manager",
    "com.apkpure.aegon",
    "com.huawei.appmarket",
    "com.happymod.apk",
    "net.appcake",
    "demigos.com.mobilism",
    "com.mobile9.market.ggs",
    "com.appspot.swisscodemonkeys.apps",
    "subreddit.android.appstore",
    "com.vau.apphunt.studiotech",
    "taco.apkmirror",
    "com.apkmirror.helper.prod",
    "com.github.yeriomin.yalpstore",
    "com.rootpk.android",
    "app.grapheneos.apps"
  ]
}