better backup title

This commit is contained in:
Bnyro 2022-11-05 14:48:18 +01:00
parent 8046ba97db
commit 7704b8f40b

View File

@ -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"
}
}