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

Commit 945a4647 authored by Abhishek Aggarwal's avatar Abhishek Aggarwal
Browse files

Remove unused search and F-Droid bindings

parent 01b2b67d
Loading
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -27,8 +27,6 @@ import foundation.e.apps.data.exodus.repositories.AppPrivacyInfoRepositoryImpl
import foundation.e.apps.data.exodus.repositories.IAppPrivacyInfoRepository
import foundation.e.apps.data.exodus.repositories.PrivacyScoreRepository
import foundation.e.apps.data.exodus.repositories.PrivacyScoreRepositoryImpl
import foundation.e.apps.data.fdroid.FDroidRepository
import foundation.e.apps.data.fdroid.IFdroidRepository
import foundation.e.apps.data.install.AppManagerImpl
import foundation.e.apps.data.updates.PendingUpdatesRepositoryImpl
import foundation.e.apps.domain.updates.PendingUpdatesRepository
@@ -45,10 +43,6 @@ interface RepositoryModule {
    @Binds
    fun getAppManager(appManagerImpl: AppManagerImpl): AppManager

    @Singleton
    @Binds
    fun getFdroidRepository(fdroidRepository: FDroidRepository): IFdroidRepository

    @Singleton
    @Binds
    fun getPrivacyScoreRepository(privacyScoreRepositoryImpl: PrivacyScoreRepositoryImpl): PrivacyScoreRepository
+5 −5
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ import javax.inject.Singleton
class FDroidRepository @Inject constructor(
    private val fdroidApi: FdroidApiInterface,
    private val fdroidDao: FdroidDao,
) : IFdroidRepository {
) {

    companion object {
        const val UNKNOWN = "unknown"
@@ -32,7 +32,7 @@ class FDroidRepository @Inject constructor(
     *
     * Result may be null.
     */
    override suspend fun getFdroidInfo(packageName: String): FdroidEntity? {
    suspend fun getFdroidInfo(packageName: String): FdroidEntity? {
        return fdroidDao.getFdroidEntityFromPackageName(packageName)
            ?: getFdroidApiResponse(packageName)?.body()?.let { fdroidInfo ->
                FdroidEntity(packageName, fdroidInfo.authorName).also { fdroidEntity ->
@@ -45,7 +45,7 @@ class FDroidRepository @Inject constructor(
        return getFdroidApiResponse(packageName)?.body()?.builds ?: emptyList()
    }

    override suspend fun getAuthorName(application: Application): String {
    suspend fun getAuthorName(application: Application): String {
        val isNotFromOpenSource =
            application.source != Source.OPEN_SOURCE && application.source != Source.PWA
        if (application.author != UNKNOWN || isNotFromOpenSource) {
@@ -61,7 +61,7 @@ class FDroidRepository @Inject constructor(
        return result?.authorName ?: FdroidEntity.DEFAULT_FDROID_AUTHOR_NAME
    }

    override suspend fun isFDroidApplicationSigned(
    suspend fun isFDroidApplicationSigned(
        context: Context,
        packageName: String,
        apkFilePath: String,
@@ -73,7 +73,7 @@ class FDroidRepository @Inject constructor(
        return false
    }

    override suspend fun isFdroidApplication(packageName: String): Boolean {
    suspend fun isFdroidApplication(packageName: String): Boolean {
        return getFdroidApiResponse(packageName)?.isSuccessful == true
    }

+0 −44
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.data.fdroid

import android.content.Context
import foundation.e.apps.data.application.data.Application
import foundation.e.apps.data.fdroid.models.FdroidEntity

interface IFdroidRepository {
    /**
     * Get Fdroid entity from DB is present.
     * If not present then make an API call, store the fetched result and return the result.
     *
     * Result may be null.
     */
    suspend fun getFdroidInfo(packageName: String): FdroidEntity?

    suspend fun getAuthorName(application: Application): String

    suspend fun isFDroidApplicationSigned(
        context: Context,
        packageName: String,
        apkFilePath: String,
        signature: String
    ): Boolean

    suspend fun isFdroidApplication(packageName: String): Boolean
}