Removed external message storage

pull/214/head
M66B 2 years ago
parent 739cee03bb
commit 84deb380dd

@ -619,21 +619,11 @@ public class EntityMessage implements Serializable {
} }
static File getFile(Context context, Long id) { static File getFile(Context context, Long id) {
File root = Helper.ensureExists(new File(getRoot(context), "messages")); File root = Helper.ensureExists(new File(context.getFilesDir(), "messages"));
File dir = Helper.ensureExists(new File(root, "D" + (id / 1000))); File dir = Helper.ensureExists(new File(root, "D" + (id / 1000)));
return new File(dir, id.toString()); return new File(dir, id.toString());
} }
static File getRoot(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean external_storage = prefs.getBoolean("external_storage_message", false);
File root = (external_storage
? Helper.getExternalFilesDir(context)
: context.getFilesDir());
return root;
}
static void convert(Context context) { static void convert(Context context) {
File root = new File(context.getFilesDir(), "messages"); File root = new File(context.getFilesDir(), "messages");
List<File> files = Helper.listFiles(root); List<File> files = Helper.listFiles(root);

@ -1094,8 +1094,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("external_storage", isChecked); editor.putBoolean("external_storage", isChecked);
if (BuildConfig.DEBUG)
editor.putBoolean("external_storage_message", isChecked);
editor.apply(); editor.apply();
Bundle args = new Bundle(); Bundle args = new Bundle();

Loading…
Cancel
Save