Minor cleanup

This commit is contained in:
arkon 2022-04-14 18:15:47 -04:00
parent 5da2c82f47
commit f16fb4e1e4
2 changed files with 5 additions and 13 deletions

View File

@ -8,6 +8,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.os.Looper
import android.webkit.WebView
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.app.NotificationManagerCompat
@ -152,15 +153,11 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
override fun getPackageName(): String {
try {
// Override the value passed as X-Requested-With in WebView requests
val stackTrace = Thread.currentThread().stackTrace
for (element in stackTrace) {
if ("org.chromium.base.BuildInfo".equals(element.className, ignoreCase = true)) {
if ("getAll".equals(element.methodName, ignoreCase = true)) {
val stackTrace = Looper.getMainLooper().thread.stackTrace
val chromiumElement = stackTrace.find { it.className.equals("org.chromium.base.BuildInfo", ignoreCase = true) }
if (chromiumElement?.methodName.equals("getAll", ignoreCase = true)) {
return WebViewUtil.SPOOF_PACKAGE_NAME
}
break
}
}
} catch (e: Exception) {
}
return super.getPackageName()

View File

@ -244,11 +244,6 @@ class ExtensionManager(
installer.updateInstallStep(downloadId, InstallStep.Installing)
}
fun setInstallationResult(downloadId: Long, result: Boolean) {
val step = if (result) InstallStep.Installed else InstallStep.Error
installer.updateInstallStep(downloadId, step)
}
fun updateInstallStep(downloadId: Long, step: InstallStep) {
installer.updateInstallStep(downloadId, step)
}