summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-04-25 20:34:33 +0530
committerGitHub <noreply@github.com>2020-04-25 20:34:33 +0530
commit8cada17bcbcc5443062153542241dbe0d2a836ee (patch)
treee32810f2283f86da8ce85bb956a9339f07e5fb25
parentf89d5c282faf34234440a89d1765ac43baa54be9 (diff)
Add toggle for debug logging (#745)
-rw-r--r--CHANGELOG.md3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/Application.kt4
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.kt2
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/preference.xml5
5 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7939f84..be3fc2d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
+### Added
+- Settings option to enable debug logging
+
### Changed
- SSH Keygen UI was improved
- Default key length for SSH Keygen is now 4096 bits
diff --git a/app/src/main/java/com/zeapo/pwdstore/Application.kt b/app/src/main/java/com/zeapo/pwdstore/Application.kt
index 506fff9d..341a6fe3 100644
--- a/app/src/main/java/com/zeapo/pwdstore/Application.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/Application.kt
@@ -21,11 +21,11 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
override fun onCreate() {
super.onCreate()
- if (BuildConfig.ENABLE_DEBUG_FEATURES) {
+ prefs = PreferenceManager.getDefaultSharedPreferences(this)
+ if (BuildConfig.ENABLE_DEBUG_FEATURES || prefs?.getBoolean("enable_debug_logging", false) == true) {
plant(DebugTree())
WhatTheStack(this).init()
}
- prefs = PreferenceManager.getDefaultSharedPreferences(this)
prefs?.registerOnSharedPreferenceChangeListener(this)
setNightMode()
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
index 67a9bc2d..869ee05b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
@@ -282,6 +282,8 @@ class UserPreference : AppCompatActivity() {
getString(R.string.pref_clipboard_timeout_summary, sharedPreferences.getString("general_show_time", "45"))
}
+ findPreference<CheckBoxPreference>("enable_debug_logging")?.isVisible = !BuildConfig.ENABLE_DEBUG_FEATURES
+
findPreference<CheckBoxPreference>("biometric_auth")?.apply {
val isFingerprintSupported = BiometricManager.from(requireContext()).canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS
if (!isFingerprintSupported) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 650762eb..79fda215 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -367,4 +367,6 @@
<string name="autofill_onboarding_dialog_title">New, revamped Autofill!</string>
<string name="autofill_onboarding_dialog_message">In this release, Autofill support has been massively improved with advanced features like anti-phishing protection and enhanced reliability. If you have been holding out on using it because of the shortcomings on the previous version, you\'ll likely love the new iteration. Give it a shot!</string>
<string name="snackbar_action_grant">Grant</string>
+ <string name="pref_debug_logging_summary">Enable debug logging (requires app restart)</string>
+ <string name="pref_debug_logging_title">Debug logging</string>
</resources>
diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml
index fe488a35..656e47f6 100644
--- a/app/src/main/res/xml/preference.xml
+++ b/app/src/main/res/xml/preference.xml
@@ -172,6 +172,11 @@
app:key="clear_clipboard_20x"
app:summary="@string/pref_clear_clipboard_hint"
app:title="@string/pref_clear_clipboard_title" />
+ <CheckBoxPreference
+ app:defaultValue="false"
+ app:key="enable_debug_logging"
+ app:summary="@string/pref_debug_logging_summary"
+ app:title="@string/pref_debug_logging_title" />
</PreferenceCategory>
<PreferenceCategory>