Loading app/src/main/java/foundation/e/apps/data/application/data/Application.kt +4 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ data class Application( var perms: List<String> = emptyList(), var reportId: Long = -1L, val icon_image_path: String = String(), val icon_url: String = String(), val last_modified: String = String(), var latest_version_code: Long = -1, val latest_version_number: String = String(), Loading Loading @@ -102,6 +103,9 @@ data class Application( ) { val iconUrl: String? get() { if (icon_url.isNotBlank()) { return icon_url } if (icon_image_path.isBlank()) { return null } Loading app/src/main/java/foundation/e/apps/data/application/mapper/ApplicationDomainMapper.kt 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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.application.mapper import foundation.e.apps.data.application.data.Application import foundation.e.apps.domain.application.ApplicationDomain fun ApplicationDomain.toApplication() = Application( _id = id, author = author, category = category, description = description, perms = perms, reportId = reportId, icon_image_path = iconImagePath, icon_url = iconUrl.orEmpty(), last_modified = lastModified, latest_version_code = latestVersionCode, latest_version_number = latestVersionNumber, latest_downloaded_version = latestDownloadedVersion, licence = licence, name = name, other_images_path = otherImagesPath, package_name = packageName, offer_type = offerType, status = status, shareUrl = shareUrl, originalSize = originalSize, appSize = appSize, source = source, price = price, isFree = isFree, is_pwa = isPwa, pwaPlayerDbId = pwaPlayerDbId, url = url, type = type, privacyScore = privacyScore, isPurchased = isPurchased, updatedOn = updatedOn, numberOfPermission = numberOfPermission, numberOfTracker = numberOfTracker, filterLevel = filterLevel, isGplayReplaced = isGplayReplaced, isFDroidApp = isFDroidApp, contentRating = contentRating, restriction = restriction, antiFeatures = antiFeatures, isPlaceHolder = isPlaceHolder, ratings = ratings, isSystemApp = isSystemApp, ) app/src/main/java/foundation/e/apps/domain/application/ApplicationDomain.kt 0 → 100644 +72 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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 import com.aurora.gplayapi.Constants.Restriction import com.aurora.gplayapi.data.models.ContentRating import foundation.e.apps.data.application.data.Ratings import foundation.e.apps.data.enums.FilterLevel import foundation.e.apps.data.enums.Source import foundation.e.apps.data.enums.Status import foundation.e.apps.data.enums.Type data class ApplicationDomain( val id: String = String(), val author: String = String(), val category: String = String(), val description: String = String(), val perms: List<String> = emptyList(), val reportId: Long = -1L, val packageName: String = String(), val name: String = String(), val iconImagePath: String = String(), val iconUrl: String? = null, val otherImagesPath: List<String> = emptyList(), val lastModified: String = String(), val latestVersionCode: Long = -1, val latestVersionNumber: String = String(), val latestDownloadedVersion: String = String(), val licence: String = String(), val source: Source = Source.PLAY_STORE, val status: Status = Status.UNAVAILABLE, val ratings: Ratings = Ratings(), val offerType: Int = -1, val isFree: Boolean = true, val price: String = String(), val isPwa: Boolean = false, val url: String = String(), val pwaPlayerDbId: Long = -1L, val type: Type = Type.NATIVE, val originalSize: Long = 0, val appSize: String = String(), val shareUrl: String = String(), val privacyScore: Int = -1, val isPurchased: Boolean = false, val updatedOn: String = String(), val numberOfPermission: Int = 0, val numberOfTracker: Int = 0, val contentRating: ContentRating = ContentRating(), val restriction: Restriction = Restriction.NOT_RESTRICTED, val filterLevel: FilterLevel = FilterLevel.UNKNOWN, val isGplayReplaced: Boolean = false, val isFDroidApp: Boolean = false, val antiFeatures: List<Map<String, String>> = emptyList(), val isPlaceHolder: Boolean = false, val isSystemApp: Boolean = false, ) app/src/main/java/foundation/e/apps/domain/home/FetchHomeScreenDataUseCase.kt 0 → 100644 +99 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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.home import androidx.lifecycle.LiveData import androidx.lifecycle.map import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.application.data.Home import foundation.e.apps.domain.application.ApplicationDomain import javax.inject.Inject class FetchHomeScreenDataUseCase @Inject constructor( private val applicationRepository: ApplicationRepository, ) { suspend operator fun invoke(): LiveData<HomeScreenResult> { return applicationRepository.getHomeScreenData().map { result -> val homeSections = result.data?.map { it.toDomain() }.orEmpty() when (result) { is ResultSupreme.Success -> HomeScreenResult.Success(homeSections) is ResultSupreme.Timeout -> HomeScreenResult.Timeout(homeSections) is ResultSupreme.Error -> HomeScreenResult.Error( homeSections, result.message, result.exception ) } } } private fun Home.toDomain() = HomeSection( title, list.map { it.toDomain() }, source, id, ) private fun Application.toDomain() = ApplicationDomain( id = _id, author = author, category = category, description = description, perms = perms, reportId = reportId, iconImagePath = icon_image_path, iconUrl = iconUrl, name = name, otherImagesPath = other_images_path, lastModified = last_modified, latestVersionCode = latest_version_code, latestVersionNumber = latest_version_number, latestDownloadedVersion = latest_downloaded_version, licence = licence, packageName = package_name, source = source, price = price, isFree = isFree, isPwa = is_pwa, pwaPlayerDbId = pwaPlayerDbId, url = url, status = status, ratings = ratings, offerType = offer_type, type = type, originalSize = originalSize, appSize = appSize, shareUrl = shareUrl, privacyScore = privacyScore, isPurchased = isPurchased, updatedOn = updatedOn, numberOfPermission = numberOfPermission, numberOfTracker = numberOfTracker, restriction = restriction, isPlaceHolder = isPlaceHolder, filterLevel = filterLevel, isGplayReplaced = isGplayReplaced, contentRating = contentRating, isFDroidApp = isFDroidApp, antiFeatures = antiFeatures, isSystemApp = isSystemApp, ) } app/src/main/java/foundation/e/apps/domain/home/HomeScreenResult.kt 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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.home sealed class HomeScreenResult { abstract val data: List<HomeSection> data class Success(override val data: List<HomeSection>) : HomeScreenResult() data class Timeout(override val data: List<HomeSection>) : HomeScreenResult() data class Error( override val data: List<HomeSection>, val message: String, val exception: Exception?, ) : HomeScreenResult() fun isSuccess() = this is Success } Loading
app/src/main/java/foundation/e/apps/data/application/data/Application.kt +4 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ data class Application( var perms: List<String> = emptyList(), var reportId: Long = -1L, val icon_image_path: String = String(), val icon_url: String = String(), val last_modified: String = String(), var latest_version_code: Long = -1, val latest_version_number: String = String(), Loading Loading @@ -102,6 +103,9 @@ data class Application( ) { val iconUrl: String? get() { if (icon_url.isNotBlank()) { return icon_url } if (icon_image_path.isBlank()) { return null } Loading
app/src/main/java/foundation/e/apps/data/application/mapper/ApplicationDomainMapper.kt 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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.application.mapper import foundation.e.apps.data.application.data.Application import foundation.e.apps.domain.application.ApplicationDomain fun ApplicationDomain.toApplication() = Application( _id = id, author = author, category = category, description = description, perms = perms, reportId = reportId, icon_image_path = iconImagePath, icon_url = iconUrl.orEmpty(), last_modified = lastModified, latest_version_code = latestVersionCode, latest_version_number = latestVersionNumber, latest_downloaded_version = latestDownloadedVersion, licence = licence, name = name, other_images_path = otherImagesPath, package_name = packageName, offer_type = offerType, status = status, shareUrl = shareUrl, originalSize = originalSize, appSize = appSize, source = source, price = price, isFree = isFree, is_pwa = isPwa, pwaPlayerDbId = pwaPlayerDbId, url = url, type = type, privacyScore = privacyScore, isPurchased = isPurchased, updatedOn = updatedOn, numberOfPermission = numberOfPermission, numberOfTracker = numberOfTracker, filterLevel = filterLevel, isGplayReplaced = isGplayReplaced, isFDroidApp = isFDroidApp, contentRating = contentRating, restriction = restriction, antiFeatures = antiFeatures, isPlaceHolder = isPlaceHolder, ratings = ratings, isSystemApp = isSystemApp, )
app/src/main/java/foundation/e/apps/domain/application/ApplicationDomain.kt 0 → 100644 +72 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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 import com.aurora.gplayapi.Constants.Restriction import com.aurora.gplayapi.data.models.ContentRating import foundation.e.apps.data.application.data.Ratings import foundation.e.apps.data.enums.FilterLevel import foundation.e.apps.data.enums.Source import foundation.e.apps.data.enums.Status import foundation.e.apps.data.enums.Type data class ApplicationDomain( val id: String = String(), val author: String = String(), val category: String = String(), val description: String = String(), val perms: List<String> = emptyList(), val reportId: Long = -1L, val packageName: String = String(), val name: String = String(), val iconImagePath: String = String(), val iconUrl: String? = null, val otherImagesPath: List<String> = emptyList(), val lastModified: String = String(), val latestVersionCode: Long = -1, val latestVersionNumber: String = String(), val latestDownloadedVersion: String = String(), val licence: String = String(), val source: Source = Source.PLAY_STORE, val status: Status = Status.UNAVAILABLE, val ratings: Ratings = Ratings(), val offerType: Int = -1, val isFree: Boolean = true, val price: String = String(), val isPwa: Boolean = false, val url: String = String(), val pwaPlayerDbId: Long = -1L, val type: Type = Type.NATIVE, val originalSize: Long = 0, val appSize: String = String(), val shareUrl: String = String(), val privacyScore: Int = -1, val isPurchased: Boolean = false, val updatedOn: String = String(), val numberOfPermission: Int = 0, val numberOfTracker: Int = 0, val contentRating: ContentRating = ContentRating(), val restriction: Restriction = Restriction.NOT_RESTRICTED, val filterLevel: FilterLevel = FilterLevel.UNKNOWN, val isGplayReplaced: Boolean = false, val isFDroidApp: Boolean = false, val antiFeatures: List<Map<String, String>> = emptyList(), val isPlaceHolder: Boolean = false, val isSystemApp: Boolean = false, )
app/src/main/java/foundation/e/apps/domain/home/FetchHomeScreenDataUseCase.kt 0 → 100644 +99 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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.home import androidx.lifecycle.LiveData import androidx.lifecycle.map import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.application.data.Home import foundation.e.apps.domain.application.ApplicationDomain import javax.inject.Inject class FetchHomeScreenDataUseCase @Inject constructor( private val applicationRepository: ApplicationRepository, ) { suspend operator fun invoke(): LiveData<HomeScreenResult> { return applicationRepository.getHomeScreenData().map { result -> val homeSections = result.data?.map { it.toDomain() }.orEmpty() when (result) { is ResultSupreme.Success -> HomeScreenResult.Success(homeSections) is ResultSupreme.Timeout -> HomeScreenResult.Timeout(homeSections) is ResultSupreme.Error -> HomeScreenResult.Error( homeSections, result.message, result.exception ) } } } private fun Home.toDomain() = HomeSection( title, list.map { it.toDomain() }, source, id, ) private fun Application.toDomain() = ApplicationDomain( id = _id, author = author, category = category, description = description, perms = perms, reportId = reportId, iconImagePath = icon_image_path, iconUrl = iconUrl, name = name, otherImagesPath = other_images_path, lastModified = last_modified, latestVersionCode = latest_version_code, latestVersionNumber = latest_version_number, latestDownloadedVersion = latest_downloaded_version, licence = licence, packageName = package_name, source = source, price = price, isFree = isFree, isPwa = is_pwa, pwaPlayerDbId = pwaPlayerDbId, url = url, status = status, ratings = ratings, offerType = offer_type, type = type, originalSize = originalSize, appSize = appSize, shareUrl = shareUrl, privacyScore = privacyScore, isPurchased = isPurchased, updatedOn = updatedOn, numberOfPermission = numberOfPermission, numberOfTracker = numberOfTracker, restriction = restriction, isPlaceHolder = isPlaceHolder, filterLevel = filterLevel, isGplayReplaced = isGplayReplaced, contentRating = contentRating, isFDroidApp = isFDroidApp, antiFeatures = antiFeatures, isSystemApp = isSystemApp, ) }
app/src/main/java/foundation/e/apps/domain/home/HomeScreenResult.kt 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2026 e Foundation * * 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.home sealed class HomeScreenResult { abstract val data: List<HomeSection> data class Success(override val data: List<HomeSection>) : HomeScreenResult() data class Timeout(override val data: List<HomeSection>) : HomeScreenResult() data class Error( override val data: List<HomeSection>, val message: String, val exception: Exception?, ) : HomeScreenResult() fun isSuccess() = this is Success }