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

View file

@ -244,11 +244,6 @@ class ExtensionManager(
installer.updateInstallStep(downloadId, InstallStep.Installing) 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) { fun updateInstallStep(downloadId: Long, step: InstallStep) {
installer.updateInstallStep(downloadId, step) installer.updateInstallStep(downloadId, step)
} }