From ec1c979a7db4a56e8440491295418715e8e91f3c Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Tue, 14 Apr 2026 12:51:25 +0530 Subject: [PATCH] refactor: move warning list to this repo and also add versioning --- .../foundation/e/apps/data/DownloadManager.kt | 2 +- .../data/blockedApps/BlockedAppRepository.kt | 12 +- .../blockedApps/BlockedAppRepositoryTest.kt | 7 +- blocklist/1.json | 125 ++++++++++++++++++ 4 files changed, 136 insertions(+), 10 deletions(-) create mode 100644 blocklist/1.json diff --git a/app/src/main/java/foundation/e/apps/data/DownloadManager.kt b/app/src/main/java/foundation/e/apps/data/DownloadManager.kt index 994c4265c..28142e7dd 100644 --- a/app/src/main/java/foundation/e/apps/data/DownloadManager.kt +++ b/app/src/main/java/foundation/e/apps/data/DownloadManager.kt @@ -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) } diff --git a/app/src/main/java/foundation/e/apps/data/blockedApps/BlockedAppRepository.kt b/app/src/main/java/foundation/e/apps/data/blockedApps/BlockedAppRepository.kt index 484e38b97..8a100a244 100644 --- a/app/src/main/java/foundation/e/apps/data/blockedApps/BlockedAppRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/blockedApps/BlockedAppRepository.kt @@ -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") diff --git a/app/src/test/java/foundation/e/apps/data/blockedApps/BlockedAppRepositoryTest.kt b/app/src/test/java/foundation/e/apps/data/blockedApps/BlockedAppRepositoryTest.kt index 985237808..e9a510a77 100644 --- a/app/src/test/java/foundation/e/apps/data/blockedApps/BlockedAppRepositoryTest.kt +++ b/app/src/test/java/foundation/e/apps/data/blockedApps/BlockedAppRepositoryTest.kt @@ -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 diff --git a/blocklist/1.json b/blocklist/1.json new file mode 100644 index 000000000..b5a8db777 --- /dev/null +++ b/blocklist/1.json @@ -0,0 +1,125 @@ +{ + "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" + ] +} -- GitLab