X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fviewmodels%2FWebViewSource.kt;h=3251d92048038fe6cc9f90d75ad85454741dfd26;hp=1635fe6e5db1965fba33555184fd593456542183;hb=aa121d6d6df14a0425ac3b5603765dbae7e8d156;hpb=606b5659cfd41c546fcbf248dcde72fd3c60d1c3 diff --git a/app/src/main/java/com/stoutner/privacybrowser/viewmodels/WebViewSource.kt b/app/src/main/java/com/stoutner/privacybrowser/viewmodels/WebViewSource.kt index 1635fe6e..3251d920 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/viewmodels/WebViewSource.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/viewmodels/WebViewSource.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Soren Stoutner . + * Copyright © 2020-2021 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -19,6 +19,7 @@ package com.stoutner.privacybrowser.viewmodels +import android.content.ContentResolver import android.text.SpannableStringBuilder import androidx.lifecycle.LiveData @@ -30,7 +31,7 @@ import com.stoutner.privacybrowser.backgroundtasks.GetSourceBackgroundTask import java.net.Proxy import java.util.concurrent.ExecutorService -class WebViewSource(private val urlString: String, private val userAgent: String, private val doNotTrack: Boolean, private val localeString: String, private val proxy: Proxy, +class WebViewSource(private val urlString: String, private val userAgent: String, private val localeString: String, private val proxy: Proxy, private val contentResolver: ContentResolver, private val executorService: ExecutorService): ViewModel() { // Initialize the mutable live data variables. private val mutableLiveDataSourceStringArray = MutableLiveData>() @@ -42,7 +43,8 @@ class WebViewSource(private val urlString: String, private val userAgent: String val getSourceBackgroundTask = GetSourceBackgroundTask() // Get the source. - executorService.execute { mutableLiveDataSourceStringArray.postValue(getSourceBackgroundTask.acquire(urlString, userAgent, doNotTrack, localeString, proxy, this)) } + executorService.execute { mutableLiveDataSourceStringArray.postValue(getSourceBackgroundTask.acquire(urlString, userAgent, localeString, proxy, contentResolver, this, + false)) } } // The source observer. @@ -64,7 +66,7 @@ class WebViewSource(private val urlString: String, private val userAgent: String } // The workhorse that gets the source. - fun updateSource(urlString: String) { + fun updateSource(urlString: String, ignoreSslErrors: Boolean) { // Reset the mutable live data error string. This prevents the snackbar from displaying later if the activity restarts. mutableLiveDataErrorString.postValue("") @@ -72,6 +74,7 @@ class WebViewSource(private val urlString: String, private val userAgent: String val getSourceBackgroundTask = GetSourceBackgroundTask() // Get the source. - executorService.execute { mutableLiveDataSourceStringArray.postValue(getSourceBackgroundTask.acquire(urlString, userAgent, doNotTrack, localeString, proxy, this)) } + executorService.execute { mutableLiveDataSourceStringArray.postValue(getSourceBackgroundTask.acquire(urlString, userAgent, localeString, proxy, contentResolver, this, + ignoreSslErrors)) } } } \ No newline at end of file