Execute scripts when not removing tracking

pull/153/head
M66B 6 years ago
parent 03a54f6453
commit 432fb7739d

@ -71,6 +71,7 @@ import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -1408,8 +1409,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibImages.setVisibility(View.GONE);
tvBody.setVisibility(View.GONE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean remove_tracking = prefs.getBoolean("remove_tracking", true);
// For performance reasons the WebView is created when needed only
if (!(vwBody instanceof WebView)) {
// For performance reasons the WebView is created when needed only
WebView webView = new WebView(context) {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@ -1448,6 +1452,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
if (!remove_tracking)
webView.setWebChromeClient(new WebChromeClient());
webView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(
String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {

@ -440,6 +440,19 @@
app:layout_constraintTop_toBottomOf="@id/tvHtmlHint"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvTrackingHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="60dp"
android:text="@string/title_advanced_tracking_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTracking" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swImages"
android:layout_width="match_parent"
@ -449,7 +462,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_images"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTracking"
app:layout_constraintTop_toBottomOf="@id/tvTrackingHint"
app:switchPadding="12dp" />
<TextView

@ -193,6 +193,8 @@
<string name="title_advanced_threading_hint">Group messages related to each other</string>
<string name="title_advanced_name_email_hint">When disabled only names will be shown when available</string>
<string name="title_advanced_flags_hint">Note that starred messages will always be kept locally</string>
<string name="title_advanced_tracking_hint">Disabling this option enables potential unsafe scripts</string>
<string name="title_advanced_autoexpand_hint">Automatically open message when there is just one message or just one unread message in a conversation</string>
<string name="title_advanced_autocollapse_hint">Multiple expanded messages will always be closed on \'back\'</string>
<string name="title_advanced_autoclose_hint">Automatically close conversations when all messages are archived, sent or trashed</string>

Loading…
Cancel
Save