aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/settings
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-05-01 16:41:52 -0700
committerAllan Wang <me@allanwang.ca>2019-05-01 16:41:52 -0700
commit984a4a7bf1d08c0d3143ea6d3ea637d7e674f0c2 (patch)
tree1eaddf006bef618f134bf197762896d21267e952 /app/src/main/kotlin/com/pitchedapps/frost/settings
parent58f4f9298b09081b3c937227828824849057a835 (diff)
downloadfrost-984a4a7bf1d08c0d3143ea6d3ea637d7e674f0c2.tar.gz
frost-984a4a7bf1d08c0d3143ea6d3ea637d7e674f0c2.tar.bz2
frost-984a4a7bf1d08c0d3143ea6d3ea637d7e674f0c2.zip
Add security settings for biometrics
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/settings')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt45
3 files changed, 47 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
index e0ae6de5..1ee06464 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
@@ -52,7 +52,7 @@ import java.io.File
*/
fun SettingsActivity.getDebugPrefs(): KPrefAdapterBuilder.() -> Unit = {
- plainText(R.string.experimental_disclaimer) {
+ plainText(R.string.disclaimer) {
descRes = R.string.debug_disclaimer_info
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
index e0d314a8..41a60594 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
@@ -30,7 +30,7 @@ import com.pitchedapps.frost.utils.Showcase
*/
fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = {
- plainText(R.string.experimental_disclaimer) {
+ plainText(R.string.disclaimer) {
descRes = R.string.experimental_disclaimer_info
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt
new file mode 100644
index 00000000..afd7c4e1
--- /dev/null
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.pitchedapps.frost.settings
+
+import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
+import com.pitchedapps.frost.R
+import com.pitchedapps.frost.activities.SettingsActivity
+import com.pitchedapps.frost.utils.BiometricUtils
+import com.pitchedapps.frost.utils.Prefs
+import kotlinx.coroutines.launch
+
+/**
+ * Created by Allan Wang on 20179-05-01.
+ */
+fun SettingsActivity.getSecurityPrefs(): KPrefAdapterBuilder.() -> Unit = {
+
+ plainText(R.string.disclaimer) {
+ descRes = R.string.security_disclaimer_info
+ }
+
+ checkbox(R.string.enable_biometrics, Prefs::biometricsEnabled, {
+ launch {
+ BiometricUtils.authenticate(this@getSecurityPrefs, force = true).await()
+ Prefs.biometricsEnabled = it
+ reloadByTitle(R.string.enable_biometrics)
+ }
+ }) {
+ descRes = R.string.enable_biometrics_desc
+ enabler = { BiometricUtils.isSupported(this@getSecurityPrefs) }
+ }
+}