Allow disabling pull-to-sync operation (#1922)
This commit is contained in:
parent
8550bede22
commit
5f4bc7fafd
4 changed files with 16 additions and 0 deletions
|
@ -29,6 +29,7 @@ import dev.msfjarvis.aps.R
|
||||||
import dev.msfjarvis.aps.data.password.PasswordItem
|
import dev.msfjarvis.aps.data.password.PasswordItem
|
||||||
import dev.msfjarvis.aps.data.repo.PasswordRepository
|
import dev.msfjarvis.aps.data.repo.PasswordRepository
|
||||||
import dev.msfjarvis.aps.databinding.PasswordRecyclerViewBinding
|
import dev.msfjarvis.aps.databinding.PasswordRecyclerViewBinding
|
||||||
|
import dev.msfjarvis.aps.injection.prefs.SettingsPreferences
|
||||||
import dev.msfjarvis.aps.ui.adapters.PasswordItemRecyclerAdapter
|
import dev.msfjarvis.aps.ui.adapters.PasswordItemRecyclerAdapter
|
||||||
import dev.msfjarvis.aps.ui.dialogs.BasicBottomSheet
|
import dev.msfjarvis.aps.ui.dialogs.BasicBottomSheet
|
||||||
import dev.msfjarvis.aps.ui.dialogs.ItemCreationBottomSheet
|
import dev.msfjarvis.aps.ui.dialogs.ItemCreationBottomSheet
|
||||||
|
@ -55,6 +56,7 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) {
|
||||||
|
|
||||||
@Inject lateinit var gitSettings: GitSettings
|
@Inject lateinit var gitSettings: GitSettings
|
||||||
@Inject lateinit var shortcutHandler: ShortcutHandler
|
@Inject lateinit var shortcutHandler: ShortcutHandler
|
||||||
|
@Inject @SettingsPreferences lateinit var prefs: SharedPreferences
|
||||||
private lateinit var recyclerAdapter: PasswordItemRecyclerAdapter
|
private lateinit var recyclerAdapter: PasswordItemRecyclerAdapter
|
||||||
private lateinit var listener: OnFragmentInteractionListener
|
private lateinit var listener: OnFragmentInteractionListener
|
||||||
private lateinit var settings: SharedPreferences
|
private lateinit var settings: SharedPreferences
|
||||||
|
@ -290,6 +292,11 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
binding.swipeRefresher.isEnabled = !prefs.getBoolean(PreferenceKeys.DISABLE_SYNC_ACTION, false)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
runCatching {
|
runCatching {
|
||||||
|
|
|
@ -42,6 +42,12 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
|
||||||
titleRes = R.string.pref_sort_order_title
|
titleRes = R.string.pref_sort_order_title
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkBox(PreferenceKeys.DISABLE_SYNC_ACTION) {
|
||||||
|
titleRes = R.string.pref_disable_sync_on_pull_title
|
||||||
|
summaryRes = R.string.pref_disable_sync_on_pull_summary
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
|
|
||||||
checkBox(PreferenceKeys.FILTER_RECURSIVELY) {
|
checkBox(PreferenceKeys.FILTER_RECURSIVELY) {
|
||||||
titleRes = R.string.pref_recursive_filter_title
|
titleRes = R.string.pref_recursive_filter_title
|
||||||
summaryRes = R.string.pref_recursive_filter_summary
|
summaryRes = R.string.pref_recursive_filter_summary
|
||||||
|
|
|
@ -84,4 +84,5 @@ object PreferenceKeys {
|
||||||
|
|
||||||
const val DICEWARE_SEPARATOR = "diceware_separator"
|
const val DICEWARE_SEPARATOR = "diceware_separator"
|
||||||
const val DICEWARE_LENGTH = "diceware_length"
|
const val DICEWARE_LENGTH = "diceware_length"
|
||||||
|
const val DISABLE_SYNC_ACTION = "disable_sync_action"
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,8 @@
|
||||||
<string name="pref_rebase_on_pull_title">Rebase on pull</string>
|
<string name="pref_rebase_on_pull_title">Rebase on pull</string>
|
||||||
<string name="pref_rebase_on_pull_summary">When pulling or syncing, create a merge commit with upstream changes</string>
|
<string name="pref_rebase_on_pull_summary">When pulling or syncing, create a merge commit with upstream changes</string>
|
||||||
<string name="pref_rebase_on_pull_summary_on">When pulling or syncing, rebase commits that are not present in the remote repository</string>
|
<string name="pref_rebase_on_pull_summary_on">When pulling or syncing, rebase commits that are not present in the remote repository</string>
|
||||||
|
<string name="pref_disable_sync_on_pull_title">Disable pull to sync action</string>
|
||||||
|
<string name="pref_disable_sync_on_pull_summary">Prevent pulling down on the password list from triggering a Git sync</string>
|
||||||
|
|
||||||
<!-- PasswordGenerator fragment -->
|
<!-- PasswordGenerator fragment -->
|
||||||
<string name="pwgen_title">Generate Password</string>
|
<string name="pwgen_title">Generate Password</string>
|
||||||
|
|
Loading…
Reference in a new issue