diff --git a/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt index 3480a7f25..6835dd7f5 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/AdvancedSettings.kt @@ -17,6 +17,8 @@ import com.github.libretube.util.BackupHelper import com.github.libretube.util.ImageHelper import com.github.libretube.util.PreferenceHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder +import java.time.LocalDate +import java.time.LocalTime class AdvancedSettings : BasePreferenceFragment() { @@ -64,7 +66,7 @@ class AdvancedSettings : BasePreferenceFragment() { advancesBackup?.setOnPreferenceClickListener { BackupDialog { backupFile = it - createBackupFile.launch("backup.json") + createBackupFile.launch(getBackupFileName()) } .show(childFragmentManager, null) true @@ -93,4 +95,9 @@ class AdvancedSettings : BasePreferenceFragment() { } .show() } + + private fun getBackupFileName(): String { + val time = LocalTime.now().toString().split(".").firstOrNull() + return "libretube-backup-${LocalDate.now()}-$time.json" + } }