mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 19:31:49 +01:00
Fixed prompt for allow app installs not showing from self updater
Also making it so the silent installer doesn't run if the app is not allowed to install packages
This commit is contained in:
parent
7b493fca8f
commit
29c6c892c7
@ -4,6 +4,7 @@ import android.app.ActivityManager
|
||||
import android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
|
||||
import android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIBLE
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.work.Constraints
|
||||
import androidx.work.CoroutineWorker
|
||||
@ -24,6 +25,12 @@ class AutoUpdaterJob(private val context: Context, workerParams: WorkerParameter
|
||||
|
||||
override suspend fun doWork(): Result = coroutineScope {
|
||||
try {
|
||||
if (
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
!context.packageManager.canRequestPackageInstalls()
|
||||
) {
|
||||
return@coroutineScope Result.failure()
|
||||
}
|
||||
val result = UpdateChecker.getUpdateChecker().checkForUpdate()
|
||||
if (result is UpdateResult.NewUpdate<*> && !UpdaterService.isRunning()) {
|
||||
UpdaterNotifier(context).cancel()
|
||||
|
@ -17,7 +17,7 @@ class UpdaterBroadcast : BroadcastReceiver() {
|
||||
when (val status = extras.getInt(PackageInstaller.EXTRA_STATUS)) {
|
||||
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
||||
val confirmIntent = extras[Intent.EXTRA_INTENT] as? Intent
|
||||
context.startActivity(confirmIntent)
|
||||
context.startActivity(confirmIntent?.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
|
||||
}
|
||||
PackageInstaller.STATUS_SUCCESS -> {
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
@ -97,7 +97,7 @@ object AndroidVersions {
|
||||
const val minSdk = 23
|
||||
const val targetSdk = 30
|
||||
const val versionCode = 77
|
||||
const val versionName = "1.1.1"
|
||||
const val versionName = "1.1.0"
|
||||
const val ndk = "22.0.7026061"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user