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

Commit fba5f984 authored by Hasib Prince's avatar Hasib Prince
Browse files

documentation is added

parent cd029e4f
Loading
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -173,6 +173,12 @@ class DownloadManager @Inject constructor(
        }
    }

    /**
     * Checks download is successful or not.
     * @param downloadId is the id of a particular download request
     * @return Pair<Boolean, Int>, Where first represents success/failure,
     * second represents status.
     */
    fun isDownloadSuccessful(downloadId: Long): Pair<Boolean, Int> {
        val downloadStatus = getDownloadStatus(downloadId)
        val isSuccessFul = downloadStatus == DownloadManager.STATUS_SUCCESSFUL
@@ -180,8 +186,7 @@ class DownloadManager @Inject constructor(
    }

    fun hasDownloadFailed(downloadId: Long): Boolean {
        val downloadStatus = getDownloadStatus(downloadId)
        return downloadStatus == DownloadManager.STATUS_FAILED
        return getDownloadStatus(downloadId) == DownloadManager.STATUS_FAILED
    }

    fun getSizeRequired(downloadId: Long): Long {
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ class DownloadManagerUtils @Inject constructor(
        downloadId: Long
    ): Boolean {
        val isDownloadSuccessful = downloadManager.isDownloadSuccessful(downloadId)
        // if download status code is unknown (-1), consider installation is failed.
        if (isDownloadSuccessful.second == -1) {
            handleDownloadFailed(fusedDownload, downloadId)
        }