Reduced logging

pull/209/head
M66B 2 years ago
parent 373492e51f
commit 0d369bef4f

@ -2481,13 +2481,13 @@ public abstract class DB extends RoomDatabase {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion); logMigration(startVersion, endVersion);
EntityMessage.convert(context); EntityMessage.convert(context, true);
} }
}).addMigrations(new Migration(246, 247) { }).addMigrations(new Migration(246, 247) {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion); logMigration(startVersion, endVersion);
EntityMessage.convert(context); EntityMessage.convert(context, false);
} }
}).addMigrations(new Migration(998, 999) { }).addMigrations(new Migration(998, 999) {
@Override @Override

@ -582,7 +582,7 @@ public class EntityMessage implements Serializable {
return new File(dir, id.toString()); return new File(dir, id.toString());
} }
static void convert(Context context) { static void convert(Context context, boolean silent) {
File root = new File(context.getFilesDir(), "messages"); File root = new File(context.getFilesDir(), "messages");
File[] files = root.listFiles(); File[] files = root.listFiles();
if (files == null) if (files == null)
@ -595,6 +595,9 @@ public class EntityMessage implements Serializable {
Helper.copy(file, target); Helper.copy(file, target);
file.delete(); file.delete();
} catch (Throwable ex) { } catch (Throwable ex) {
if (silent)
Log.i(ex);
else
Log.e(ex); Log.e(ex);
} }
} }

Loading…
Cancel
Save