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

Commit 454bace8 authored by Hasib Prince's avatar Hasib Prince
Browse files

App Lounge: some code clean up

parent ab56b073
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -98,9 +98,7 @@ class InstallAppWorker @AssistedInject constructor(
                    )
                )
                startAppInstallationProcess(it)
                Log.d(TAG, ">>> doWork: Locking mutex")
                mutex.lock()
                Log.d(TAG, ">>> doWork: released mutex")
            }
        } catch (e: Exception) {
            Log.e(TAG, ">>> doWork: Failed: ${e.stackTraceToString()}")
@@ -126,7 +124,7 @@ class InstallAppWorker @AssistedInject constructor(
                    unlockMutex()
                } else {
                    handleFusedDownloadStatusCheckingException(download)
                    if (download.type == Type.NATIVE && download.status != Status.INSTALLED && download.status != Status.INSTALLATION_ISSUE) {
                    if (isAppDownloading(download)) {
                        checkDownloadProcess(download)
                    }
                }
@@ -137,6 +135,10 @@ class InstallAppWorker @AssistedInject constructor(
        )
    }

    private fun isAppDownloading(download: FusedDownload): Boolean {
        return download.type == Type.NATIVE && download.status != Status.INSTALLED && download.status != Status.INSTALLATION_ISSUE
    }

    private suspend fun handleFusedDownloadStatusCheckingException(
        download: FusedDownload
    ) {
@@ -219,7 +221,6 @@ class InstallAppWorker @AssistedInject constructor(
    private fun unlockMutex() {
        if (mutex.isLocked) {
            mutex.unlock()
            Log.d(TAG, ">>> unlockMutex:")
        }
    }