mirror of https://github.com/M66B/FairEmail.git
Cleanup
This commit is contained in:
parent
f8b15e2d24
commit
a0ffa726d4
|
@ -701,7 +701,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
if (ex instanceof ProtocolException) {
|
||||
Response r = ((ProtocolException) ex).getResponse();
|
||||
if (r != null && !TextUtils.isEmpty(r.getRest()))
|
||||
return r.getRest(); // TODO CASA ?
|
||||
return r.getRest();
|
||||
}
|
||||
|
||||
return new ThrowableWrapper(ex).toSafeString();
|
||||
|
|
|
@ -142,19 +142,6 @@ public abstract class DB extends RoomDatabase {
|
|||
"compile_options"
|
||||
));
|
||||
|
||||
static {
|
||||
System.loadLibrary("fairemail");
|
||||
}
|
||||
|
||||
public static native Cursor jni_safe_support_query(
|
||||
SupportSQLiteDatabase db, String sql, Object[] args);
|
||||
|
||||
public static native Cursor jni_safe_sqlite_query(
|
||||
SQLiteDatabase db, String table, String[] columns,
|
||||
String selection, String[] selectionArgs,
|
||||
String groupBy, String having,
|
||||
String orderBy, String limit);
|
||||
|
||||
@Override
|
||||
public void init(@NonNull DatabaseConfiguration configuration) {
|
||||
File dbfile = configuration.context.getDatabasePath(DB_NAME);
|
||||
|
@ -495,7 +482,7 @@ public abstract class DB extends RoomDatabase {
|
|||
cache_size = -cache_size; // kibibytes
|
||||
Log.i("Set PRAGMA cache_size=" + cache_size);
|
||||
// TODO CASA
|
||||
try (Cursor cursor = jni_safe_support_query(db, "PRAGMA cache_size=" + cache_size + ";", new Object[0])) {
|
||||
try (Cursor cursor = db.query("PRAGMA cache_size=" + cache_size + ";")) {
|
||||
cursor.moveToNext(); // required
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +503,7 @@ public abstract class DB extends RoomDatabase {
|
|||
for (String pragma : DB_PRAGMAS)
|
||||
if (!"compile_options".equals(pragma) || BuildConfig.DEBUG) {
|
||||
// TODO CASA
|
||||
try (Cursor cursor = jni_safe_support_query(db, "PRAGMA " + pragma + ";", new Object[0])) {
|
||||
try (Cursor cursor = db.query("PRAGMA " + pragma + ";")) {
|
||||
boolean has = false;
|
||||
while (cursor.moveToNext()) {
|
||||
has = true;
|
||||
|
|
|
@ -92,8 +92,6 @@ import javax.net.ssl.SSLHandshakeException;
|
|||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
// IMAP standards: https://imapwiki.org/Specs
|
||||
|
||||
|
|
|
@ -22,12 +22,10 @@ package eu.faircode.email;
|
|||
import static androidx.room.ForeignKey.CASCADE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.ForeignKey;
|
||||
import androidx.room.Ignore;
|
||||
|
|
|
@ -621,7 +621,7 @@ public class EntityMessage implements Serializable {
|
|||
static File getFile(Context context, Long id) {
|
||||
File root = Helper.ensureExists(context, "messages");
|
||||
File dir = new File(root, "D" + (id / 1000));
|
||||
dir.mkdir();
|
||||
dir.mkdir(); // TODO CASA
|
||||
return new File(dir, id.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebViewClient;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.UriPermission;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PermissionGroupInfo;
|
||||
import android.content.pm.PermissionInfo;
|
||||
|
@ -44,7 +43,6 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.text.Editable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
|
@ -84,7 +82,6 @@ import androidx.work.WorkManager;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
|
|
|
@ -241,7 +241,7 @@ public class Fts4DbHelper extends SQLiteOpenHelper {
|
|||
" query=" + query);
|
||||
List<Long> result = new ArrayList<>();
|
||||
// TODO CASA
|
||||
try (Cursor cursor = DB.jni_safe_sqlite_query(db,
|
||||
try (Cursor cursor = db.query(
|
||||
"message", new String[]{"rowid"},
|
||||
select,
|
||||
args.toArray(new String[0]),
|
||||
|
|
|
@ -241,7 +241,7 @@ public class Fts5DbHelper extends SQLiteOpenHelper {
|
|||
" query=" + criteria.query);
|
||||
List<Long> result = new ArrayList<>();
|
||||
// TODO CASA
|
||||
try (Cursor cursor = DB.jni_safe_sqlite_query(db,
|
||||
try (Cursor cursor = db.query(
|
||||
"message", new String[]{"rowid"},
|
||||
select,
|
||||
args.toArray(new String[0]),
|
||||
|
|
|
@ -2731,9 +2731,9 @@ public class Helper {
|
|||
}
|
||||
|
||||
static void writeText(File file, String content) throws IOException {
|
||||
// TODO CASA
|
||||
try (FileOutputStream out = new FileOutputStream(file)) {
|
||||
Log.write(out, content);
|
||||
if (content != null)
|
||||
out.write(content.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ import android.os.Bundle;
|
|||
import android.os.DeadObjectException;
|
||||
import android.os.DeadSystemException;
|
||||
import android.os.Debug;
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.os.LocaleList;
|
||||
import android.os.OperationCanceledException;
|
||||
|
@ -243,8 +242,6 @@ public class Log {
|
|||
|
||||
public static native int jni_safe_log(int prio, String tag, String msg);
|
||||
|
||||
public static native void jni_safe_write(OutputStream os, byte[] data);
|
||||
|
||||
public static native long[] jni_safe_runtime_stats();
|
||||
|
||||
public static void setLevel(Context context) {
|
||||
|
@ -1924,9 +1921,8 @@ public class Log {
|
|||
draft.ui_seen = true;
|
||||
draft.id = db.message().insertMessage(draft);
|
||||
|
||||
// TODO CASA
|
||||
File file = draft.getFile(context);
|
||||
Helper.writeText(file, body);
|
||||
Helper.writeText(file, body); // TODO CASA
|
||||
db.message().setMessageContent(draft.id, true, null, 0, null, null);
|
||||
|
||||
attachSettings(context, draft.id, 1);
|
||||
|
@ -3829,9 +3825,9 @@ public class Log {
|
|||
return ssb;
|
||||
}
|
||||
|
||||
static int write(OutputStream os, String text) throws IOException {
|
||||
byte[] bytes = (text == null ? new byte[0] : text.getBytes());
|
||||
jni_safe_write(os, bytes);
|
||||
private static int write(OutputStream os, String text) throws IOException {
|
||||
byte[] bytes = text.getBytes();
|
||||
os.write(bytes); // TODO CASA
|
||||
return bytes.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,10 +39,7 @@ import androidx.work.Worker;
|
|||
import androidx.work.WorkerParameters;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
|
|
@ -65,15 +65,6 @@ Java_eu_faircode_email_ThrowableWrapper_jni_1get_1safe_1stack_1trace_1string(
|
|||
return (jstring) env->CallStaticObjectMethod(cls, mid, ex);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_eu_faircode_email_Log_jni_1safe_1write(JNIEnv *env, jclass clazz,
|
||||
jobject os, jbyteArray data) {
|
||||
jclass cls = env->FindClass("java/io/OutputStream");
|
||||
jmethodID mid = env->GetMethodID(cls, "write", "([B)V");
|
||||
env->CallVoidMethod(os, mid, data);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jlongArray JNICALL
|
||||
Java_eu_faircode_email_Log_jni_1safe_1runtime_1stats(JNIEnv *env, jclass clazz) {
|
||||
|
@ -110,28 +101,6 @@ Java_eu_faircode_email_Log_jni_1safe_1runtime_1stats(JNIEnv *env, jclass clazz)
|
|||
return result;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_eu_faircode_email_DB_jni_1safe_1support_1query(JNIEnv *env, jclass clazz,
|
||||
jobject db,
|
||||
jstring sql, jobjectArray args) {
|
||||
jclass cls = env->FindClass("androidx/sqlite/db/SupportSQLiteDatabase");
|
||||
jmethodID mid = env->GetMethodID(cls, "query", "(Ljava/lang/String;[Ljava/lang/Object;)Landroid/database/Cursor;");
|
||||
return env->CallObjectMethod(db, mid, sql, args);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_eu_faircode_email_DB_jni_1safe_1sqlite_1query(JNIEnv *env, jclass clazz, jobject db,
|
||||
jstring table, jobjectArray columns,
|
||||
jstring selection, jobjectArray selection_args, jstring group_by,
|
||||
jstring having, jstring order_by, jstring limit) {
|
||||
jclass cls = env->FindClass("android/database/sqlite/SQLiteDatabase");
|
||||
jmethodID mid = env->GetMethodID(cls, "query",
|
||||
"(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;");
|
||||
return env->CallObjectMethod(db, mid, table, columns, selection, selection_args, group_by, having, order_by, limit);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_eu_faircode_email_CharsetHelper_jni_1detect_1charset(
|
||||
|
|
Loading…
Reference in New Issue