UpdateWorker: Respect incompatible updates setting
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -74,6 +74,9 @@ class UpdateWorker @AssistedInject constructor(
|
|||||||
!CertUtil.isAppGalleryApp(appContext, BuildConfig.APPLICATION_ID) &&
|
!CertUtil.isAppGalleryApp(appContext, BuildConfig.APPLICATION_ID) &&
|
||||||
buildType != BuildType.DEBUG
|
buildType != BuildType.DEBUG
|
||||||
|
|
||||||
|
private val isExtendedUpdateEnabled: Boolean
|
||||||
|
get() = Preferences.getBoolean(appContext, Preferences.PREFERENCE_UPDATES_EXTENDED)
|
||||||
|
|
||||||
override suspend fun doWork(): Result {
|
override suspend fun doWork(): Result {
|
||||||
super.doWork()
|
super.doWork()
|
||||||
|
|
||||||
@@ -94,10 +97,9 @@ class UpdateWorker @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val updates = checkUpdates().also {
|
val updates = checkUpdates()
|
||||||
// Cache the updates into the database
|
.also { updateDao.insertUpdates(it) }
|
||||||
updateDao.insertUpdates(it)
|
.filter { if (!isExtendedUpdateEnabled) it.hasValidCert else true }
|
||||||
}
|
|
||||||
|
|
||||||
if (updates.isEmpty()) {
|
if (updates.isEmpty()) {
|
||||||
Log.i(TAG, "No updates found!")
|
Log.i(TAG, "No updates found!")
|
||||||
|
|||||||
Reference in New Issue
Block a user