Loading domain/src/main/java/foundation/e/apps/domain/application/model/AppRestriction.kt 0 → 100644 +6 −0 Original line number Diff line number Diff line package foundation.e.apps.domain.application.model enum class AppRestriction { NOT_RESTRICTED, RESTRICTED, } domain/src/main/java/foundation/e/apps/domain/application/model/Application.kt 0 → 100644 +135 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021-2024 MURENA SAS * * 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.model import foundation.e.apps.domain.cleanapk.CleanApkConstants import foundation.e.apps.domain.enums.FilterLevel import foundation.e.apps.domain.enums.Source import foundation.e.apps.domain.enums.Status import foundation.e.apps.domain.enums.Type import foundation.e.apps.domain.enums.Type.NATIVE import foundation.e.apps.domain.enums.Type.PWA data class Application( val _id: String = String(), val author: String = String(), val category: String = String(), val description: String = String(), 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(), val latest_downloaded_version: String = String(), val licence: String = String(), val name: String = String(), val other_images_path: List<String> = emptyList(), val package_name: String = String(), val ratings: Ratings = Ratings(), val offer_type: Int = -1, var status: Status = Status.UNAVAILABLE, val shareUrl: String = String(), val originalSize: Long = 0, var appSize: String = String(), var source: Source = Source.PLAY_STORE, val price: String = String(), val isFree: Boolean = true, val is_pwa: Boolean = false, var pwaPlayerDbId: Long = -1, val url: String = String(), var type: Type = NATIVE, var privacyScore: Int = -1, var isPurchased: Boolean = false, var updatedOn: String = String(), /* * Number of permissions and trackers from Exodus Api used for privacy score calculation. */ var numberOfPermission: Int = 0, var numberOfTracker: Int = 0, /* * Store restriction from App. * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5131 [2] */ var restriction: AppRestriction = AppRestriction.NOT_RESTRICTED, /* * Show a blank app at the end during loading. * Used when loading apps of a category. * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5131 [2] */ var isPlaceHolder: Boolean = false, /* * Store the filter/restriction level. * If it is not NONE, then the app cannot be downloaded. * If it is FilterLevel.UI, then we should show "N/A" on install button. * If it is FilterLevel.DATA, then this app should not be displayed. * * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5720 */ var filterLevel: FilterLevel = FilterLevel.UNKNOWN, var isGplayReplaced: Boolean = false, val isFDroidApp: Boolean = false, var contentRating: ContentRating = ContentRating(), val antiFeatures: List<Map<String, String>> = emptyList(), var isSystemApp: Boolean = false, ) { val iconUrl: String? get() { if (icon_url.isNotBlank()) { return icon_url } if (icon_image_path.isBlank()) { return null } return when (source) { Source.OPEN_SOURCE, Source.PWA -> { if (icon_image_path.startsWith("http")) { icon_image_path } else { CleanApkConstants.ASSET_URL + icon_image_path } } Source.SYSTEM_APP, Source.PLAY_STORE -> icon_image_path } } fun updateType() { this.type = if (this.is_pwa) PWA else NATIVE } fun hasExodusPrivacyRating(): Boolean { return this.reportId.toInt() != -1 } } val Application.shareUri: String get() = when (type) { PWA -> url NATIVE -> when { isFDroidApp -> buildFDroidUri(package_name) else -> shareUrl } } private fun buildFDroidUri(packageName: String) = "https://f-droid.org/packages/$packageName" domain/src/main/java/foundation/e/apps/domain/application/model/Category.kt 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2021 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.model import foundation.e.apps.domain.enums.AppTag import java.util.UUID data class Category( val id: String = UUID.randomUUID().toString(), val title: String = String(), val browseUrl: String = String(), val imageUrl: String = String(), var drawable: Int = -1, /* * Change tag to standard AppTag class. * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5364 */ var tag: AppTag = AppTag.GPlay() ) domain/src/main/java/foundation/e/apps/domain/application/model/ContentRating.kt 0 → 100644 +8 −0 Original line number Diff line number Diff line package foundation.e.apps.domain.application.model data class ContentRating( val id: String = String(), val title: String = String(), val description: String = String(), val artworkUrl: String = String(), ) domain/src/main/java/foundation/e/apps/domain/application/model/Home.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2021 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.model import java.util.UUID data class Home( val title: String = String(), val list: List<Application> = emptyList(), var source: String = String(), var id: String = UUID.randomUUID().toString() ) Loading
domain/src/main/java/foundation/e/apps/domain/application/model/AppRestriction.kt 0 → 100644 +6 −0 Original line number Diff line number Diff line package foundation.e.apps.domain.application.model enum class AppRestriction { NOT_RESTRICTED, RESTRICTED, }
domain/src/main/java/foundation/e/apps/domain/application/model/Application.kt 0 → 100644 +135 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021-2024 MURENA SAS * * 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.model import foundation.e.apps.domain.cleanapk.CleanApkConstants import foundation.e.apps.domain.enums.FilterLevel import foundation.e.apps.domain.enums.Source import foundation.e.apps.domain.enums.Status import foundation.e.apps.domain.enums.Type import foundation.e.apps.domain.enums.Type.NATIVE import foundation.e.apps.domain.enums.Type.PWA data class Application( val _id: String = String(), val author: String = String(), val category: String = String(), val description: String = String(), 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(), val latest_downloaded_version: String = String(), val licence: String = String(), val name: String = String(), val other_images_path: List<String> = emptyList(), val package_name: String = String(), val ratings: Ratings = Ratings(), val offer_type: Int = -1, var status: Status = Status.UNAVAILABLE, val shareUrl: String = String(), val originalSize: Long = 0, var appSize: String = String(), var source: Source = Source.PLAY_STORE, val price: String = String(), val isFree: Boolean = true, val is_pwa: Boolean = false, var pwaPlayerDbId: Long = -1, val url: String = String(), var type: Type = NATIVE, var privacyScore: Int = -1, var isPurchased: Boolean = false, var updatedOn: String = String(), /* * Number of permissions and trackers from Exodus Api used for privacy score calculation. */ var numberOfPermission: Int = 0, var numberOfTracker: Int = 0, /* * Store restriction from App. * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5131 [2] */ var restriction: AppRestriction = AppRestriction.NOT_RESTRICTED, /* * Show a blank app at the end during loading. * Used when loading apps of a category. * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5131 [2] */ var isPlaceHolder: Boolean = false, /* * Store the filter/restriction level. * If it is not NONE, then the app cannot be downloaded. * If it is FilterLevel.UI, then we should show "N/A" on install button. * If it is FilterLevel.DATA, then this app should not be displayed. * * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5720 */ var filterLevel: FilterLevel = FilterLevel.UNKNOWN, var isGplayReplaced: Boolean = false, val isFDroidApp: Boolean = false, var contentRating: ContentRating = ContentRating(), val antiFeatures: List<Map<String, String>> = emptyList(), var isSystemApp: Boolean = false, ) { val iconUrl: String? get() { if (icon_url.isNotBlank()) { return icon_url } if (icon_image_path.isBlank()) { return null } return when (source) { Source.OPEN_SOURCE, Source.PWA -> { if (icon_image_path.startsWith("http")) { icon_image_path } else { CleanApkConstants.ASSET_URL + icon_image_path } } Source.SYSTEM_APP, Source.PLAY_STORE -> icon_image_path } } fun updateType() { this.type = if (this.is_pwa) PWA else NATIVE } fun hasExodusPrivacyRating(): Boolean { return this.reportId.toInt() != -1 } } val Application.shareUri: String get() = when (type) { PWA -> url NATIVE -> when { isFDroidApp -> buildFDroidUri(package_name) else -> shareUrl } } private fun buildFDroidUri(packageName: String) = "https://f-droid.org/packages/$packageName"
domain/src/main/java/foundation/e/apps/domain/application/model/Category.kt 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2021 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.model import foundation.e.apps.domain.enums.AppTag import java.util.UUID data class Category( val id: String = UUID.randomUUID().toString(), val title: String = String(), val browseUrl: String = String(), val imageUrl: String = String(), var drawable: Int = -1, /* * Change tag to standard AppTag class. * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5364 */ var tag: AppTag = AppTag.GPlay() )
domain/src/main/java/foundation/e/apps/domain/application/model/ContentRating.kt 0 → 100644 +8 −0 Original line number Diff line number Diff line package foundation.e.apps.domain.application.model data class ContentRating( val id: String = String(), val title: String = String(), val description: String = String(), val artworkUrl: String = String(), )
domain/src/main/java/foundation/e/apps/domain/application/model/Home.kt 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2021 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.model import java.util.UUID data class Home( val title: String = String(), val list: List<Application> = emptyList(), var source: String = String(), var id: String = UUID.randomUUID().toString() )