diff --git a/app/src/dummy/java/eu/faircode/email/Check.java b/app/src/dummy/java/eu/faircode/email/Check.java
new file mode 100644
index 0000000000..c7618f95c9
--- /dev/null
+++ b/app/src/dummy/java/eu/faircode/email/Check.java
@@ -0,0 +1,33 @@
+package eu.faircode.email;
+
+/*
+ This file is part of FairEmail.
+
+ FairEmail is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ FairEmail is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FairEmail. If not, see .
+
+ Copyright 2018-2022 by Marcel Bokhorst (M66B)
+*/
+
+import android.content.Context;
+
+import androidx.fragment.app.FragmentManager;
+import androidx.lifecycle.LifecycleOwner;
+
+public class Check {
+ static final String URI_PRIVACY = "";
+
+ static void virus(Context context, LifecycleOwner owner, FragmentManager fm, long id) {
+ // Do nothing
+ }
+}
diff --git a/app/src/extra/java/eu/faircode/email/Check.java b/app/src/extra/java/eu/faircode/email/Check.java
new file mode 100644
index 0000000000..0c642f361c
--- /dev/null
+++ b/app/src/extra/java/eu/faircode/email/Check.java
@@ -0,0 +1,70 @@
+package eu.faircode.email;
+
+/*
+ This file is part of FairEmail.
+
+ FairEmail is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ FairEmail is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FairEmail. If not, see .
+
+ Copyright 2018-2022 by Marcel Bokhorst (M66B)
+*/
+
+import android.content.Context;
+import android.net.Uri;
+import android.os.Bundle;
+
+import androidx.fragment.app.FragmentManager;
+import androidx.lifecycle.LifecycleOwner;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+public class Check {
+ static final String URI_PRIVACY = "https://support.virustotal.com/hc/en-us/articles/115002168385-Privacy-Policy";
+ private static final String URI_VIRUS_TOTAL = "https://www.virustotal.com/";
+
+ static void virus(Context context, LifecycleOwner owner, FragmentManager fm, long id) {
+ Bundle args = new Bundle();
+ args.putLong("id", id);
+
+ new SimpleTask() {
+ @Override
+ protected String onExecute(Context context, Bundle args) throws Throwable {
+ long id = args.getLong("id");
+
+ DB db = DB.getInstance(context);
+ EntityAttachment attachment = db.attachment().getAttachment(id);
+ if (attachment == null)
+ return null;
+
+ try (InputStream is = new FileInputStream(attachment.getFile(context))) {
+ return Helper.getHash(is, "SHA-256");
+ }
+ }
+
+ @Override
+ protected void onExecuted(Bundle args, String hash) {
+ if (hash == null)
+ return;
+
+ Uri uri = Uri.parse(URI_VIRUS_TOTAL + "gui/file/" + hash);
+ Helper.view(context, uri, false);
+ }
+
+ @Override
+ protected void onException(Bundle args, Throwable ex) {
+ Log.unexpectedError(fm, ex);
+ }
+ }.execute(context, owner, args, "attachment:scan");
+ }
+}
diff --git a/app/src/main/java/eu/faircode/email/AdapterAttachment.java b/app/src/main/java/eu/faircode/email/AdapterAttachment.java
index 49af22299b..0931b26133 100644
--- a/app/src/main/java/eu/faircode/email/AdapterAttachment.java
+++ b/app/src/main/java/eu/faircode/email/AdapterAttachment.java
@@ -48,11 +48,7 @@ import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListUpdateCallback;
import androidx.recyclerview.widget.RecyclerView;
-import java.io.BufferedInputStream;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -68,6 +64,7 @@ public class AdapterAttachment extends RecyclerView.Adapter() {
- @Override
- protected String onExecute(Context context, Bundle args) throws Throwable {
- long id = args.getLong("id");
-
- DB db = DB.getInstance(context);
- EntityAttachment attachment = db.attachment().getAttachment(id);
- if (attachment == null)
- return null;
-
- MessageDigest digest = MessageDigest.getInstance("SHA-256");
-
- try (InputStream is = new BufferedInputStream(new FileInputStream(attachment.getFile(context)))) {
- int count;
- byte[] buffer = new byte[1024];
- while ((count = is.read(buffer)) != -1)
- digest.update(buffer, 0, count);
- }
-
- return Helper.hex(digest.digest());
- }
-
- @Override
- protected void onExecuted(Bundle args, String hash) {
- if (hash == null)
- return;
-
- Uri uri = Uri.parse(Helper.URI_VIRUS_TOTAL + "gui/file/" + hash);
- Helper.view(context, uri, false);
- }
-
- @Override
- protected void onException(Bundle args, Throwable ex) {
- Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
- }
- }.execute(context, owner, args, "attachment:scan");
- }
-
private void onShare(EntityAttachment attachment) {
String title = (attachment.name == null ? attachment.cid : attachment.name);
Helper.share(context, attachment.getFile(context), attachment.getMimeType(), title);
@@ -422,6 +380,7 @@ public class AdapterAttachment extends RecyclerView.Adapter
+
+
+ app:layout_constraintTop_toBottomOf="@id/swVirusTotal" />
+
+
+
+
System
LanguageTool integration
DeepL integration
+ VirusTotal integration
I want to use an sdcard
Periodically check if FairEmail is still active
Check for GitHub updates
@@ -1840,7 +1841,6 @@
Synchronization state
Download state
Save
- Scan
Delete
Count
Folder type