Loading app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ plugins { def versionMajor = 2 def versionMinor = 4 def versionPatch = 5 def versionPatch = 6 def getGitHash = { -> def stdOut = new ByteArrayOutputStream() Loading app/src/main/java/foundation/e/apps/settings/SettingsFragment.kt +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ class SettingsFragment : PreferenceFragmentCompat() { UpdatesWorkManager.enqueueWork( it, newValue.toString().toLong(), ExistingPeriodicWorkPolicy.KEEP ExistingPeriodicWorkPolicy.REPLACE ) } true Loading app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +13 −3 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte private fun handleStateNoUpdates(list: List<FusedApp>?) { if (!list.isNullOrEmpty()) { binding.button.isEnabled = true initUpdataAllButton() binding.noUpdates.visibility = View.GONE } else { binding.noUpdates.visibility = View.VISIBLE Loading @@ -177,7 +178,9 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte ( workInfoList.isNullOrEmpty() || ( !updatesViewModel.checkWorkInfoListHasAnyUpdatableWork(workInfoList) && !updatesViewModel.checkWorkInfoListHasAnyUpdatableWork( workInfoList ) && updatesViewModel.hasAnyUpdatableApp() ) ) Loading Loading @@ -270,8 +273,13 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte clearAndRestartGPlayLogin() true } initUpdataAllButton() } private fun initUpdataAllButton() { binding.button.setOnClickListener { UpdatesWorkManager.startUpdateAllWork(requireContext().applicationContext) val interval = updatesViewModel.getUpdateInterval() UpdatesWorkManager.startUpdateAllWork(requireContext()) observeUpdateWork() binding.button.isEnabled = false } Loading @@ -279,7 +287,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte private fun observeUpdateWork() { WorkManager.getInstance(requireContext()) .getWorkInfosByTagLiveData(UpdatesWorkManager.UPDATES_WORK_NAME) .getWorkInfosByTagLiveData(UpdatesWorkManager.TAG) .observe(viewLifecycleOwner) { binding.button.isEnabled = hasAnyPendingUpdates(it) } Loading Loading @@ -353,6 +361,8 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte } override fun onDestroyView() { mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) isDownloadObserverAdded = false super.onDestroyView() _binding = null } Loading app/src/main/java/foundation/e/apps/updates/UpdatesViewModel.kt +5 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import foundation.e.apps.utils.enums.ResultStatus import foundation.e.apps.utils.enums.Status import foundation.e.apps.utils.exceptions.CleanApkException import foundation.e.apps.utils.exceptions.GPlayException import foundation.e.apps.utils.modules.PreferenceManagerModule import foundation.e.apps.utils.parentFragment.LoadingViewModel import kotlinx.coroutines.launch import javax.inject.Inject Loading @@ -38,7 +39,8 @@ import javax.inject.Inject @HiltViewModel class UpdatesViewModel @Inject constructor( private val updatesManagerRepository: UpdatesManagerRepository, private val fusedAPIRepository: FusedAPIRepository private val fusedAPIRepository: FusedAPIRepository, private val preferenceManagerModule: PreferenceManagerModule ) : LoadingViewModel() { val updatesList: MutableLiveData<Pair<List<FusedApp>, ResultStatus?>> = MutableLiveData() Loading Loading @@ -133,4 +135,6 @@ class UpdatesViewModel @Inject constructor( ) return updatesList.value?.first?.any { pendingStatesForUpdate.contains(it.status) } == true } fun getUpdateInterval() = preferenceManagerModule.getUpdateInterval() } app/src/main/java/foundation/e/apps/updates/manager/UpdatesBroadcastReceiver.kt +4 −9 Original line number Diff line number Diff line Loading @@ -20,9 +20,8 @@ package foundation.e.apps.updates.manager import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import androidx.preference.PreferenceManager import androidx.work.ExistingPeriodicWorkPolicy import foundation.e.apps.R import foundation.e.apps.utils.modules.PreferenceManagerModule import timber.log.Timber class UpdatesBroadcastReceiver : BroadcastReceiver() { Loading @@ -33,13 +32,9 @@ class UpdatesBroadcastReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Timber.d("onReceive: ${intent.action}") if (intent.action == Intent.ACTION_BOOT_COMPLETED) { val preferences = PreferenceManager.getDefaultSharedPreferences(context) val interval = preferences.getString( context.getString(R.string.update_check_intervals), context.getString(R.string.preference_update_interval_default) )!!.toLong() UpdatesWorkManager.enqueueWork(context, interval, ExistingPeriodicWorkPolicy.KEEP) val preferenceManagerModule = PreferenceManagerModule(context) val interval = preferenceManagerModule.getUpdateInterval() UpdatesWorkManager.enqueueWork(context, interval, ExistingPeriodicWorkPolicy.REPLACE) } } } Loading
app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ plugins { def versionMajor = 2 def versionMinor = 4 def versionPatch = 5 def versionPatch = 6 def getGitHash = { -> def stdOut = new ByteArrayOutputStream() Loading
app/src/main/java/foundation/e/apps/settings/SettingsFragment.kt +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ class SettingsFragment : PreferenceFragmentCompat() { UpdatesWorkManager.enqueueWork( it, newValue.toString().toLong(), ExistingPeriodicWorkPolicy.KEEP ExistingPeriodicWorkPolicy.REPLACE ) } true Loading
app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +13 −3 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte private fun handleStateNoUpdates(list: List<FusedApp>?) { if (!list.isNullOrEmpty()) { binding.button.isEnabled = true initUpdataAllButton() binding.noUpdates.visibility = View.GONE } else { binding.noUpdates.visibility = View.VISIBLE Loading @@ -177,7 +178,9 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte ( workInfoList.isNullOrEmpty() || ( !updatesViewModel.checkWorkInfoListHasAnyUpdatableWork(workInfoList) && !updatesViewModel.checkWorkInfoListHasAnyUpdatableWork( workInfoList ) && updatesViewModel.hasAnyUpdatableApp() ) ) Loading Loading @@ -270,8 +273,13 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte clearAndRestartGPlayLogin() true } initUpdataAllButton() } private fun initUpdataAllButton() { binding.button.setOnClickListener { UpdatesWorkManager.startUpdateAllWork(requireContext().applicationContext) val interval = updatesViewModel.getUpdateInterval() UpdatesWorkManager.startUpdateAllWork(requireContext()) observeUpdateWork() binding.button.isEnabled = false } Loading @@ -279,7 +287,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte private fun observeUpdateWork() { WorkManager.getInstance(requireContext()) .getWorkInfosByTagLiveData(UpdatesWorkManager.UPDATES_WORK_NAME) .getWorkInfosByTagLiveData(UpdatesWorkManager.TAG) .observe(viewLifecycleOwner) { binding.button.isEnabled = hasAnyPendingUpdates(it) } Loading Loading @@ -353,6 +361,8 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), FusedAPIInte } override fun onDestroyView() { mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) isDownloadObserverAdded = false super.onDestroyView() _binding = null } Loading
app/src/main/java/foundation/e/apps/updates/UpdatesViewModel.kt +5 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import foundation.e.apps.utils.enums.ResultStatus import foundation.e.apps.utils.enums.Status import foundation.e.apps.utils.exceptions.CleanApkException import foundation.e.apps.utils.exceptions.GPlayException import foundation.e.apps.utils.modules.PreferenceManagerModule import foundation.e.apps.utils.parentFragment.LoadingViewModel import kotlinx.coroutines.launch import javax.inject.Inject Loading @@ -38,7 +39,8 @@ import javax.inject.Inject @HiltViewModel class UpdatesViewModel @Inject constructor( private val updatesManagerRepository: UpdatesManagerRepository, private val fusedAPIRepository: FusedAPIRepository private val fusedAPIRepository: FusedAPIRepository, private val preferenceManagerModule: PreferenceManagerModule ) : LoadingViewModel() { val updatesList: MutableLiveData<Pair<List<FusedApp>, ResultStatus?>> = MutableLiveData() Loading Loading @@ -133,4 +135,6 @@ class UpdatesViewModel @Inject constructor( ) return updatesList.value?.first?.any { pendingStatesForUpdate.contains(it.status) } == true } fun getUpdateInterval() = preferenceManagerModule.getUpdateInterval() }
app/src/main/java/foundation/e/apps/updates/manager/UpdatesBroadcastReceiver.kt +4 −9 Original line number Diff line number Diff line Loading @@ -20,9 +20,8 @@ package foundation.e.apps.updates.manager import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import androidx.preference.PreferenceManager import androidx.work.ExistingPeriodicWorkPolicy import foundation.e.apps.R import foundation.e.apps.utils.modules.PreferenceManagerModule import timber.log.Timber class UpdatesBroadcastReceiver : BroadcastReceiver() { Loading @@ -33,13 +32,9 @@ class UpdatesBroadcastReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Timber.d("onReceive: ${intent.action}") if (intent.action == Intent.ACTION_BOOT_COMPLETED) { val preferences = PreferenceManager.getDefaultSharedPreferences(context) val interval = preferences.getString( context.getString(R.string.update_check_intervals), context.getString(R.string.preference_update_interval_default) )!!.toLong() UpdatesWorkManager.enqueueWork(context, interval, ExistingPeriodicWorkPolicy.KEEP) val preferenceManagerModule = PreferenceManagerModule(context) val interval = preferenceManagerModule.getUpdateInterval() UpdatesWorkManager.enqueueWork(context, interval, ExistingPeriodicWorkPolicy.REPLACE) } } }