mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix buggy OpenSubtitles caused by race condition
This commit is contained in:
parent
880b89ea85
commit
94fa6b963b
2 changed files with 10 additions and 6 deletions
|
@ -150,7 +150,11 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
* @return true if the str has launched an app task (be it successful or not)
|
* @return true if the str has launched an app task (be it successful or not)
|
||||||
* @param isWebview does not handle providers and opening download page if true. Can still add repos and login.
|
* @param isWebview does not handle providers and opening download page if true. Can still add repos and login.
|
||||||
* */
|
* */
|
||||||
fun handleAppIntentUrl(activity: FragmentActivity?, str: String?, isWebview: Boolean): Boolean =
|
fun handleAppIntentUrl(
|
||||||
|
activity: FragmentActivity?,
|
||||||
|
str: String?,
|
||||||
|
isWebview: Boolean
|
||||||
|
): Boolean =
|
||||||
with(activity) {
|
with(activity) {
|
||||||
if (str != null && this != null) {
|
if (str != null && this != null) {
|
||||||
if (str.startsWith("https://cs.repo")) {
|
if (str.startsWith("https://cs.repo")) {
|
||||||
|
@ -191,7 +195,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
val url = str.replaceFirst(appStringRepo, "https")
|
val url = str.replaceFirst(appStringRepo, "https")
|
||||||
loadRepository(url)
|
loadRepository(url)
|
||||||
return true
|
return true
|
||||||
} else if (!isWebview){
|
} else if (!isWebview) {
|
||||||
if (str.startsWith(DOWNLOAD_NAVIGATE_TO)) {
|
if (str.startsWith(DOWNLOAD_NAVIGATE_TO)) {
|
||||||
this.navigate(R.id.navigation_downloads)
|
this.navigate(R.id.navigation_downloads)
|
||||||
return true
|
return true
|
||||||
|
@ -565,9 +569,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
for (api in accountManagers) {
|
for (api in accountManagers) {
|
||||||
api.init()
|
api.init()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ioSafe {
|
|
||||||
inAppAuths.apmap { api ->
|
inAppAuths.apmap { api ->
|
||||||
try {
|
try {
|
||||||
api.initialize()
|
api.initialize()
|
||||||
|
|
|
@ -40,13 +40,15 @@ class WebviewFragment : Fragment() {
|
||||||
return super.shouldOverrideUrlLoading(view, request)
|
return super.shouldOverrideUrlLoading(view, request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebViewResolver.webViewUserAgent = web_view.settings.userAgentString
|
||||||
|
|
||||||
web_view.addJavascriptInterface(RepoApi(activity), "RepoApi")
|
web_view.addJavascriptInterface(RepoApi(activity), "RepoApi")
|
||||||
web_view.settings.javaScriptEnabled = true
|
web_view.settings.javaScriptEnabled = true
|
||||||
web_view.settings.userAgentString = USER_AGENT
|
web_view.settings.userAgentString = USER_AGENT
|
||||||
web_view.settings.domStorageEnabled = true
|
web_view.settings.domStorageEnabled = true
|
||||||
|
// WebView.setWebContentsDebuggingEnabled(true)
|
||||||
|
|
||||||
WebViewResolver.webViewUserAgent = web_view.settings.userAgentString
|
|
||||||
// web_view.settings.userAgentString = USER_AGENT
|
|
||||||
web_view.loadUrl(url)
|
web_view.loadUrl(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue