Show error toast if empty URI is passed when trying to create/restore a backup

This commit is contained in:
arkon
2022-01-26 22:31:28 -05:00
parent 1b71e4cee7
commit d5015d37e1
4 changed files with 13 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ abstract class AbstractBackupManager(protected val context: Context) {
internal val trackManager: TrackManager by injectLazy()
protected val preferences: PreferencesHelper by injectLazy()
abstract fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String?
abstract fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String
/**
* Returns manga

View File

@@ -44,7 +44,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
* @param uri path of Uri
* @param isJob backup called from job
*/
override fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String? {
override fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String {
// Create root object
var backup: Backup? = null
@@ -87,7 +87,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
file.openOutputStream().sink().gzip().buffer().use { it.write(byteArray) }
val fileUri = file.uri
// Validate it to make sure it works
// Make sure it's a valid backup file
FullBackupRestoreValidator().validate(context, fileUri)
return fileUri.toString()