Loading app/src/main/java/foundation/e/apps/MainActivityViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,7 @@ class MainActivityViewModel @Inject constructor( if (shouldShowPaidAppsSnackBar(app)) { return } viewModelScope.launch { val fusedDownload: FusedDownload try { Loading app/src/main/java/foundation/e/apps/manager/fused/FusedManagerImpl.kt +4 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ class FusedManagerImpl @Inject constructor( databaseRepository.addDownload(fusedDownload) } suspend fun getDownloadById(fusedDownload: FusedDownload): FusedDownload? { return databaseRepository.getDownloadById(fusedDownload.id) } suspend fun getDownloadList(): List<FusedDownload> { return databaseRepository.getDownloadList() } Loading app/src/main/java/foundation/e/apps/manager/fused/FusedManagerRepository.kt +12 −0 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ import foundation.e.apps.api.fdroid.FdroidRepository import foundation.e.apps.api.fused.data.FusedApp import foundation.e.apps.manager.database.fusedDownload.FusedDownload import foundation.e.apps.manager.download.data.DownloadProgress import foundation.e.apps.manager.workmanager.InstallWorkManager import foundation.e.apps.utils.enums.Status import foundation.e.apps.utils.modules.CommonUtilsFunctions import kotlinx.coroutines.flow.Flow import javax.inject.Inject import javax.inject.Singleton Loading @@ -34,6 +36,16 @@ class FusedManagerRepository @Inject constructor( } suspend fun addDownload(fusedDownload: FusedDownload) { if (CommonUtilsFunctions.checkWorkIsAlreadyAvailable(InstallWorkManager.context, fusedDownload.id)) { return } val existingFusedDownload = fusedManagerImpl.getDownloadById(fusedDownload) // We don't want to add any thing, if it already exists without INSTALLATION_ISSUE if (existingFusedDownload != null && existingFusedDownload.status != Status.INSTALLATION_ISSUE) { return } return fusedManagerImpl.addDownload(fusedDownload) } Loading app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +18 −14 Original line number Diff line number Diff line Loading @@ -200,7 +200,13 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte showLoadingUI() updatesViewModel.getUpdates(authData) binding.button.setOnClickListener { val id = UpdatesWorkManager.startUpdateAllWork(requireContext().applicationContext) UpdatesWorkManager.startUpdateAllWork(requireContext().applicationContext) observeUpdateWork() binding.button.isEnabled = false } } private fun observeUpdateWork() { WorkManager.getInstance(requireContext()) .getWorkInfosByTagLiveData(UpdatesWorkManager.UPDATES_WORK_NAME) .observe(viewLifecycleOwner) { Loading @@ -214,8 +220,6 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte binding.button.isEnabled = true } } binding.button.isEnabled = false } } private fun showLoadingUI() { Loading app/src/main/java/foundation/e/apps/updates/manager/UpdatesWorkManager.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ object UpdatesWorkManager { return PeriodicWorkRequest.Builder( UpdatesWorker::class.java, interval, TimeUnit.MINUTES TimeUnit.HOURS ).apply { setConstraints(buildWorkerConstraints()) addTag(TAG) Loading Loading
app/src/main/java/foundation/e/apps/MainActivityViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,7 @@ class MainActivityViewModel @Inject constructor( if (shouldShowPaidAppsSnackBar(app)) { return } viewModelScope.launch { val fusedDownload: FusedDownload try { Loading
app/src/main/java/foundation/e/apps/manager/fused/FusedManagerImpl.kt +4 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ class FusedManagerImpl @Inject constructor( databaseRepository.addDownload(fusedDownload) } suspend fun getDownloadById(fusedDownload: FusedDownload): FusedDownload? { return databaseRepository.getDownloadById(fusedDownload.id) } suspend fun getDownloadList(): List<FusedDownload> { return databaseRepository.getDownloadList() } Loading
app/src/main/java/foundation/e/apps/manager/fused/FusedManagerRepository.kt +12 −0 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ import foundation.e.apps.api.fdroid.FdroidRepository import foundation.e.apps.api.fused.data.FusedApp import foundation.e.apps.manager.database.fusedDownload.FusedDownload import foundation.e.apps.manager.download.data.DownloadProgress import foundation.e.apps.manager.workmanager.InstallWorkManager import foundation.e.apps.utils.enums.Status import foundation.e.apps.utils.modules.CommonUtilsFunctions import kotlinx.coroutines.flow.Flow import javax.inject.Inject import javax.inject.Singleton Loading @@ -34,6 +36,16 @@ class FusedManagerRepository @Inject constructor( } suspend fun addDownload(fusedDownload: FusedDownload) { if (CommonUtilsFunctions.checkWorkIsAlreadyAvailable(InstallWorkManager.context, fusedDownload.id)) { return } val existingFusedDownload = fusedManagerImpl.getDownloadById(fusedDownload) // We don't want to add any thing, if it already exists without INSTALLATION_ISSUE if (existingFusedDownload != null && existingFusedDownload.status != Status.INSTALLATION_ISSUE) { return } return fusedManagerImpl.addDownload(fusedDownload) } Loading
app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +18 −14 Original line number Diff line number Diff line Loading @@ -200,7 +200,13 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte showLoadingUI() updatesViewModel.getUpdates(authData) binding.button.setOnClickListener { val id = UpdatesWorkManager.startUpdateAllWork(requireContext().applicationContext) UpdatesWorkManager.startUpdateAllWork(requireContext().applicationContext) observeUpdateWork() binding.button.isEnabled = false } } private fun observeUpdateWork() { WorkManager.getInstance(requireContext()) .getWorkInfosByTagLiveData(UpdatesWorkManager.UPDATES_WORK_NAME) .observe(viewLifecycleOwner) { Loading @@ -214,8 +220,6 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte binding.button.isEnabled = true } } binding.button.isEnabled = false } } private fun showLoadingUI() { Loading
app/src/main/java/foundation/e/apps/updates/manager/UpdatesWorkManager.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ object UpdatesWorkManager { return PeriodicWorkRequest.Builder( UpdatesWorker::class.java, interval, TimeUnit.MINUTES TimeUnit.HOURS ).apply { setConstraints(buildWorkerConstraints()) addTag(TAG) Loading