Try to avoid some Webview-related crashes

Related to #5218

(cherry picked from commit 3d9383ce674dd4046b5f46eea70d5fddb61e193c)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/App.kt
This commit is contained in:
arkon 2021-05-28 22:34:26 -04:00 committed by Jobobby04
parent 7d659f559e
commit d92e790c5e
2 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import android.content.res.Configuration
import android.graphics.Color
import android.os.Build
import android.os.Environment
import android.webkit.WebView
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.getSystemService
import androidx.lifecycle.Lifecycle
@ -92,6 +93,12 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory {
Security.insertProviderAt(Conscrypt.newProvider(), 1)
}
// Avoid potential crashes
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val process = getProcessName()
if (packageName != process) WebView.setDataDirectorySuffix(process)
}
Injekt.importModule(AppModule(this))
setupNotificationChannels()

View File

@ -153,6 +153,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
webView?.stopLoading()
webView?.destroy()
webView = null
}
// Throw exception if we failed to bypass Cloudflare