Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/build.gradle
This commit is contained in:
JFronny 2022-10-25 14:15:56 +02:00
commit eaae3fa782
No known key found for this signature in database
GPG key ID: E76429612C2929F4
4 changed files with 30 additions and 15 deletions

View file

@ -18,7 +18,7 @@ jobs:
uses: actions-cool/issues-similarity-analysis@v1 uses: actions-cool/issues-similarity-analysis@v1
with: with:
token: ${{ steps.generate_token.outputs.token }} token: ${{ steps.generate_token.outputs.token }}
filter-threshold: 0.5 filter-threshold: 0.60
title-excludes: '' title-excludes: ''
comment-title: | comment-title: |
### Your issue looks similar to these issues: ### Your issue looks similar to these issues:

View file

@ -47,8 +47,8 @@ android {
minSdk = 21 minSdk = 21
targetSdk = 30 targetSdk = 30
versionCode = 51 versionCode = 52
versionName = "3.1.5" versionName = "3.1.6"
resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}") resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}")

View file

@ -26,6 +26,7 @@
<package android:name="is.xyz.mpv" /> <package android:name="is.xyz.mpv" />
</queries> </queries>
<!-- Without the large heap Exoplayer buffering gets reset due to OOM. -->
<!--TODO https://stackoverflow.com/questions/41799732/chromecast-button-not-visible-in-android--> <!--TODO https://stackoverflow.com/questions/41799732/chromecast-button-not-visible-in-android-->
<application <application
android:name=".AcraApplication" android:name=".AcraApplication"
@ -35,6 +36,7 @@
android:fullBackupContent="@xml/backup_descriptor" android:fullBackupContent="@xml/backup_descriptor"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"

View file

@ -7,7 +7,9 @@ import com.lagradost.cloudstream3.AcraApplication
import com.lagradost.cloudstream3.AcraApplication.Companion.context import com.lagradost.cloudstream3.AcraApplication.Companion.context
import com.lagradost.cloudstream3.USER_AGENT import com.lagradost.cloudstream3.USER_AGENT
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.mvvm.debugException
import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.utils.Coroutines.main import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.Coroutines.mainWork import com.lagradost.cloudstream3.utils.Coroutines.mainWork
import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf
@ -65,9 +67,15 @@ class WebViewResolver(
method: String = "GET", method: String = "GET",
requestCallBack: (Request) -> Boolean = { false }, requestCallBack: (Request) -> Boolean = { false },
): Pair<Request?, List<Request>> { ): Pair<Request?, List<Request>> {
return resolveUsingWebView( return try {
resolveUsingWebView(
requestCreator(method, url, referer = referer), requestCallBack requestCreator(method, url, referer = referer), requestCallBack
) )
} catch (e: java.lang.IllegalArgumentException) {
logError(e)
debugException { "ILLEGAL URL IN resolveUsingWebView!" }
return null to emptyList()
}
} }
/** /**
@ -129,7 +137,7 @@ class WebViewResolver(
println("Loading WebView URL: $webViewUrl") println("Loading WebView URL: $webViewUrl")
if (interceptUrl.containsMatchIn(webViewUrl)) { if (interceptUrl.containsMatchIn(webViewUrl)) {
fixedRequest = request.toRequest().also { fixedRequest = request.toRequest()?.also {
requestCallBack(it) requestCallBack(it)
} }
println("Web-view request finished: $webViewUrl") println("Web-view request finished: $webViewUrl")
@ -138,9 +146,9 @@ class WebViewResolver(
} }
if (additionalUrls.any { it.containsMatchIn(webViewUrl) }) { if (additionalUrls.any { it.containsMatchIn(webViewUrl) }) {
extraRequestList.add(request.toRequest().also { request.toRequest()?.also {
if (requestCallBack(it)) destroyWebView() if (requestCallBack(it)) destroyWebView()
}) }?.let(extraRequestList::add)
} }
// Suppress image requests as we don't display them anywhere // Suppress image requests as we don't display them anywhere
@ -251,14 +259,19 @@ class WebViewResolver(
} }
fun WebResourceRequest.toRequest(): Request { fun WebResourceRequest.toRequest(): Request? {
val webViewUrl = this.url.toString() val webViewUrl = this.url.toString()
return requestCreator( // If invalid url then it can crash with
// java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'data'
// At Request.Builder().url(addParamsToUrl(url, params))
return normalSafeApiCall {
requestCreator(
this.method, this.method,
webViewUrl, webViewUrl,
this.requestHeaders, this.requestHeaders,
) )
}
} }
fun Response.toWebResourceResponse(): WebResourceResponse { fun Response.toWebResourceResponse(): WebResourceResponse {