mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-24 20:15:16 +01:00
Improve documentation
This commit is contained in:
parent
2756ef6d2f
commit
f0db2aa43c
@ -187,6 +187,7 @@ public class BackupRestoreSettingsFragment extends BasePreferenceFragment {
|
||||
throw new IOException("Could not create databases dir");
|
||||
}
|
||||
|
||||
// replace the current database
|
||||
if (!manager.extractDb(file)) {
|
||||
Toast.makeText(requireContext(), R.string.could_not_import_all_files,
|
||||
Toast.LENGTH_LONG)
|
||||
@ -265,7 +266,7 @@ public class BackupRestoreSettingsFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
/**
|
||||
* Save import path and restart system.
|
||||
* Save import path and restart app.
|
||||
*
|
||||
* @param importDataUri The import path to save
|
||||
*/
|
||||
@ -290,6 +291,7 @@ public class BackupRestoreSettingsFragment extends BasePreferenceFragment {
|
||||
private void showErrorSnackbar(final Throwable e, final String request) {
|
||||
ErrorUtil.showSnackbar(this, new ErrorInfo(e, UserAction.DATABASE_IMPORT_EXPORT, request));
|
||||
}
|
||||
|
||||
private void createErrorNotification(final Throwable e, final String request) {
|
||||
ErrorUtil.createNotification(
|
||||
requireContext(),
|
||||
|
@ -67,11 +67,17 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
|
||||
return fileLocator.dbDir.exists() || fileLocator.dbDir.mkdir()
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the database from the given file to the app's database directory.
|
||||
* The current app's database will be overwritten.
|
||||
* @param file the .zip file to extract the database from
|
||||
* @return true if the database was successfully extracted, false otherwise
|
||||
*/
|
||||
fun extractDb(file: StoredFileHelper): Boolean {
|
||||
val success = ZipHelper.extractFileFromZip(
|
||||
file,
|
||||
BackupFileLocator.FILE_NAME_DB,
|
||||
fileLocator.db.path,
|
||||
file,
|
||||
BackupFileLocator.FILE_NAME_DB,
|
||||
fileLocator.db.path,
|
||||
)
|
||||
|
||||
if (success) {
|
||||
|
Loading…
Reference in New Issue
Block a user