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

Commit 0f6e7670 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

refactor(core): add domain home and application contracts

parent 51dcb0d0
Loading
Loading
Loading
Loading
+66 −0
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.domain.application.apps

import foundation.e.apps.domain.application.model.Application
import foundation.e.apps.domain.enums.FilterLevel
import foundation.e.apps.domain.enums.ResultStatus
import foundation.e.apps.domain.enums.Source
import foundation.e.apps.domain.enums.Status

interface AppsApi {

    /*
     * Function to search cleanapk using package name.
     * Will be used to handle f-droid deeplink.
     */
    suspend fun getCleanapkAppDetails(packageName: String): Pair<Application, ResultStatus>

    suspend fun getApplicationDetails(
        packageNameList: List<String>,
        source: Source
    ): Pair<List<Application>, ResultStatus>

    suspend fun getApplicationDetails(
        id: String,
        packageName: String,
        source: Source
    ): Pair<Application, ResultStatus>

    /**
     * Get fused app installation status.
     * Applicable for both native apps and PWAs.
     *
     * Recommended to use this instead of [PkgManagerModule.getPackageStatus].
     */
    fun getFusedAppInstallationStatus(application: Application): Status

    suspend fun getAppFilterLevel(application: Application): FilterLevel

    /**
     * @return returns true if there is changes in data, otherwise false
     */
    fun isAnyFusedAppUpdated(
        newApplications: List<Application>,
        oldApplications: List<Application>
    ): Boolean

    fun isAnyAppInstallStatusChanged(currentList: List<Application>): Boolean
    fun isOpenSourceSelected(): Boolean
}
+3 −0
Original line number Diff line number Diff line
package foundation.e.apps.domain.application.exceptions

class AppNotFoundException : Exception()
+9 −0
Original line number Diff line number Diff line
package foundation.e.apps.domain.home

import foundation.e.apps.domain.ResultSupreme
import foundation.e.apps.domain.application.model.Home
import kotlinx.coroutines.flow.Flow

interface HomeRepository {
    fun getHomeScreenData(): Flow<ResultSupreme<List<Home>>>
}