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

Commit 2a0da393 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

refactor: add nullity check and apply android studio on SystemAppsUpdatesRepository

parent d11e6c6d
Loading
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -152,11 +152,19 @@ class SystemAppsUpdatesRepository @Inject constructor(
    }

    private suspend fun getLatestReleaseByAndroidVersion(projectId: Int): GitlabReleaseInfo? {
        val gitlabReleaseList = gitlabReleaseApi.getSystemAppReleases(projectId).body()
        val response = gitlabReleaseApi.getSystemAppReleases(projectId)
        if (!response.isSuccessful) {
            Timber.e("Failed to fetch releases for project $projectId: ${
                response.errorBody()?.string()
            }")
            return null
        }

        val gitlabReleaseList = response.body()

        return gitlabReleaseList?.filter {
            it.tagName.contains("api$androidVersionCode-")
        }?.sortedByDescending { it.releasedAt }?.firstOrNull()
        }?.maxByOrNull { it.releasedAt }
    }

    private fun getAndroidVersionCodeChar(): String {