forked from recloudstream/cloudstream
		
	fixed minor crashes
This commit is contained in:
		
							parent
							
								
									36115b524d
								
							
						
					
					
						commit
						d992d63c5f
					
				
					 3 changed files with 135 additions and 119 deletions
				
			
		|  | @ -6,6 +6,7 @@ import android.webkit.* | ||||||
| import com.lagradost.cloudstream3.AcraApplication | import com.lagradost.cloudstream3.AcraApplication | ||||||
| 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.logError | ||||||
| import com.lagradost.cloudstream3.utils.Coroutines.main | import com.lagradost.cloudstream3.utils.Coroutines.main | ||||||
| import kotlinx.coroutines.delay | import kotlinx.coroutines.delay | ||||||
| import kotlinx.coroutines.runBlocking | import kotlinx.coroutines.runBlocking | ||||||
|  | @ -60,6 +61,7 @@ class WebViewResolver(val interceptUrl: Regex, val additionalUrls: List<Regex> = | ||||||
|         main { |         main { | ||||||
|             // Useful for debugging |             // Useful for debugging | ||||||
| //            WebView.setWebContentsDebuggingEnabled(true) | //            WebView.setWebContentsDebuggingEnabled(true) | ||||||
|  |             try { | ||||||
|                 webView = WebView( |                 webView = WebView( | ||||||
|                     AcraApplication.context |                     AcraApplication.context | ||||||
|                         ?: throw RuntimeException("No base context in WebViewResolver") |                         ?: throw RuntimeException("No base context in WebViewResolver") | ||||||
|  | @ -159,7 +161,10 @@ class WebViewResolver(val interceptUrl: Regex, val additionalUrls: List<Regex> = | ||||||
|                                     webViewUrl, |                                     webViewUrl, | ||||||
|                                     headers = request.requestHeaders |                                     headers = request.requestHeaders | ||||||
|                                 ).response.toWebResourceResponse() |                                 ).response.toWebResourceResponse() | ||||||
|                             else -> return@runBlocking super.shouldInterceptRequest(view, request) |                                 else -> return@runBlocking super.shouldInterceptRequest( | ||||||
|  |                                     view, | ||||||
|  |                                     request | ||||||
|  |                                 ) | ||||||
|                             } |                             } | ||||||
|                         } catch (e: Exception) { |                         } catch (e: Exception) { | ||||||
|                             null |                             null | ||||||
|  | @ -175,6 +180,9 @@ class WebViewResolver(val interceptUrl: Regex, val additionalUrls: List<Regex> = | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 webView?.loadUrl(url, headers.toMap()) |                 webView?.loadUrl(url, headers.toMap()) | ||||||
|  |             } catch (e: Exception) { | ||||||
|  |                 logError(e) | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         var loop = 0 |         var loop = 0 | ||||||
|  |  | ||||||
|  | @ -142,6 +142,7 @@ class GeneratorPlayer : FullScreenPlayer() { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private fun openSubPicker() { |     private fun openSubPicker() { | ||||||
|  |         try { | ||||||
|             subsPathPicker.launch( |             subsPathPicker.launch( | ||||||
|                 arrayOf( |                 arrayOf( | ||||||
|                     "text/plain", |                     "text/plain", | ||||||
|  | @ -155,6 +156,9 @@ class GeneratorPlayer : FullScreenPlayer() { | ||||||
|                     MimeTypes.APPLICATION_SUBRIP, |                     MimeTypes.APPLICATION_SUBRIP, | ||||||
|                 ) |                 ) | ||||||
|             ) |             ) | ||||||
|  |         } catch (e : Exception) { | ||||||
|  |             logError(e) | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Open file picker |     // Open file picker | ||||||
|  |  | ||||||
|  | @ -375,7 +375,11 @@ class SettingsFragment : PreferenceFragmentCompat() { | ||||||
|                 {}) { |                 {}) { | ||||||
|                 // Last = custom |                 // Last = custom | ||||||
|                 if (it == dirs.size) { |                 if (it == dirs.size) { | ||||||
|  |                     try { | ||||||
|                         pathPicker.launch(Uri.EMPTY) |                         pathPicker.launch(Uri.EMPTY) | ||||||
|  |                     } catch (e : Exception) { | ||||||
|  |                         logError(e) | ||||||
|  |                     } | ||||||
|                 } else { |                 } else { | ||||||
|                     // Sets both visual and actual paths. |                     // Sets both visual and actual paths. | ||||||
|                     // key = used path |                     // key = used path | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue