Merge pull request #1510 from karyogamy/lib-update

Library version update and database backup fix
This commit is contained in:
Christian Schabesberger 2018-06-28 12:16:04 +02:00 committed by GitHub
commit f563bc4210
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 9 deletions

View file

@ -43,9 +43,9 @@ android {
ext { ext {
supportLibVersion = '27.1.1' supportLibVersion = '27.1.1'
exoPlayerLibVersion = '2.7.3' exoPlayerLibVersion = '2.7.3'
roomDbLibVersion = '1.0.0' roomDbLibVersion = '1.1.1'
leakCanaryLibVersion = '1.5.4' leakCanaryLibVersion = '1.5.4'
okHttpLibVersion = '1.5.0' okHttpLibVersion = '3.10.0'
icepickLibVersion = '3.2.0' icepickLibVersion = '3.2.0'
stethoLibVersion = '1.5.0' stethoLibVersion = '1.5.0'
} }
@ -57,7 +57,7 @@ dependencies {
implementation 'com.github.TeamNewPipe:NewPipeExtractor:bf1c771' implementation 'com.github.TeamNewPipe:NewPipeExtractor:bf1c771'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19' testImplementation 'org.mockito:mockito-core:2.8.9'
implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation "com.android.support:support-v4:$supportLibVersion" implementation "com.android.support:support-v4:$supportLibVersion"
@ -79,7 +79,7 @@ dependencies {
debugImplementation "com.facebook.stetho:stetho-urlconnection:$stethoLibVersion" debugImplementation "com.facebook.stetho:stetho-urlconnection:$stethoLibVersion"
debugImplementation 'com.android.support:multidex:1.0.3' debugImplementation 'com.android.support:multidex:1.0.3'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10' implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1' implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
@ -93,6 +93,6 @@ dependencies {
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryLibVersion" debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryLibVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryLibVersion" releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryLibVersion"
implementation 'com.squareup.okhttp3:okhttp:3.9.1' implementation "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
debugImplementation "com.facebook.stetho:stetho-okhttp3:$okHttpLibVersion" debugImplementation "com.facebook.stetho:stetho-okhttp3:$stethoLibVersion"
} }

View file

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