Loading app/src/main/java/foundation/e/apps/api/gplay/GPlayAPIImpl.kt +0 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import foundation.e.apps.api.gplay.utils.GPlayHttpClient import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.supervisorScope import kotlinx.coroutines.withContext import timber.log.Timber import javax.inject.Inject class GPlayAPIImpl @Inject constructor(private val gPlayHttpClient: GPlayHttpClient) { Loading app/src/main/java/foundation/e/apps/manager/workmanager/InstallAppWorker.kt +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import androidx.work.WorkerParameters import dagger.assisted.Assisted import dagger.assisted.AssistedInject import foundation.e.apps.R import foundation.e.apps.api.fused.UpdatesDao import foundation.e.apps.manager.database.DatabaseRepository import foundation.e.apps.manager.database.fusedDownload.FusedDownload import foundation.e.apps.manager.fused.FusedManagerRepository Loading app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +36 −25 Original line number Diff line number Diff line Loading @@ -176,6 +176,12 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte viewLifecycleOwner.lifecycleScope.launch { EventBus.events.flowWithLifecycle(viewLifecycleOwner.lifecycle) .filter { appEvent -> appEvent is AppEvent.UpdateEvent }.collectLatest { handleUpdateEvent(it) } } } private fun handleUpdateEvent(it: AppEvent) { val event = it.data as ResultSupreme.WorkError<*> when (event.data) { ResultStatus.USER_NOT_AVAILABLE -> { Loading @@ -185,6 +191,17 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte requireContext().toast(getString(R.string.message_retry)) } else -> { handleUnknownErrorEvent(event) } } } private fun handleUnknownErrorEvent(event: ResultSupreme.WorkError<*>) { if (event.otherPayload == null) { requireContext().toast(getString(R.string.message_update_failed)) return } if (event.otherPayload is FusedDownload) { requireContext().toast( getString( Loading @@ -192,12 +209,6 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte (event.otherPayload as FusedDownload).name ) ) } else { requireContext().toast(getString(R.string.message_update_failed)) } } } } } } Loading app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt +0 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ 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 @@ -30,7 +29,6 @@ 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 app/src/main/java/foundation/e/apps/updates/manager/UpdatesWorker.kt +13 −9 Original line number Diff line number Diff line Loading @@ -47,9 +47,10 @@ class UpdatesWorker @AssistedInject constructor( private val dataStoreModule: DataStoreModule, private val gson: Gson, ) : CoroutineWorker(context, params) { companion object { const val IS_AUTO_UPDATE = "IS_AUTO_UPDATE" private const val MAX_RETRY_COUNT = 10 private const val DELAY_FOR_RETRY = 3000L } val TAG = UpdatesWorker::class.simpleName Loading Loading @@ -84,22 +85,24 @@ class UpdatesWorker @AssistedInject constructor( val user = getUser() val authData = getAuthData() var resultStatus = ResultStatus.OK fun fetchUpdate(updateData: Pair<List<FusedApp>, ResultStatus>) { appsNeededToUpdate.addAll(updateData.first) resultStatus = updateData.second } if (user in listOf(User.ANONYMOUS, User.GOOGLE) && authData != null) { /* * Signifies valid Google user and valid auth data to update * apps from Google Play store. * The user check will be more useful in No Google mode. */ val updateData = updatesManagerRepository.getUpdates(authData) appsNeededToUpdate.addAll(updateData.first) resultStatus = updateData.second fetchUpdate(updatesManagerRepository.getUpdates(authData)) } else if (user != User.UNAVAILABLE) { /* * If authData is null, update apps from cleanapk only. */ val updateData = updatesManagerRepository.getUpdatesOSS() appsNeededToUpdate.addAll(updateData.first) resultStatus = updateData.second fetchUpdate(updatesManagerRepository.getUpdatesOSS()) } else { /* * If user in UNAVAILABLE, don't do anything. Loading Loading @@ -138,8 +141,9 @@ class UpdatesWorker @AssistedInject constructor( if (retryCount == 1) { EventBus.invokeEvent(AppEvent.UpdateEvent(ResultSupreme.WorkError(ResultStatus.RETRY))) } if (retryCount <= 10) { delay(3000) if (retryCount <= MAX_RETRY_COUNT) { delay(DELAY_FOR_RETRY) checkForUpdates() } else { EventBus.invokeEvent(AppEvent.UpdateEvent(ResultSupreme.WorkError(ResultStatus.UNKNOWN))) Loading Loading
app/src/main/java/foundation/e/apps/api/gplay/GPlayAPIImpl.kt +0 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import foundation.e.apps.api.gplay.utils.GPlayHttpClient import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.supervisorScope import kotlinx.coroutines.withContext import timber.log.Timber import javax.inject.Inject class GPlayAPIImpl @Inject constructor(private val gPlayHttpClient: GPlayHttpClient) { Loading
app/src/main/java/foundation/e/apps/manager/workmanager/InstallAppWorker.kt +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import androidx.work.WorkerParameters import dagger.assisted.Assisted import dagger.assisted.AssistedInject import foundation.e.apps.R import foundation.e.apps.api.fused.UpdatesDao import foundation.e.apps.manager.database.DatabaseRepository import foundation.e.apps.manager.database.fusedDownload.FusedDownload import foundation.e.apps.manager.fused.FusedManagerRepository Loading
app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +36 −25 Original line number Diff line number Diff line Loading @@ -176,6 +176,12 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte viewLifecycleOwner.lifecycleScope.launch { EventBus.events.flowWithLifecycle(viewLifecycleOwner.lifecycle) .filter { appEvent -> appEvent is AppEvent.UpdateEvent }.collectLatest { handleUpdateEvent(it) } } } private fun handleUpdateEvent(it: AppEvent) { val event = it.data as ResultSupreme.WorkError<*> when (event.data) { ResultStatus.USER_NOT_AVAILABLE -> { Loading @@ -185,6 +191,17 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte requireContext().toast(getString(R.string.message_retry)) } else -> { handleUnknownErrorEvent(event) } } } private fun handleUnknownErrorEvent(event: ResultSupreme.WorkError<*>) { if (event.otherPayload == null) { requireContext().toast(getString(R.string.message_update_failed)) return } if (event.otherPayload is FusedDownload) { requireContext().toast( getString( Loading @@ -192,12 +209,6 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte (event.otherPayload as FusedDownload).name ) ) } else { requireContext().toast(getString(R.string.message_update_failed)) } } } } } } Loading
app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt +0 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ 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 @@ -30,7 +29,6 @@ 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
app/src/main/java/foundation/e/apps/updates/manager/UpdatesWorker.kt +13 −9 Original line number Diff line number Diff line Loading @@ -47,9 +47,10 @@ class UpdatesWorker @AssistedInject constructor( private val dataStoreModule: DataStoreModule, private val gson: Gson, ) : CoroutineWorker(context, params) { companion object { const val IS_AUTO_UPDATE = "IS_AUTO_UPDATE" private const val MAX_RETRY_COUNT = 10 private const val DELAY_FOR_RETRY = 3000L } val TAG = UpdatesWorker::class.simpleName Loading Loading @@ -84,22 +85,24 @@ class UpdatesWorker @AssistedInject constructor( val user = getUser() val authData = getAuthData() var resultStatus = ResultStatus.OK fun fetchUpdate(updateData: Pair<List<FusedApp>, ResultStatus>) { appsNeededToUpdate.addAll(updateData.first) resultStatus = updateData.second } if (user in listOf(User.ANONYMOUS, User.GOOGLE) && authData != null) { /* * Signifies valid Google user and valid auth data to update * apps from Google Play store. * The user check will be more useful in No Google mode. */ val updateData = updatesManagerRepository.getUpdates(authData) appsNeededToUpdate.addAll(updateData.first) resultStatus = updateData.second fetchUpdate(updatesManagerRepository.getUpdates(authData)) } else if (user != User.UNAVAILABLE) { /* * If authData is null, update apps from cleanapk only. */ val updateData = updatesManagerRepository.getUpdatesOSS() appsNeededToUpdate.addAll(updateData.first) resultStatus = updateData.second fetchUpdate(updatesManagerRepository.getUpdatesOSS()) } else { /* * If user in UNAVAILABLE, don't do anything. Loading Loading @@ -138,8 +141,9 @@ class UpdatesWorker @AssistedInject constructor( if (retryCount == 1) { EventBus.invokeEvent(AppEvent.UpdateEvent(ResultSupreme.WorkError(ResultStatus.RETRY))) } if (retryCount <= 10) { delay(3000) if (retryCount <= MAX_RETRY_COUNT) { delay(DELAY_FOR_RETRY) checkForUpdates() } else { EventBus.invokeEvent(AppEvent.UpdateEvent(ResultSupreme.WorkError(ResultStatus.UNKNOWN))) Loading