Loading app/src/main/java/foundation/e/apps/manager/pkg/InstallerService.kt +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.IBinder import androidx.annotation.RequiresApi import dagger.hilt.android.AndroidEntryPoint import foundation.e.apps.api.faultyApps.FaultyAppRepository import foundation.e.apps.api.fused.UpdatesDao import foundation.e.apps.manager.fused.FusedManagerRepository import foundation.e.apps.utils.enums.Status import foundation.e.apps.utils.eventBus.AppEvent Loading Loading @@ -75,6 +76,7 @@ class InstallerService : Service() { private fun postStatus(status: Int, packageName: String?, extra: String?) { Timber.d("postStatus: $status $packageName $extra") if (status == PackageInstaller.STATUS_SUCCESS) { UpdatesDao.removeUpdateIfExists(packageName ?: "") return } Loading app/src/main/java/foundation/e/apps/manager/workmanager/InstallAppWorker.kt +6 −12 Original line number Diff line number Diff line Loading @@ -128,8 +128,7 @@ class InstallAppWorker @AssistedInject constructor( .onEach { val download = databaseRepository.getDownloadById(fusedDownload.id) if (download == null) { isDownloading = false unlockMutex() finishInstallation() } else { handleFusedDownloadStatusCheckingException(download) if (isAppDownloading(download)) { Loading @@ -151,8 +150,7 @@ class InstallAppWorker @AssistedInject constructor( handleFusedDownloadStatus(download) } catch (e: Exception) { Log.e(TAG, "observeDownload: ", e) isDownloading = false unlockMutex() finishInstallation() } } Loading Loading @@ -193,11 +191,11 @@ class InstallAppWorker @AssistedInject constructor( Timber.d("===> doWork: Installing ${fusedDownload.name} ${fusedDownload.status}") } Status.INSTALLED, Status.INSTALLATION_ISSUE -> { finishInstallation(fusedDownload, fusedDownload.status) finishInstallation() Timber.d("===> doWork: Installed/Failed: ${fusedDownload.name} ${fusedDownload.status}") } else -> { isDownloading = false unlockMutex() finishInstallation() Log.wtf( TAG, "===> ${fusedDownload.name} is in wrong state ${fusedDownload.status}" Loading @@ -206,13 +204,9 @@ class InstallAppWorker @AssistedInject constructor( } } private fun finishInstallation(fusedDownload: FusedDownload, status: Status) { if (status == Status.INSTALLED) { UpdatesDao.removeUpdateIfExists(fusedDownload.packageName) } private fun finishInstallation() { isDownloading = false unlockMutex() Timber.d("===> doWork: Installed/Failed: ${fusedDownload.name} ${fusedDownload.status}") } private fun unlockMutex() { Loading app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.aurora.gplayapi.data.models.AuthData import foundation.e.apps.api.fused.UpdatesDao import foundation.e.apps.api.fused.data.FusedApp import foundation.e.apps.utils.enums.ResultStatus import timber.log.Timber import javax.inject.Inject class UpdatesManagerRepository @Inject constructor( Loading @@ -29,6 +30,7 @@ class UpdatesManagerRepository @Inject constructor( ) { suspend fun getUpdates(authData: AuthData): Pair<List<FusedApp>, ResultStatus> { Timber.d("===> getUpdates: ${UpdatesDao.hasAnyAppsForUpdate()}") if (UpdatesDao.hasAnyAppsForUpdate()) { return Pair(UpdatesDao.appsAwaitingForUpdate, ResultStatus.OK) } Loading Loading
app/src/main/java/foundation/e/apps/manager/pkg/InstallerService.kt +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.IBinder import androidx.annotation.RequiresApi import dagger.hilt.android.AndroidEntryPoint import foundation.e.apps.api.faultyApps.FaultyAppRepository import foundation.e.apps.api.fused.UpdatesDao import foundation.e.apps.manager.fused.FusedManagerRepository import foundation.e.apps.utils.enums.Status import foundation.e.apps.utils.eventBus.AppEvent Loading Loading @@ -75,6 +76,7 @@ class InstallerService : Service() { private fun postStatus(status: Int, packageName: String?, extra: String?) { Timber.d("postStatus: $status $packageName $extra") if (status == PackageInstaller.STATUS_SUCCESS) { UpdatesDao.removeUpdateIfExists(packageName ?: "") return } Loading
app/src/main/java/foundation/e/apps/manager/workmanager/InstallAppWorker.kt +6 −12 Original line number Diff line number Diff line Loading @@ -128,8 +128,7 @@ class InstallAppWorker @AssistedInject constructor( .onEach { val download = databaseRepository.getDownloadById(fusedDownload.id) if (download == null) { isDownloading = false unlockMutex() finishInstallation() } else { handleFusedDownloadStatusCheckingException(download) if (isAppDownloading(download)) { Loading @@ -151,8 +150,7 @@ class InstallAppWorker @AssistedInject constructor( handleFusedDownloadStatus(download) } catch (e: Exception) { Log.e(TAG, "observeDownload: ", e) isDownloading = false unlockMutex() finishInstallation() } } Loading Loading @@ -193,11 +191,11 @@ class InstallAppWorker @AssistedInject constructor( Timber.d("===> doWork: Installing ${fusedDownload.name} ${fusedDownload.status}") } Status.INSTALLED, Status.INSTALLATION_ISSUE -> { finishInstallation(fusedDownload, fusedDownload.status) finishInstallation() Timber.d("===> doWork: Installed/Failed: ${fusedDownload.name} ${fusedDownload.status}") } else -> { isDownloading = false unlockMutex() finishInstallation() Log.wtf( TAG, "===> ${fusedDownload.name} is in wrong state ${fusedDownload.status}" Loading @@ -206,13 +204,9 @@ class InstallAppWorker @AssistedInject constructor( } } private fun finishInstallation(fusedDownload: FusedDownload, status: Status) { if (status == Status.INSTALLED) { UpdatesDao.removeUpdateIfExists(fusedDownload.packageName) } private fun finishInstallation() { isDownloading = false unlockMutex() Timber.d("===> doWork: Installed/Failed: ${fusedDownload.name} ${fusedDownload.status}") } private fun unlockMutex() { Loading
app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.aurora.gplayapi.data.models.AuthData import foundation.e.apps.api.fused.UpdatesDao import foundation.e.apps.api.fused.data.FusedApp import foundation.e.apps.utils.enums.ResultStatus import timber.log.Timber import javax.inject.Inject class UpdatesManagerRepository @Inject constructor( Loading @@ -29,6 +30,7 @@ class UpdatesManagerRepository @Inject constructor( ) { suspend fun getUpdates(authData: AuthData): Pair<List<FusedApp>, ResultStatus> { Timber.d("===> getUpdates: ${UpdatesDao.hasAnyAppsForUpdate()}") if (UpdatesDao.hasAnyAppsForUpdate()) { return Pair(UpdatesDao.appsAwaitingForUpdate, ResultStatus.OK) } Loading