mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
bug fixes
This commit is contained in:
parent
9fa7bb9c6d
commit
b22611fe21
@ -11,6 +11,7 @@ import com.github.libretube.R
|
||||
import com.github.libretube.adapters.BackupOptionsAdapter
|
||||
import com.github.libretube.databinding.DialogBackupBinding
|
||||
import com.github.libretube.db.DatabaseHolder
|
||||
import com.github.libretube.extensions.await
|
||||
import com.github.libretube.obj.BackupFile
|
||||
import com.github.libretube.util.BackupHelper
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
@ -37,7 +38,7 @@ class BackupDialog() : DialogFragment() {
|
||||
R.string.watch_positions,
|
||||
R.string.search_history,
|
||||
R.string.local_subscriptions,
|
||||
R.string.customInstance
|
||||
R.string.backup_customInstances
|
||||
)
|
||||
|
||||
val selected = mutableListOf(false, false, false, false, false)
|
||||
@ -53,11 +54,28 @@ class BackupDialog() : DialogFragment() {
|
||||
.setView(binding.root)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.backup) { _, _ ->
|
||||
if (selected[0]) backupFile.watchHistory = DatabaseHolder.db.watchHistoryDao().getAll()
|
||||
if (selected[1]) backupFile.watchPositions = DatabaseHolder.db.watchPositionDao().getAll()
|
||||
if (selected[2]) backupFile.searchHistory = DatabaseHolder.db.searchHistoryDao().getAll()
|
||||
if (selected[3]) backupFile.localSubscriptions = DatabaseHolder.db.localSubscriptionDao().getAll()
|
||||
if (selected[4]) backupFile.customInstances = DatabaseHolder.db.customInstanceDao().getAll()
|
||||
Thread {
|
||||
if (selected[0]) {
|
||||
backupFile.watchHistory =
|
||||
DatabaseHolder.db.watchHistoryDao().getAll()
|
||||
}
|
||||
if (selected[1]) {
|
||||
backupFile.watchPositions =
|
||||
DatabaseHolder.db.watchPositionDao().getAll()
|
||||
}
|
||||
if (selected[2]) {
|
||||
backupFile.searchHistory =
|
||||
DatabaseHolder.db.searchHistoryDao().getAll()
|
||||
}
|
||||
if (selected[3]) {
|
||||
backupFile.localSubscriptions =
|
||||
DatabaseHolder.db.localSubscriptionDao().getAll()
|
||||
}
|
||||
if (selected[4]) {
|
||||
backupFile.customInstances =
|
||||
DatabaseHolder.db.customInstanceDao().getAll()
|
||||
}
|
||||
}.await()
|
||||
|
||||
createBackupFile.launch("application/json")
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingHorizontal="30dp"
|
||||
android:paddingVertical="5dp">
|
||||
|
||||
<TextView
|
||||
|
@ -326,6 +326,7 @@
|
||||
<string name="sb_skip_manual_summary">Don\'t skip segments automatically, always prompt before.</string>
|
||||
<string name="local_subscriptions">Local subscriptions</string>
|
||||
<string name="preferences">Preferences</string>
|
||||
<string name="backup_customInstances">Custom Instances</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
Loading…
Reference in New Issue
Block a user