From 26ec53f654d9c649a20297e13cf80f048e8a21ea Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 18 Sep 2022 12:41:35 +0200 Subject: [PATCH 1/6] codebase for unified backup --- .../adapters/BackupOptionsAdapter.kt | 38 +++++++++++++ .../github/libretube/dialogs/BackupDialog.kt | 49 +++++++++++++++++ .../com/github/libretube/extensions/Query.kt | 5 ++ .../com/github/libretube/obj/BackupFile.kt | 15 ++++++ .../com/github/libretube/util/BackupHelper.kt | 54 +++++++++++++++++++ app/src/main/res/layout/backup_row.xml | 22 ++++++++ app/src/main/res/layout/dialog_backup.xml | 11 ++++ app/src/main/res/values/strings.xml | 2 + 8 files changed, 196 insertions(+) create mode 100644 app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt create mode 100644 app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt create mode 100644 app/src/main/java/com/github/libretube/extensions/Query.kt create mode 100644 app/src/main/java/com/github/libretube/obj/BackupFile.kt create mode 100644 app/src/main/res/layout/backup_row.xml create mode 100644 app/src/main/res/layout/dialog_backup.xml diff --git a/app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt b/app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt new file mode 100644 index 000000000..afae49d93 --- /dev/null +++ b/app/src/main/java/com/github/libretube/adapters/BackupOptionsAdapter.kt @@ -0,0 +1,38 @@ +package com.github.libretube.adapters + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.github.libretube.databinding.BackupRowBinding + +class BackupOptionsAdapter( + private val options: List, + private val onChange: (position: Int, isChecked: Boolean) -> Unit +) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BackupOptionsViewHolder { + val binding = BackupRowBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return BackupOptionsViewHolder(binding) + } + + override fun getItemCount(): Int { + return options.size + } + + override fun onBindViewHolder(holder: BackupOptionsViewHolder, position: Int) { + holder.binding.apply { + title.text = root.context?.getString(options[position]) + switchWidget.setOnCheckedChangeListener { _, isChecked -> + onChange.invoke(position, isChecked) + } + } + } +} + +class BackupOptionsViewHolder( + val binding: BackupRowBinding +) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt new file mode 100644 index 000000000..48dd885b0 --- /dev/null +++ b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt @@ -0,0 +1,49 @@ +package com.github.libretube.dialogs + +import android.app.Dialog +import android.os.Bundle +import androidx.fragment.app.DialogFragment +import androidx.recyclerview.widget.LinearLayoutManager +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.obj.BackupFile +import com.google.android.material.dialog.MaterialAlertDialogBuilder + +class BackupDialog() : DialogFragment() { + private lateinit var binding: DialogBackupBinding + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val backupOptions = listOf( + R.string.watch_history, + R.string.watch_positions, + R.string.search_history, + R.string.local_subscriptions, + R.string.customInstance + ) + + val selected = mutableListOf(false, false, false, false, false) + + val backupFile = BackupFile() + + binding = DialogBackupBinding.inflate(layoutInflater) + binding.backupOptionsRecycler.layoutManager = LinearLayoutManager(context) + binding.backupOptionsRecycler.adapter = BackupOptionsAdapter(backupOptions) { position, isChecked -> + selected[position] = isChecked + } + + return MaterialAlertDialogBuilder(requireContext()) + .setTitle(R.string.backup) + .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() + } + .create() + } +} diff --git a/app/src/main/java/com/github/libretube/extensions/Query.kt b/app/src/main/java/com/github/libretube/extensions/Query.kt new file mode 100644 index 000000000..3cc5a81ff --- /dev/null +++ b/app/src/main/java/com/github/libretube/extensions/Query.kt @@ -0,0 +1,5 @@ +package com.github.libretube.extensions + +fun query(block: () -> Unit) { + Thread(block).start() +} diff --git a/app/src/main/java/com/github/libretube/obj/BackupFile.kt b/app/src/main/java/com/github/libretube/obj/BackupFile.kt new file mode 100644 index 000000000..3ab5320ce --- /dev/null +++ b/app/src/main/java/com/github/libretube/obj/BackupFile.kt @@ -0,0 +1,15 @@ +package com.github.libretube.obj + +import com.github.libretube.db.obj.CustomInstance +import com.github.libretube.db.obj.LocalSubscription +import com.github.libretube.db.obj.SearchHistoryItem +import com.github.libretube.db.obj.WatchHistoryItem +import com.github.libretube.db.obj.WatchPosition + +data class BackupFile( + var watchHistory: List? = null, + var watchPositions: List? = null, + var searchHistory: List? = null, + var localSubscriptions: List? = null, + var customInstances: List? = null +) diff --git a/app/src/main/java/com/github/libretube/util/BackupHelper.kt b/app/src/main/java/com/github/libretube/util/BackupHelper.kt index 97db72faa..9b002297d 100644 --- a/app/src/main/java/com/github/libretube/util/BackupHelper.kt +++ b/app/src/main/java/com/github/libretube/util/BackupHelper.kt @@ -4,6 +4,10 @@ import android.content.Context import android.net.Uri import androidx.core.content.edit import androidx.preference.PreferenceManager +import com.fasterxml.jackson.databind.ObjectMapper +import com.github.libretube.db.DatabaseHolder +import com.github.libretube.extensions.query +import com.github.libretube.obj.BackupFile import java.io.FileInputStream import java.io.FileOutputStream import java.io.ObjectInputStream @@ -64,4 +68,54 @@ class BackupHelper(private val context: Context) { e.printStackTrace() } } + + /** + * Backup the database + */ + fun advancedBackup(uri: Uri?, backupFile: BackupFile) { + if (uri == null) return + try { + context.contentResolver.openFileDescriptor(uri, "w")?.use { + FileOutputStream(it.fileDescriptor).use { fileOutputStream -> + fileOutputStream.write( + ObjectMapper().writeValueAsBytes(backupFile) + ) + } + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + /** + * Restore a database backup + */ + fun restoreAdvancedBackup(uri: Uri?) { + if (uri == null) return + + val mapper = ObjectMapper() + val json = context.contentResolver.openInputStream(uri)?.use { + it.bufferedReader().use { reader -> reader.readText() } + }.orEmpty() + + val backupFile = mapper.readValue(json, BackupFile::class.java) + + query { + DatabaseHolder.db.watchHistoryDao().insertAll( + *backupFile.watchHistory?.toTypedArray().orEmpty() + ) + DatabaseHolder.db.searchHistoryDao().insertAll( + *backupFile.searchHistory?.toTypedArray().orEmpty() + ) + DatabaseHolder.db.watchPositionDao().insertAll( + *backupFile.watchPositions?.toTypedArray().orEmpty() + ) + DatabaseHolder.db.localSubscriptionDao().insertAll( + *backupFile.localSubscriptions?.toTypedArray().orEmpty() + ) + DatabaseHolder.db.customInstanceDao().insertAll( + *backupFile.customInstances?.toTypedArray().orEmpty() + ) + } + } } diff --git a/app/src/main/res/layout/backup_row.xml b/app/src/main/res/layout/backup_row.xml new file mode 100644 index 000000000..503d0a923 --- /dev/null +++ b/app/src/main/res/layout/backup_row.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_backup.xml b/app/src/main/res/layout/dialog_backup.xml new file mode 100644 index 000000000..5b4fe20df --- /dev/null +++ b/app/src/main/res/layout/dialog_backup.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0f38bb167..c0bea1be9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -324,6 +324,8 @@ Skip segment Skip manually Don\'t skip segments automatically, always prompt before. + Local subscriptions + Preferences Download Service From 9fa7bb9c6da228075bae733bcc5c602eb1caac66 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 18 Sep 2022 12:49:57 +0200 Subject: [PATCH 2/6] add settings entry --- .../github/libretube/dialogs/BackupDialog.kt | 21 +++++++++- .../libretube/preferences/AdvancedSettings.kt | 40 ++++++++++++++----- app/src/main/res/xml/advanced_settings.xml | 16 +++++++- 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt index 48dd885b0..1dcabc176 100644 --- a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt @@ -1,7 +1,10 @@ package com.github.libretube.dialogs import android.app.Dialog +import android.net.Uri import android.os.Bundle +import androidx.activity.result.ActivityResultLauncher +import androidx.activity.result.contract.ActivityResultContracts import androidx.fragment.app.DialogFragment import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.R @@ -9,10 +12,24 @@ import com.github.libretube.adapters.BackupOptionsAdapter import com.github.libretube.databinding.DialogBackupBinding import com.github.libretube.db.DatabaseHolder import com.github.libretube.obj.BackupFile +import com.github.libretube.util.BackupHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class BackupDialog() : DialogFragment() { private lateinit var binding: DialogBackupBinding + private lateinit var createBackupFile: ActivityResultLauncher + + val backupFile = BackupFile() + + override fun onCreate(savedInstanceState: Bundle?) { + createBackupFile = registerForActivityResult( + ActivityResultContracts.CreateDocument("application/json") + ) { uri: Uri? -> + BackupHelper(requireContext()).advancedBackup(uri, backupFile) + } + + super.onCreate(savedInstanceState) + } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val backupOptions = listOf( @@ -25,8 +42,6 @@ class BackupDialog() : DialogFragment() { val selected = mutableListOf(false, false, false, false, false) - val backupFile = BackupFile() - binding = DialogBackupBinding.inflate(layoutInflater) binding.backupOptionsRecycler.layoutManager = LinearLayoutManager(context) binding.backupOptionsRecycler.adapter = BackupOptionsAdapter(backupOptions) { position, isChecked -> @@ -43,6 +58,8 @@ class BackupDialog() : DialogFragment() { 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() + + createBackupFile.launch("application/json") } .create() } diff --git a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt index 1b17b4894..91f0745b7 100644 --- a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt @@ -10,6 +10,7 @@ import androidx.preference.Preference import com.github.libretube.R import com.github.libretube.activities.SettingsActivity import com.github.libretube.constants.PreferenceKeys +import com.github.libretube.dialogs.BackupDialog import com.github.libretube.util.BackupHelper import com.github.libretube.util.ImageHelper import com.github.libretube.util.PreferenceHelper @@ -18,24 +19,32 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder class AdvancedSettings : MaterialPreferenceFragment() { - /** - * result listeners for importing and exporting subscriptions - */ - private lateinit var getContent: ActivityResultLauncher - private lateinit var createFile: ActivityResultLauncher + // backup and restore prefs + private lateinit var getPrefFile: ActivityResultLauncher + private lateinit var createPrefFile: ActivityResultLauncher + + // backup and restore database + private lateinit var getBackupFile: ActivityResultLauncher override fun onCreate(savedInstanceState: Bundle?) { - getContent = + getPrefFile = registerForActivityResult( ActivityResultContracts.GetContent() ) { uri: Uri? -> BackupHelper(requireContext()).restoreSharedPreferences(uri) } - createFile = registerForActivityResult( + createPrefFile = registerForActivityResult( CreateDocument("application/json") ) { uri: Uri? -> BackupHelper(requireContext()).backupSharedPreferences(uri) } + + getBackupFile = + registerForActivityResult( + ActivityResultContracts.GetContent() + ) { uri: Uri? -> + BackupHelper(requireContext()).restoreAdvancedBackup(uri) + } super.onCreate(savedInstanceState) } @@ -59,18 +68,31 @@ class AdvancedSettings : MaterialPreferenceFragment() { val backupSettings = findPreference(PreferenceKeys.BACKUP_SETTINGS) backupSettings?.setOnPreferenceClickListener { - createFile.launch("preferences.xml") + createPrefFile.launch("preferences.xml") true } val restoreSettings = findPreference(PreferenceKeys.RESTORE_SETTINGS) restoreSettings?.setOnPreferenceClickListener { - getContent.launch("*/*") + getPrefFile.launch("*/*") // reset the token PreferenceHelper.setToken("") activity?.recreate() true } + + val advancesBackup = findPreference("backup") + advancesBackup?.setOnPreferenceClickListener { + BackupDialog() + .show(childFragmentManager, null) + true + } + + val restoreAdvancedBackup = findPreference("restore") + restoreAdvancedBackup?.setOnPreferenceClickListener { + getBackupFile.launch("application/json") + true + } } private fun showResetDialog() { diff --git a/app/src/main/res/xml/advanced_settings.xml b/app/src/main/res/xml/advanced_settings.xml index bd0bc574e..a596e7237 100644 --- a/app/src/main/res/xml/advanced_settings.xml +++ b/app/src/main/res/xml/advanced_settings.xml @@ -32,7 +32,7 @@ - + + + + + + + + + \ No newline at end of file From b22611fe2187215c87d952ce6138800f911a4eeb Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 18 Sep 2022 13:03:48 +0200 Subject: [PATCH 3/6] bug fixes --- .../github/libretube/dialogs/BackupDialog.kt | 30 +++++++++++++++---- app/src/main/res/layout/backup_row.xml | 4 +-- app/src/main/res/values/strings.xml | 1 + 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt index 1dcabc176..be5633e97 100644 --- a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt @@ -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") } diff --git a/app/src/main/res/layout/backup_row.xml b/app/src/main/res/layout/backup_row.xml index 503d0a923..340927967 100644 --- a/app/src/main/res/layout/backup_row.xml +++ b/app/src/main/res/layout/backup_row.xml @@ -1,9 +1,9 @@ Don\'t skip segments automatically, always prompt before. Local subscriptions Preferences + Custom Instances Download Service From 60f2741b7d3f8232363bc24df1ec6380b0df36da Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 18 Sep 2022 16:09:49 +0200 Subject: [PATCH 4/6] fix default file name --- app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt index be5633e97..7526978dd 100644 --- a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt @@ -77,7 +77,7 @@ class BackupDialog() : DialogFragment() { } }.await() - createBackupFile.launch("application/json") + createBackupFile.launch("libretube_backup.json") } .create() } From 07a4838e6fbf02e91619585b894aef63f33e2dba Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 18 Sep 2022 16:56:34 +0200 Subject: [PATCH 5/6] fix lifecycle issue --- .../github/libretube/dialogs/BackupDialog.kt | 20 ++++--------------- .../libretube/preferences/AdvancedSettings.kt | 15 +++++++++++++- .../com/github/libretube/util/BackupHelper.kt | 2 ++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt index 7526978dd..0afff84d4 100644 --- a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt @@ -1,10 +1,8 @@ package com.github.libretube.dialogs import android.app.Dialog -import android.net.Uri import android.os.Bundle import androidx.activity.result.ActivityResultLauncher -import androidx.activity.result.contract.ActivityResultContracts import androidx.fragment.app.DialogFragment import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.R @@ -13,25 +11,15 @@ 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 -class BackupDialog() : DialogFragment() { +class BackupDialog( + private val createBackupFile: (BackupFile) -> Unit +) : DialogFragment() { private lateinit var binding: DialogBackupBinding - private lateinit var createBackupFile: ActivityResultLauncher val backupFile = BackupFile() - override fun onCreate(savedInstanceState: Bundle?) { - createBackupFile = registerForActivityResult( - ActivityResultContracts.CreateDocument("application/json") - ) { uri: Uri? -> - BackupHelper(requireContext()).advancedBackup(uri, backupFile) - } - - super.onCreate(savedInstanceState) - } - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val backupOptions = listOf( R.string.watch_history, @@ -77,7 +65,7 @@ class BackupDialog() : DialogFragment() { } }.await() - createBackupFile.launch("libretube_backup.json") + createBackupFile(backupFile) } .create() } diff --git a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt index 91f0745b7..376e6a5f1 100644 --- a/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt @@ -11,6 +11,7 @@ import com.github.libretube.R import com.github.libretube.activities.SettingsActivity import com.github.libretube.constants.PreferenceKeys import com.github.libretube.dialogs.BackupDialog +import com.github.libretube.obj.BackupFile import com.github.libretube.util.BackupHelper import com.github.libretube.util.ImageHelper import com.github.libretube.util.PreferenceHelper @@ -25,6 +26,8 @@ class AdvancedSettings : MaterialPreferenceFragment() { // backup and restore database private lateinit var getBackupFile: ActivityResultLauncher + private lateinit var createBackupFile: ActivityResultLauncher + private var backupFile = BackupFile() override fun onCreate(savedInstanceState: Bundle?) { getPrefFile = @@ -45,6 +48,13 @@ class AdvancedSettings : MaterialPreferenceFragment() { ) { uri: Uri? -> BackupHelper(requireContext()).restoreAdvancedBackup(uri) } + + createBackupFile = registerForActivityResult( + CreateDocument("application/json") + ) { uri: Uri? -> + BackupHelper(requireContext()).advancedBackup(uri, backupFile) + } + super.onCreate(savedInstanceState) } @@ -83,7 +93,10 @@ class AdvancedSettings : MaterialPreferenceFragment() { val advancesBackup = findPreference("backup") advancesBackup?.setOnPreferenceClickListener { - BackupDialog() + BackupDialog { + backupFile = it + createBackupFile.launch("backup.json") + } .show(childFragmentManager, null) true } diff --git a/app/src/main/java/com/github/libretube/util/BackupHelper.kt b/app/src/main/java/com/github/libretube/util/BackupHelper.kt index 9b002297d..dea6de0a6 100644 --- a/app/src/main/java/com/github/libretube/util/BackupHelper.kt +++ b/app/src/main/java/com/github/libretube/util/BackupHelper.kt @@ -2,10 +2,12 @@ package com.github.libretube.util import android.content.Context import android.net.Uri +import android.util.Log import androidx.core.content.edit import androidx.preference.PreferenceManager import com.fasterxml.jackson.databind.ObjectMapper import com.github.libretube.db.DatabaseHolder +import com.github.libretube.extensions.TAG import com.github.libretube.extensions.query import com.github.libretube.obj.BackupFile import java.io.FileInputStream From 0e24a0981b13c320ccb16c9652e461d75e566040 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 18 Sep 2022 16:58:06 +0200 Subject: [PATCH 6/6] ktlint --- app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt | 1 - app/src/main/java/com/github/libretube/util/BackupHelper.kt | 2 -- 2 files changed, 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt index 0afff84d4..68a22686c 100644 --- a/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/dialogs/BackupDialog.kt @@ -2,7 +2,6 @@ package com.github.libretube.dialogs import android.app.Dialog import android.os.Bundle -import androidx.activity.result.ActivityResultLauncher import androidx.fragment.app.DialogFragment import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.R diff --git a/app/src/main/java/com/github/libretube/util/BackupHelper.kt b/app/src/main/java/com/github/libretube/util/BackupHelper.kt index dea6de0a6..9b002297d 100644 --- a/app/src/main/java/com/github/libretube/util/BackupHelper.kt +++ b/app/src/main/java/com/github/libretube/util/BackupHelper.kt @@ -2,12 +2,10 @@ package com.github.libretube.util import android.content.Context import android.net.Uri -import android.util.Log import androidx.core.content.edit import androidx.preference.PreferenceManager import com.fasterxml.jackson.databind.ObjectMapper import com.github.libretube.db.DatabaseHolder -import com.github.libretube.extensions.TAG import com.github.libretube.extensions.query import com.github.libretube.obj.BackupFile import java.io.FileInputStream