Allow checking updates for disabled apps & fix loops
Resolves : #645, #587
This commit is contained in:
@@ -130,9 +130,17 @@ 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) {
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) :
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -307,6 +307,8 @@
|
||||
<string name="pref_ui_no_promotional_desc">"Display apps promoted by us on home screen"</string>
|
||||
<string name="pref_ui_similar_apps">"Similar and related apps"</string>
|
||||
<string name="pref_ui_similar_apps_desc">"Display similar and related clusters on app details page"</string>
|
||||
<string name="pref_updates_extended">Extended updates</string>
|
||||
<string name="pref_updates_extended_desc">Enable to check updates for disabled apps</string>
|
||||
<string name="purchase_failed">"Download Failed"</string>
|
||||
<string name="purchase_invalid">"App not purchased"</string>
|
||||
<string name="purchase_unsupported">"App not supported"</string>
|
||||
|
||||
@@ -57,4 +57,12 @@
|
||||
app:key="pref_network"
|
||||
app:layout="@layout/item_preference"
|
||||
app:title="@string/pref_network_title" />
|
||||
|
||||
<Preference
|
||||
android:fragment="com.aurora.store.view.ui.preferences.UpdatesPreference"
|
||||
app:icon="@drawable/ic_updates"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="pref_network"
|
||||
app:layout="@layout/item_preference"
|
||||
app:title="@string/title_updates" />
|
||||
</PreferenceScreen>
|
||||
28
app/src/main/res/xml/preferences_updates.xml
Normal file
28
app/src/main/res/xml/preferences_updates.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<!--
|
||||
~ 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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="PREFERENCE_UPDATES_EXTENDED"
|
||||
app:summary="@string/pref_updates_extended_desc"
|
||||
app:title="@string/pref_updates_extended" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
||||
Reference in New Issue
Block a user