Removed external attachment storage

This commit is contained in:
M66B
2023-12-12 08:37:59 +01:00
parent 84deb380dd
commit fbf258fa89
11 changed files with 3016 additions and 118 deletions

View File

@@ -172,7 +172,7 @@ public class EntityAttachment {
}
static File getFile(Context context, long id, String name) {
File dir = Helper.ensureExists(new File(getRoot(context), "attachments"));
File dir = Helper.ensureExists(new File(context.getFilesDir(), "attachments"));
String filename = Long.toString(id);
if (!TextUtils.isEmpty(name))
filename += "." + Helper.sanitizeFilename(name);
@@ -181,16 +181,6 @@ public class EntityAttachment {
return new File(dir, filename);
}
static File getRoot(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean external_storage = prefs.getBoolean("external_storage", false);
File root = (external_storage
? Helper.getExternalFilesDir(context)
: context.getFilesDir());
return root;
}
static void copy(Context context, long oldid, long newid) {
DB db = DB.getInstance(context);