From 65ed088ce03fed19a26a855068caf94d0e40aa3f Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 13:24:33 +0530 Subject: [PATCH 01/11] feat: ReleaseInfoApi --- .../e/apps/data/gitlab/ReleaseInfoApi.kt | 37 +++++++++++++++++ .../e/apps/data/gitlab/models/ReleaseInfo.kt | 41 +++++++++++++++++++ .../e/apps/di/network/RetrofitApiModule.kt | 15 +++++++ 3 files changed, 93 insertions(+) create mode 100644 app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt create mode 100644 app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt new file mode 100644 index 000000000..1a73e941c --- /dev/null +++ b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt @@ -0,0 +1,37 @@ +/* + * 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 . + */ + +package foundation.e.apps.data.gitlab + +import foundation.e.apps.data.gitlab.models.ReleaseInfo +import retrofit2.Response +import retrofit2.http.GET +import retrofit2.http.Path + +interface ReleaseInfoApi { + + companion object { + const val BASE_URL = + "https://gitlab.e.foundation/api/v4/projects/" + } + + @GET("{projectId}/releases") + suspend fun getReleases( + @Path("projectId") projectId: Int, + ): Response> + +} \ No newline at end of file diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt new file mode 100644 index 000000000..f4636cb5f --- /dev/null +++ b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt @@ -0,0 +1,41 @@ +/* + * 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 . + */ + +package foundation.e.apps.data.gitlab.models + +import com.squareup.moshi.Json + +data class ReleaseInfo( + val name: String, + @Json(name = "released_at") + val releasedAt: String, + val assets: ReleaseAssets, +) { + fun getAssetWebLink(assetName: String): String? { + return assets.links.find { it.name == assetName }?.directAssetUrl + } +} + +data class ReleaseAssets( + val links: List, +) + +data class ReleaseLinks( + val name: String, + @Json(name = "direct_asset_url") + val directAssetUrl: String +) diff --git a/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt b/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt index 56914f616..136add811 100644 --- a/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt +++ b/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt @@ -29,6 +29,7 @@ import foundation.e.apps.data.cleanapk.CleanApkRetrofit import foundation.e.apps.data.ecloud.EcloudApiInterface import foundation.e.apps.data.exodus.ExodusTrackerApi import foundation.e.apps.data.fdroid.FdroidApiInterface +import foundation.e.apps.data.gitlab.ReleaseInfoApi import foundation.e.apps.data.gitlab.UpdatableSystemAppsApi import foundation.e.apps.data.gitlab.SystemAppDefinitionApi import foundation.e.apps.data.parentalcontrol.fdroid.FDroidMonitorApi @@ -147,6 +148,20 @@ class RetrofitApiModule { .create(UpdatableSystemAppsApi::class.java) } + @Singleton + @Provides + fun provideReleaseInfoApi( + okHttpClient: OkHttpClient, + moshi: Moshi, + ): ReleaseInfoApi { + return Retrofit.Builder() + .baseUrl(ReleaseInfoApi.BASE_URL) + .client(okHttpClient) + .addConverterFactory(MoshiConverterFactory.create(moshi)) + .build() + .create(ReleaseInfoApi::class.java) + } + @Singleton @Provides fun provideSystemAppDefinitionApi( -- GitLab From 63f52a040992be6f93efee315f0d6b4306ad033c Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 13:26:23 +0530 Subject: [PATCH 02/11] refactor: modify SystemAppDefinitionApi and use ReleaseApiInfo --- .../data/gitlab/SystemAppDefinitionApi.kt | 9 +++--- .../gitlab/SystemAppsUpdatesRepository.kt | 30 ++++++++++++++++++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt index b5f7d48b4..fd9cbf1cb 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt @@ -20,19 +20,18 @@ package foundation.e.apps.data.gitlab import foundation.e.apps.data.gitlab.models.SystemAppInfo import retrofit2.Response import retrofit2.http.GET -import retrofit2.http.Path +import retrofit2.http.Url interface SystemAppDefinitionApi { companion object { const val BASE_URL = - "https://gitlab.e.foundation/api/v4/projects/" + "https://gitlab.e.foundation/" } - @GET("{projectId}/releases/permalink/latest/downloads/json/{releaseType}.json") + @GET suspend fun getSystemAppUpdateInfo( - @Path("projectId") projectId: Int, - @Path("releaseType") releaseType: String, + @Url jsonUrl: String, ): Response } diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index 53a642dec..ce0632c4a 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -39,6 +39,7 @@ class SystemAppsUpdatesRepository @Inject constructor( private val systemAppDefinitionApi: SystemAppDefinitionApi, private val applicationDataManager: ApplicationDataManager, private val appLoungePackageManager: AppLoungePackageManager, + private val releaseInfoApi: ReleaseInfoApi, ) { private val systemAppProjectList = mutableListOf() @@ -93,6 +94,31 @@ class SystemAppsUpdatesRepository @Inject constructor( } } + private suspend fun getJsonLink( + projectId: Int, + releaseType: String, + ): String? { + val releaseResponse = releaseInfoApi.getReleases(projectId) + val releases = releaseResponse.body() + + if (!releaseResponse.isSuccessful || releases == null) { + Timber.e("Failed to fetch releases for project id - $projectId") + return null + } + + val sortedReleases = releases.sortedByDescending { + it.releasedAt + } + + for (release in sortedReleases) { + release.getAssetWebLink("${releaseType}.json")?.run { + return this.substringAfter(SystemAppDefinitionApi.BASE_URL) + } + } + + return null + } + private suspend fun getSystemAppUpdateInfo( packageName: String, releaseType: String, @@ -103,7 +129,9 @@ class SystemAppsUpdatesRepository @Inject constructor( val projectId = systemAppProjectList.find { it.packageName == packageName }?.projectId ?: return null - val response = systemAppDefinitionApi.getSystemAppUpdateInfo(projectId, releaseType) + val jsonLink = getJsonLink(projectId, releaseType) ?: return null + + val response = systemAppDefinitionApi.getSystemAppUpdateInfo(jsonLink) val systemAppInfo = response.body() return if (systemAppInfo == null) { -- GitLab From 93aef846fdc296a497053be6605f7496c0df3f0a Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 13:40:15 +0530 Subject: [PATCH 03/11] refactor: add blank line --- .../main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt index 1a73e941c..150f16d7d 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt @@ -34,4 +34,4 @@ interface ReleaseInfoApi { @Path("projectId") projectId: Int, ): Response> -} \ No newline at end of file +} -- GitLab From 24ca6dc8c7484eeb2888ff54bcec9bf61de676fb Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 15:12:11 +0530 Subject: [PATCH 04/11] refactor: use removePrefix --- .../e/apps/data/gitlab/SystemAppsUpdatesRepository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index ce0632c4a..7cae44efa 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -112,7 +112,7 @@ class SystemAppsUpdatesRepository @Inject constructor( for (release in sortedReleases) { release.getAssetWebLink("${releaseType}.json")?.run { - return this.substringAfter(SystemAppDefinitionApi.BASE_URL) + return this.removePrefix(SystemAppDefinitionApi.BASE_URL) } } -- GitLab From 31e965b85ab87ad858d6d47c736ea3f1890a9dc4 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 16:50:24 +0530 Subject: [PATCH 05/11] refactor: use EOSReleaseType enum --- .../data/gitlab/SystemAppsUpdatesRepository.kt | 11 +++++++---- .../e/apps/data/gitlab/models/ReleaseInfo.kt | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index 7cae44efa..9b37a950a 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -22,6 +22,7 @@ import android.os.Build import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.data.application.ApplicationDataManager import foundation.e.apps.data.application.data.Application +import foundation.e.apps.data.gitlab.models.EOSReleaseType import foundation.e.apps.data.gitlab.models.SystemAppInfo import foundation.e.apps.data.gitlab.models.SystemAppProject import foundation.e.apps.data.gitlab.models.toApplication @@ -96,7 +97,7 @@ class SystemAppsUpdatesRepository @Inject constructor( private suspend fun getJsonLink( projectId: Int, - releaseType: String, + releaseType: EOSReleaseType, ): String? { val releaseResponse = releaseInfoApi.getReleases(projectId) val releases = releaseResponse.body() @@ -121,7 +122,7 @@ class SystemAppsUpdatesRepository @Inject constructor( private suspend fun getSystemAppUpdateInfo( packageName: String, - releaseType: String, + releaseType: EOSReleaseType, sdkLevel: Int, device: String, ): Application? { @@ -157,8 +158,10 @@ class SystemAppsUpdatesRepository @Inject constructor( return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_DEVICE) ?: "" } - private fun getSystemReleaseType(): String { - return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE) ?: "" + private fun getSystemReleaseType(): EOSReleaseType { + return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE).let { + EOSReleaseType.get(it) + } } suspend fun getSystemUpdates(): List { diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt index f4636cb5f..c507cd371 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt @@ -39,3 +39,21 @@ data class ReleaseLinks( @Json(name = "direct_asset_url") val directAssetUrl: String ) + +enum class EOSReleaseType { + TEST, + COMMUNITY, + STABLE, + UNKNOWN, + ; + + override fun toString(): String { + return this.name.lowercase() + } + + companion object { + fun get(value: String?): EOSReleaseType { + return EOSReleaseType.values().find { it.name == value?.uppercase() } ?: UNKNOWN + } + } +} \ No newline at end of file -- GitLab From 6d29d4e81f313411723e42c470faf00d84ede7cd Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 16:54:20 +0530 Subject: [PATCH 06/11] refactor: name change --- .../java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt | 2 +- .../foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt | 2 +- .../e/apps/data/gitlab/SystemAppsUpdatesRepository.kt | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt index 150f16d7d..bd696613e 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt @@ -26,7 +26,7 @@ interface ReleaseInfoApi { companion object { const val BASE_URL = - "https://gitlab.e.foundation/api/v4/projects/" + "${SystemAppDefinitionApi.BASE_URL}api/v4/projects/" } @GET("{projectId}/releases") diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt index fd9cbf1cb..3800d295b 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppDefinitionApi.kt @@ -31,7 +31,7 @@ interface SystemAppDefinitionApi { @GET suspend fun getSystemAppUpdateInfo( - @Url jsonUrl: String, + @Url detailsUrl: String, ): Response } diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index 9b37a950a..8bee6a4b5 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -95,7 +95,7 @@ class SystemAppsUpdatesRepository @Inject constructor( } } - private suspend fun getJsonLink( + private suspend fun getDetailsUrl( projectId: Int, releaseType: EOSReleaseType, ): String? { @@ -130,9 +130,9 @@ class SystemAppsUpdatesRepository @Inject constructor( val projectId = systemAppProjectList.find { it.packageName == packageName }?.projectId ?: return null - val jsonLink = getJsonLink(projectId, releaseType) ?: return null + val detailsUrl = getDetailsUrl(projectId, releaseType) ?: return null - val response = systemAppDefinitionApi.getSystemAppUpdateInfo(jsonLink) + val response = systemAppDefinitionApi.getSystemAppUpdateInfo(detailsUrl) val systemAppInfo = response.body() return if (systemAppInfo == null) { -- GitLab From 925c555d25436bd7c87ed1565df445c3d10520ab Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 17:45:48 +0530 Subject: [PATCH 07/11] refactor: rename method --- .../e/apps/data/gitlab/SystemAppsUpdatesRepository.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index 8bee6a4b5..224e83813 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -95,7 +95,7 @@ class SystemAppsUpdatesRepository @Inject constructor( } } - private suspend fun getDetailsUrl( + private suspend fun getReleaseDetailsUrl( projectId: Int, releaseType: EOSReleaseType, ): String? { @@ -130,7 +130,7 @@ class SystemAppsUpdatesRepository @Inject constructor( val projectId = systemAppProjectList.find { it.packageName == packageName }?.projectId ?: return null - val detailsUrl = getDetailsUrl(projectId, releaseType) ?: return null + val detailsUrl = getReleaseDetailsUrl(projectId, releaseType) ?: return null val response = systemAppDefinitionApi.getSystemAppUpdateInfo(detailsUrl) val systemAppInfo = response.body() -- GitLab From 833146034c749557abb5c71a290922bcf91831da Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 17:49:56 +0530 Subject: [PATCH 08/11] refactor: use trim --- .../java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt index c507cd371..9da709350 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt @@ -53,7 +53,7 @@ enum class EOSReleaseType { companion object { fun get(value: String?): EOSReleaseType { - return EOSReleaseType.values().find { it.name == value?.uppercase() } ?: UNKNOWN + return EOSReleaseType.values().find { it.name == value?.trim()?.uppercase() } ?: UNKNOWN } } } \ No newline at end of file -- GitLab From 4279a8bdc94b9de2c1da56efdd1c55b08812267c Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 17:52:51 +0530 Subject: [PATCH 09/11] refactor: use firstOrNull instead of find --- .../java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt index 9da709350..122c3bc0e 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt @@ -26,7 +26,7 @@ data class ReleaseInfo( val assets: ReleaseAssets, ) { fun getAssetWebLink(assetName: String): String? { - return assets.links.find { it.name == assetName }?.directAssetUrl + return assets.links.firstOrNull { it.name == assetName }?.directAssetUrl } } -- GitLab From d30746460fb6710468d0c54b2c715d0e1391c207 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 18:46:45 +0530 Subject: [PATCH 10/11] refactor: add extra slash --- .../main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt index bd696613e..4b2a3fbf7 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/ReleaseInfoApi.kt @@ -26,7 +26,7 @@ interface ReleaseInfoApi { companion object { const val BASE_URL = - "${SystemAppDefinitionApi.BASE_URL}api/v4/projects/" + "${SystemAppDefinitionApi.BASE_URL}/api/v4/projects/" } @GET("{projectId}/releases") -- GitLab From dbf8561c899d9c77de1f06e044eec1e612ff3b73 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 22 Oct 2024 21:21:18 +0530 Subject: [PATCH 11/11] refactor: rename class --- .../e/apps/data/gitlab/SystemAppsUpdatesRepository.kt | 10 +++++----- .../e/apps/data/gitlab/models/ReleaseInfo.kt | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index 224e83813..c928cface 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -22,7 +22,7 @@ import android.os.Build import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.data.application.ApplicationDataManager import foundation.e.apps.data.application.data.Application -import foundation.e.apps.data.gitlab.models.EOSReleaseType +import foundation.e.apps.data.gitlab.models.OsReleaseType import foundation.e.apps.data.gitlab.models.SystemAppInfo import foundation.e.apps.data.gitlab.models.SystemAppProject import foundation.e.apps.data.gitlab.models.toApplication @@ -97,7 +97,7 @@ class SystemAppsUpdatesRepository @Inject constructor( private suspend fun getReleaseDetailsUrl( projectId: Int, - releaseType: EOSReleaseType, + releaseType: OsReleaseType, ): String? { val releaseResponse = releaseInfoApi.getReleases(projectId) val releases = releaseResponse.body() @@ -122,7 +122,7 @@ class SystemAppsUpdatesRepository @Inject constructor( private suspend fun getSystemAppUpdateInfo( packageName: String, - releaseType: EOSReleaseType, + releaseType: OsReleaseType, sdkLevel: Int, device: String, ): Application? { @@ -158,9 +158,9 @@ class SystemAppsUpdatesRepository @Inject constructor( return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_DEVICE) ?: "" } - private fun getSystemReleaseType(): EOSReleaseType { + private fun getSystemReleaseType(): OsReleaseType { return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE).let { - EOSReleaseType.get(it) + OsReleaseType.get(it) } } diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt index 122c3bc0e..6284fe92a 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt @@ -40,7 +40,7 @@ data class ReleaseLinks( val directAssetUrl: String ) -enum class EOSReleaseType { +enum class OsReleaseType { TEST, COMMUNITY, STABLE, @@ -52,8 +52,8 @@ enum class EOSReleaseType { } companion object { - fun get(value: String?): EOSReleaseType { - return EOSReleaseType.values().find { it.name == value?.trim()?.uppercase() } ?: UNKNOWN + fun get(value: String?): OsReleaseType { + return OsReleaseType.values().find { it.name == value?.trim()?.uppercase() } ?: UNKNOWN } } } \ No newline at end of file -- GitLab