Loading app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ plugins { } def versionMajor = 2 def versionMinor = 11 def versionMinor = 12 def versionPatch = 0 def getGitHash = { -> Loading app/src/main/java/foundation/e/apps/data/application/ApplicationDataManager.kt +0 −4 Original line number Diff line number Diff line Loading @@ -111,13 +111,9 @@ class ApplicationDataManager @Inject constructor( return if (application.is_pwa) { pwaManager.getPwaStatus(application) } else { val versionName = if (application.isSystemApp) { application.latest_version_number } else "" appLoungePackageManager.getPackageStatus( application.package_name, application.latest_version_code, versionName, ) } } Loading app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +21 −8 Original line number Diff line number Diff line Loading @@ -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.enums.Status import foundation.e.apps.data.gitlab.UpdatableSystemAppsApi.* import foundation.e.apps.data.gitlab.models.OsReleaseType import foundation.e.apps.data.gitlab.models.SystemAppInfo Loading Loading @@ -189,10 +190,17 @@ class SystemAppsUpdatesRepository @Inject constructor( return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_DEVICE) ?: "" } /** * Available release types are: * - community * - official * - partner * - test * - unofficial/UNOFFICIAL */ private fun getSystemReleaseType(): OsReleaseType { return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE).let { OsReleaseType.get(it) } return OsReleaseType.get(SystemInfoProvider.getSystemProperty( SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE) ?: OsReleaseType.TEST.name) } /** Loading Loading @@ -235,15 +243,20 @@ class SystemAppsUpdatesRepository @Inject constructor( ) } result.data?.run { if (!result.isSuccess()) { Timber.e("Failed to get system app info for $it - ${result.message}") return@forEach } val app: Application = result.data ?: return@forEach val appStatus = appLoungePackageManager.getPackageStatus(it, app.latest_version_code) if (appStatus != Status.UPDATABLE) return@forEach app.run { applicationDataManager.updateStatus(this) updateList.add(this) updateSource(context) } if (!result.isSuccess()) { Timber.e("Failed to get system app info for $it - ${result.message}") } } return updateList Loading app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt +8 −12 Original line number Diff line number Diff line Loading @@ -41,19 +41,15 @@ data class ReleaseLinks( ) enum class OsReleaseType { TEST, COMMUNITY, STABLE, UNKNOWN, ; override fun toString(): String { return this.name.lowercase() } COMMUNITY, OFFICIAL, TEST; companion object { fun get(value: String?): OsReleaseType { return OsReleaseType.values().find { it.name == value?.trim()?.uppercase() } ?: UNKNOWN fun get(value: String?) = when (value?.trim()?.lowercase()) { "dev", "community" -> COMMUNITY "official", "stable", "partner" -> OFFICIAL else -> TEST } } override fun toString() = name.lowercase() } app/src/main/java/foundation/e/apps/install/pkg/AppLoungePackageManager.kt +3 −10 Original line number Diff line number Diff line Loading @@ -71,16 +71,10 @@ class AppLoungePackageManager @Inject constructor( } } private fun isUpdatable(packageName: String, versionCode: Int, versionName: String): Boolean { private fun isUpdatable(packageName: String, versionCode: Int): Boolean { val packageInfo = getPackageInfo(packageName) ?: return false val installedVersionNumber = PackageInfoCompat.getLongVersionCode(packageInfo) val installedVersionName = packageInfo.versionName val isVersionNumberHigher = versionCode.toLong() > installedVersionNumber val isVersionNameHigher = versionName.isNotBlank() && versionName > installedVersionName return isVersionNumberHigher || isVersionNameHigher return versionCode.toLong() > installedVersionNumber } fun getLaunchIntent(packageName: String): Intent? { Loading @@ -105,10 +99,9 @@ class AppLoungePackageManager @Inject constructor( fun getPackageStatus( packageName: String, versionCode: Int, versionName: String = "", ): Status { return if (isInstalled(packageName)) { if (isUpdatable(packageName, versionCode, versionName)) { if (isUpdatable(packageName, versionCode)) { Status.UPDATABLE } else { Status.INSTALLED Loading Loading
app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ plugins { } def versionMajor = 2 def versionMinor = 11 def versionMinor = 12 def versionPatch = 0 def getGitHash = { -> Loading
app/src/main/java/foundation/e/apps/data/application/ApplicationDataManager.kt +0 −4 Original line number Diff line number Diff line Loading @@ -111,13 +111,9 @@ class ApplicationDataManager @Inject constructor( return if (application.is_pwa) { pwaManager.getPwaStatus(application) } else { val versionName = if (application.isSystemApp) { application.latest_version_number } else "" appLoungePackageManager.getPackageStatus( application.package_name, application.latest_version_code, versionName, ) } } Loading
app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +21 −8 Original line number Diff line number Diff line Loading @@ -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.enums.Status import foundation.e.apps.data.gitlab.UpdatableSystemAppsApi.* import foundation.e.apps.data.gitlab.models.OsReleaseType import foundation.e.apps.data.gitlab.models.SystemAppInfo Loading Loading @@ -189,10 +190,17 @@ class SystemAppsUpdatesRepository @Inject constructor( return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_DEVICE) ?: "" } /** * Available release types are: * - community * - official * - partner * - test * - unofficial/UNOFFICIAL */ private fun getSystemReleaseType(): OsReleaseType { return SystemInfoProvider.getSystemProperty(SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE).let { OsReleaseType.get(it) } return OsReleaseType.get(SystemInfoProvider.getSystemProperty( SystemInfoProvider.KEY_LINEAGE_RELEASE_TYPE) ?: OsReleaseType.TEST.name) } /** Loading Loading @@ -235,15 +243,20 @@ class SystemAppsUpdatesRepository @Inject constructor( ) } result.data?.run { if (!result.isSuccess()) { Timber.e("Failed to get system app info for $it - ${result.message}") return@forEach } val app: Application = result.data ?: return@forEach val appStatus = appLoungePackageManager.getPackageStatus(it, app.latest_version_code) if (appStatus != Status.UPDATABLE) return@forEach app.run { applicationDataManager.updateStatus(this) updateList.add(this) updateSource(context) } if (!result.isSuccess()) { Timber.e("Failed to get system app info for $it - ${result.message}") } } return updateList Loading
app/src/main/java/foundation/e/apps/data/gitlab/models/ReleaseInfo.kt +8 −12 Original line number Diff line number Diff line Loading @@ -41,19 +41,15 @@ data class ReleaseLinks( ) enum class OsReleaseType { TEST, COMMUNITY, STABLE, UNKNOWN, ; override fun toString(): String { return this.name.lowercase() } COMMUNITY, OFFICIAL, TEST; companion object { fun get(value: String?): OsReleaseType { return OsReleaseType.values().find { it.name == value?.trim()?.uppercase() } ?: UNKNOWN fun get(value: String?) = when (value?.trim()?.lowercase()) { "dev", "community" -> COMMUNITY "official", "stable", "partner" -> OFFICIAL else -> TEST } } override fun toString() = name.lowercase() }
app/src/main/java/foundation/e/apps/install/pkg/AppLoungePackageManager.kt +3 −10 Original line number Diff line number Diff line Loading @@ -71,16 +71,10 @@ class AppLoungePackageManager @Inject constructor( } } private fun isUpdatable(packageName: String, versionCode: Int, versionName: String): Boolean { private fun isUpdatable(packageName: String, versionCode: Int): Boolean { val packageInfo = getPackageInfo(packageName) ?: return false val installedVersionNumber = PackageInfoCompat.getLongVersionCode(packageInfo) val installedVersionName = packageInfo.versionName val isVersionNumberHigher = versionCode.toLong() > installedVersionNumber val isVersionNameHigher = versionName.isNotBlank() && versionName > installedVersionName return isVersionNumberHigher || isVersionNameHigher return versionCode.toLong() > installedVersionNumber } fun getLaunchIntent(packageName: String): Intent? { Loading @@ -105,10 +99,9 @@ class AppLoungePackageManager @Inject constructor( fun getPackageStatus( packageName: String, versionCode: Int, versionName: String = "", ): Status { return if (isInstalled(packageName)) { if (isUpdatable(packageName, versionCode, versionName)) { if (isUpdatable(packageName, versionCode)) { Status.UPDATABLE } else { Status.INSTALLED Loading