Skip to content

Commit f0db2aa

Browse files
committed
Improve documentation
1 parent 2756ef6 commit f0db2aa

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

app/src/main/java/org/schabi/newpipe/settings/BackupRestoreSettingsFragment.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ private void importDatabase(final StoredFileHelper file, final Uri importDataUri
187187
throw new IOException("Could not create databases dir");
188188
}
189189

190+
// replace the current database
190191
if (!manager.extractDb(file)) {
191192
Toast.makeText(requireContext(), R.string.could_not_import_all_files,
192193
Toast.LENGTH_LONG)
@@ -265,7 +266,7 @@ private void cleanImport(@NonNull final Context context,
265266
}
266267

267268
/**
268-
* Save import path and restart system.
269+
* Save import path and restart app.
269270
*
270271
* @param importDataUri The import path to save
271272
*/
@@ -290,6 +291,7 @@ private void saveLastImportExportDataUri(final Uri importExportDataUri) {
290291
private void showErrorSnackbar(final Throwable e, final String request) {
291292
ErrorUtil.showSnackbar(this, new ErrorInfo(e, UserAction.DATABASE_IMPORT_EXPORT, request));
292293
}
294+
293295
private void createErrorNotification(final Throwable e, final String request) {
294296
ErrorUtil.createNotification(
295297
requireContext(),

app/src/main/java/org/schabi/newpipe/settings/export/ImportExportManager.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,17 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
6767
return fileLocator.dbDir.exists() || fileLocator.dbDir.mkdir()
6868
}
6969

70+
/**
71+
* Extracts the database from the given file to the app's database directory.
72+
* The current app's database will be overwritten.
73+
* @param file the .zip file to extract the database from
74+
* @return true if the database was successfully extracted, false otherwise
75+
*/
7076
fun extractDb(file: StoredFileHelper): Boolean {
7177
val success = ZipHelper.extractFileFromZip(
72-
file,
73-
BackupFileLocator.FILE_NAME_DB,
74-
fileLocator.db.path,
78+
file,
79+
BackupFileLocator.FILE_NAME_DB,
80+
fileLocator.db.path,
7581
)
7682

7783
if (success) {

0 commit comments

Comments
 (0)