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

Commit 83735130 authored by Hasib Prince's avatar Hasib Prince
Browse files

refactor: detekt issues

parent 3f200f16
Loading
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ typealias FusedHomeDeferred = Deferred<ResultSupreme<List<Home>>>

@Singleton
class ApplicationApiImpl @Inject constructor(
    @ApplicationContext private val context: Context,
    private val appsApi: AppsApi,
    private val preferenceManagerModule: PreferenceManagerModule,
    @Named("gplayRepository") private val gplayRepository: PlayStoreRepository,
@@ -85,6 +84,9 @@ class ApplicationApiImpl @Inject constructor(
    private val applicationDataManager: ApplicationDataManager
) : ApplicationApi {

    @Inject
    @ApplicationContext lateinit var context: Context

    companion object {
        private const val KEYWORD_TEST_SEARCH = "facebook"
    }
@@ -379,20 +381,6 @@ class ApplicationApiImpl @Inject constructor(
    override suspend fun getOSSDownloadInfo(id: String, version: String?) =
        (cleanApkAppsRepository as CleanApkDownloadInfoFetcher).getDownloadInfo(id, version)

    /*
     * Similar to above method but uses Aurora OSS data class "App".
     */
    private suspend fun getAppFilterLevel(app: App, authData: AuthData): FilterLevel {
        return applicationDataManager.getAppFilterLevel(app.toApplication(context), authData)
    }

    /*
     * Handy method to run on an instance of FusedApp to update its filter level.
     */
    suspend fun Application.updateFilterLevel(authData: AuthData?) {
        this.filterLevel = applicationDataManager.getAppFilterLevel(this, authData)
    }

    /*
     * Search-related internal functions
     */
+1 −2
Original line number Diff line number Diff line
@@ -50,5 +50,4 @@ interface AppsApi {

    fun isAnyAppInstallStatusChanged(currentList: List<Application>): Boolean
    fun isOpenSourceSelected(): Boolean

}
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ class AppsApiImpl @Inject constructor(

            if (result?.hasSingleResult() == true) {
                application =
                    (cleanApkAppsRepository.getAppDetails(result.apps[0]._id) as Response<CleanApkApplication>).body()?.app
                        ?: Application()
                    (cleanApkAppsRepository.getAppDetails(result.apps[0]._id) as Response<CleanApkApplication>)
                        .body()?.app ?: Application()
            }

            application.updateFilterLevel(null)