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

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

Merge branch '790-notification_udpate_end' into 'release-1.5-rc3'

ignore installation_issue to show update end notification

See merge request !228
parents 9177b5ce f85f26cd
Loading
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ class InstallAppWorker @AssistedInject constructor(
                fusedManagerRepository.installationIssue(it)
            }
        } finally {
            if (isItUpdateWork && databaseRepository.getDownloadList().isEmpty()) { // show notification for ended update
            if (isItUpdateWork && isUpdateCompleted()) { // show notification for ended update
                showNotificationOnUpdateEnded()
            }

@@ -131,6 +131,15 @@ class InstallAppWorker @AssistedInject constructor(
        }
    }

    private suspend fun isUpdateCompleted(): Boolean {
        val downloadListWithoutAnyIssue =
            databaseRepository.getDownloadList()
                .filter { !listOf(Status.INSTALLATION_ISSUE, Status.PURCHASE_NEEDED).contains(it.status) }

        return downloadListWithoutAnyIssue.isEmpty()
    }


    private fun showNotificationOnUpdateEnded() {
        val date = Date(System.currentTimeMillis())
        val dateFormat =