Allow checking updates for disabled apps & fix loops

Resolves : #645, #587
This commit is contained in:
Rahul Kumar Patel
2021-05-14 03:51:06 +05:30
parent b27a1f19d5
commit a8730d5cd1
9 changed files with 95 additions and 10 deletions

View File

@@ -130,10 +130,18 @@ object PackageUtil {
Preferences.PREFERENCE_FILTER_FDROID
)
packageInfoList = packageInfoList
.filter {
it.packageName != null && it.applicationInfo != null && it.applicationInfo.enabled
}
val isExtendedUpdateEnabled = Preferences.getBoolean(
context,
Preferences.PREFERENCE_UPDATES_EXTENDED
)
packageInfoList = packageInfoList.filter {
it.packageName != null && it.applicationInfo != null
}
if (!isExtendedUpdateEnabled) {
packageInfoList = packageInfoList.filter { it.applicationInfo.enabled }
}
if (isFdroidFilterEnabled) {
packageInfoList = packageInfoList
@@ -163,11 +171,7 @@ object PackageUtil {
}
private fun getAllFlags(): Int {
var flags = (PackageManager.GET_META_DATA
or PackageManager.GET_ACTIVITIES
or PackageManager.GET_SERVICES
or PackageManager.GET_PROVIDERS
or PackageManager.GET_RECEIVERS)
var flags = (PackageManager.GET_META_DATA)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
flags = flags or PackageManager.GET_DISABLED_COMPONENTS
flags = flags or PackageManager.GET_UNINSTALLED_PACKAGES

View File

@@ -56,6 +56,8 @@ object Preferences {
const val PREFERENCE_INSECURE_ANONYMOUS = "PREFERENCE_INSECURE_ANONYMOUS"
const val PREFERENCE_UPDATES_EXTENDED = "PREFERENCE_UPDATES_EXTENDED"
fun getPrefs(context: Context): SharedPreferences {
return PreferenceManager.getDefaultSharedPreferences(context)

View File

@@ -47,6 +47,7 @@ import com.aurora.store.util.Preferences.PREFERENCE_QUICK_EXIT
import com.aurora.store.util.Preferences.PREFERENCE_SIMILAR
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
import com.aurora.store.util.Preferences.PREFERENCE_THEME_TYPE
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_EXTENDED
import com.aurora.store.util.save
import com.aurora.store.view.ui.commons.BaseActivity
import com.aurora.store.view.ui.splash.SplashActivity
@@ -178,6 +179,9 @@ class OnboardingActivity : BaseActivity() {
/*Installer*/
save(PREFERENCE_AUTO_DELETE, true)
save(PREFERENCE_INSTALLER_ID, 0)
/*Updates*/
save(PREFERENCE_UPDATES_EXTENDED, false)
}
internal class PagerAdapter(fragmentActivity: FragmentActivity) :

View File

@@ -0,0 +1,35 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.ui.preferences
import android.os.Bundle
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.aurora.extensions.runOnUiThread
import com.aurora.extensions.toast
import com.aurora.store.R
import com.aurora.store.util.CommonUtil
import com.aurora.store.util.Preferences
class UpdatesPreference : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences_updates, rootKey)
}
}

View File

@@ -21,9 +21,9 @@ package com.aurora.store.viewmodel.all
import android.app.Application
import androidx.lifecycle.viewModelScope
import com.aurora.extensions.flushAndAdd
import com.aurora.store.data.RequestState
import com.aurora.store.data.event.BusEvent
import com.aurora.extensions.flushAndAdd
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.greenrobot.eventbus.EventBus

View File

@@ -69,6 +69,8 @@ class UpdatesViewModel(application: Application) : BaseAppsViewModel(application
false
}
}.sortedBy { it.displayName.toLowerCase(Locale.getDefault()) }.also { apps ->
updateFileMap.clear()
apps.forEach {
updateFileMap[it.id] = UpdateFile(it)
}