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

Commit 71cfc3ea authored by Mohit Mali's avatar Mohit Mali Committed by Romain Hunault
Browse files

Some refactoring of code

parent 0415c3ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ class GitlabDataRequest {

            urlConnection.disconnect()
            callback.invoke(null, GitlabDataResult(SystemAppDataSource.createDataSource(Constants.MICROG_ID.toString(),
                    releaseList[0].tag_name, Constants.MICROG_ICON_URI)))
                    releaseList[0].tag_name, Constants.MICROG_ICON_URI, releaseList[0].assets.links[0].url)))
        } catch (e: Exception) {
            callback.invoke(Error.findError(e), null)
        }
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ class ApplicationInfo(private val packageName: String) {
                val currentVersion = packageInfo.versionName.replace(".", "").replace("-", "")
                val currentVersionFiltered = currentVersion.filter { it.isDigit() }
                val newVersion = lastVersionNumber.replace(".", "")
                Log.e("CurrentVersion", currentVersionFiltered)
                Log.e("NewVersion", newVersion)
                Log.e("IsLarge", (newVersion.toLong() > currentVersionFiltered.toLong()).toString())
                try {
                    return newVersion.toLong() > currentVersionFiltered.toLong()
                } catch (e: Exception) {
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ class Downloader(private val applicationInfo: ApplicationInfo,

        request = DownloadManager.Request(
                Uri.parse(
                        fullData.latestVersionNumber.let { Constants.downloadBaseUrl(Constants.MICROG_ID.toString(), it) } + Constants.MICROG_ARTIFACTS_PATH))
                        fullData.downloadUrl))
                .apply {
                    setTitle(fullData.name)
                    setDescription(context.getString(R.string.download_notification_description))
+4 −2
Original line number Diff line number Diff line
@@ -45,8 +45,9 @@ class StateManager(private val info: ApplicationInfo, private val app: Applicati
            } else if (PreferenceStorage(context).getBoolean(context.getString(R.string.prefs_microg_vrsn_installed), false)) {
                if (info.isLastVersionInstalled(context, basicData.lastVersionNumber ?: "")) {
                    State.NOT_UPDATED
                } else {
                    State.INSTALLED
                }
                State.INSTALLED// update
            } else {
                State.NOT_DOWNLOADED // not installed
            }
@@ -77,8 +78,9 @@ class StateManager(private val info: ApplicationInfo, private val app: Applicati
        } else if (PreferenceStorage(context).getBoolean(context.getString(R.string.prefs_microg_vrsn_installed), false)) {
            if (info.isLastVersionInstalled(context, basicData.lastVersionNumber ?: "")) {
                State.NOT_UPDATED
            } else {
                State.INSTALLED
            }
            State.INSTALLED // update
        } else {
            State.NOT_DOWNLOADED
        }
+2 −1
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ constructor(@param:JsonProperty("_id") val id: String,
            @param:JsonProperty("exodus_score") val privacyRating: Float?,
            @param:JsonProperty("ratings") val ratings: Ratings,
            @param:JsonProperty("category") val category: String,
            @param:JsonProperty("is_pwa") val is_pwa: Boolean) {
            @param:JsonProperty("is_pwa") val is_pwa: Boolean,
            var downloadUrl: String? = null) {


    private var icon: Bitmap? = null
Loading