From 8cada17bcbcc5443062153542241dbe0d2a836ee Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 25 Apr 2020 20:34:33 +0530 Subject: [PATCH] Add toggle for debug logging (#745) --- CHANGELOG.md | 3 +++ app/src/main/java/com/zeapo/pwdstore/Application.kt | 4 ++-- app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 2 ++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preference.xml | 5 +++++ 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("enable_debug_logging")?.isVisible = !BuildConfig.ENABLE_DEBUG_FEATURES + findPreference("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 @@ New, revamped Autofill! 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! Grant + Enable debug logging (requires app restart) + Debug logging 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" /> +