1
0
mirror of https://github.com/TeamNewPipe/NewPipe/ synced 2024-12-24 16:11:07 +01:00

-Updated room db to 1.1.1.

-Fixed database import/export to no longer include accessory db files to ensure backward compatibility.
This commit is contained in:
John Zhen Mo 2018-06-26 12:25:53 -07:00
parent fb1a290bd9
commit 27131d15dd
2 changed files with 16 additions and 4 deletions

View File

@ -43,7 +43,7 @@ android {
ext {
supportLibVersion = '27.1.1'
exoPlayerLibVersion = '2.7.3'
roomDbLibVersion = '1.0.0'
roomDbLibVersion = '1.1.1'
leakCanaryLibVersion = '1.5.4'
okHttpLibVersion = '3.10.0'
icepickLibVersion = '3.2.0'

View File

@ -56,6 +56,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
private File databasesDir;
private File newpipe_db;
private File newpipe_db_journal;
private File newpipe_db_shm;
private File newpipe_db_wal;
private File newpipe_settings;
private String thumbnailLoadToggleKey;
@ -88,6 +90,9 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
databasesDir = new File(homeDir + "/databases");
newpipe_db = new File(homeDir + "/databases/newpipe.db");
newpipe_db_journal = new File(homeDir + "/databases/newpipe.db-journal");
newpipe_db_shm = new File(homeDir + "/databases/newpipe.db-shm");
newpipe_db_wal = new File(homeDir + "/databases/newpipe.db-wal");
newpipe_settings = new File(homeDir + "/databases/newpipe.settings");
newpipe_settings.delete();
@ -207,7 +212,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
new BufferedOutputStream(
new FileOutputStream(path)));
ZipHelper.addFileToZip(outZip, newpipe_db.getPath(), "newpipe.db");
ZipHelper.addFileToZip(outZip, newpipe_db_journal.getPath(), "newpipe.db-journal");
saveSharedPreferencesToFile(newpipe_settings);
ZipHelper.addFileToZip(outZip, newpipe_settings.getPath(), "newpipe.settings");
@ -263,8 +268,15 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
throw new Exception("Could not create databases dir");
}
if(!(ZipHelper.extractFileFromZip(filePath, newpipe_db.getPath(), "newpipe.db")
&& ZipHelper.extractFileFromZip(filePath, newpipe_db_journal.getPath(), "newpipe.db-journal"))) {
final boolean isDbFileExtracted = ZipHelper.extractFileFromZip(filePath,
newpipe_db.getPath(), "newpipe.db");
if (isDbFileExtracted) {
newpipe_db_journal.delete();
newpipe_db_wal.delete();
newpipe_db_shm.delete();
} else {
Toast.makeText(getContext(), R.string.could_not_import_all_files, Toast.LENGTH_LONG)
.show();
}