aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/settings
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/settings')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt43
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt29
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt31
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Network.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt53
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt7
8 files changed, 87 insertions, 92 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
index 4391b3ca..8c83850b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
@@ -28,7 +28,6 @@ import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.enums.MainActivityLayout
import com.pitchedapps.frost.enums.Theme
import com.pitchedapps.frost.injectors.CssAssets
-import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.REQUEST_NAV
import com.pitchedapps.frost.utils.REQUEST_TEXT_ZOOM
import com.pitchedapps.frost.utils.frostEvent
@@ -45,7 +44,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
header(R.string.theme_customization)
- text(R.string.theme, Prefs::theme, { Prefs.theme = it }) {
+ text(R.string.theme, prefs::theme, { prefs.theme = it }) {
onClick = {
materialDialog {
title(R.string.theme)
@@ -71,7 +70,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
}
fun KPrefColorPicker.KPrefColorContract.dependsOnCustom() {
- enabler = Prefs::isCustomTheme
+ enabler = prefs::isCustomTheme
onDisabledClick = { frostSnackbar(R.string.requires_custom_theme) }
allowCustom = true
}
@@ -80,8 +79,8 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
CssAssets.CUSTOM.reset()
}
- colorPicker(R.string.text_color, Prefs::customTextColor, {
- Prefs.customTextColor = it
+ colorPicker(R.string.text_color, prefs::customTextColor, {
+ prefs.customTextColor = it
reload()
invalidateCustomTheme()
shouldRestartMain()
@@ -90,8 +89,8 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = false
}
- colorPicker(R.string.accent_color, Prefs::customAccentColor, {
- Prefs.customAccentColor = it
+ colorPicker(R.string.accent_color, prefs::customAccentColor, {
+ prefs.customAccentColor = it
reload()
invalidateCustomTheme()
shouldRestartMain()
@@ -100,8 +99,8 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = false
}
- colorPicker(R.string.background_color, Prefs::customBackgroundColor, {
- Prefs.customBackgroundColor = it
+ colorPicker(R.string.background_color, prefs::customBackgroundColor, {
+ prefs.customBackgroundColor = it
bgCanvas.ripple(it, duration = 500L)
invalidateCustomTheme()
setFrostTheme(true)
@@ -111,8 +110,8 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = true
}
- colorPicker(R.string.header_color, Prefs::customHeaderColor, {
- Prefs.customHeaderColor = it
+ colorPicker(R.string.header_color, prefs::customHeaderColor, {
+ prefs.customHeaderColor = it
frostNavigationBar()
toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
reload()
@@ -122,8 +121,8 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
allowCustomAlpha = true
}
- colorPicker(R.string.icon_color, Prefs::customIconColor, {
- Prefs.customIconColor = it
+ colorPicker(R.string.icon_color, prefs::customIconColor, {
+ prefs.customIconColor = it
invalidateOptionsMenu()
shouldRestartMain()
}) {
@@ -135,9 +134,9 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
text(
R.string.main_activity_layout,
- Prefs::mainActivityLayoutType,
- { Prefs.mainActivityLayoutType = it }) {
- textGetter = { string(Prefs.mainActivityLayout.titleRes) }
+ prefs::mainActivityLayoutType,
+ { prefs.mainActivityLayoutType = it }) {
+ textGetter = { string(prefs.mainActivityLayout.titleRes) }
onClick = {
materialDialog {
title(R.string.main_activity_layout_desc)
@@ -160,8 +159,8 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
onClick = { launchTabCustomizerActivity() }
}
- checkbox(R.string.tint_nav, Prefs::tintNavBar, {
- Prefs.tintNavBar = it
+ checkbox(R.string.tint_nav, prefs::tintNavBar, {
+ prefs.tintNavBar = it
frostNavigationBar()
setFrostResult(REQUEST_NAV)
}) {
@@ -172,15 +171,15 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
KPrefTextSeekbar(
KPrefSeekbar.KPrefSeekbarBuilder(
globalOptions,
- R.string.web_text_scaling, Prefs::webTextScaling
+ R.string.web_text_scaling, prefs::webTextScaling
) {
- Prefs.webTextScaling = it
+ prefs.webTextScaling = it
setFrostResult(REQUEST_TEXT_ZOOM)
})
)
- checkbox(R.string.enforce_black_media_bg, Prefs::blackMediaBg, {
- Prefs.blackMediaBg = it
+ checkbox(R.string.enforce_black_media_bg, prefs::blackMediaBg, {
+ prefs.blackMediaBg = it
}) {
descRes = R.string.enforce_black_media_bg_desc
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
index 8f57b539..f6110756 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
@@ -19,54 +19,53 @@ 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.Prefs
/**
* Created by Allan Wang on 2017-06-30.
*/
fun SettingsActivity.getBehaviourPrefs(): KPrefAdapterBuilder.() -> Unit = {
- checkbox(R.string.auto_refresh_feed, Prefs::autoRefreshFeed, { Prefs.autoRefreshFeed = it }) {
+ checkbox(R.string.auto_refresh_feed, prefs::autoRefreshFeed, { prefs.autoRefreshFeed = it }) {
descRes = R.string.auto_refresh_feed_desc
}
- checkbox(R.string.fancy_animations, Prefs::animate, { Prefs.animate = it; animate = it }) {
+ checkbox(R.string.fancy_animations, prefs::animate, { prefs.animate = it; animate = it }) {
descRes = R.string.fancy_animations_desc
}
checkbox(
R.string.overlay_swipe,
- Prefs::overlayEnabled,
- { Prefs.overlayEnabled = it; shouldRefreshMain() }) {
+ prefs::overlayEnabled,
+ { prefs.overlayEnabled = it; shouldRefreshMain() }) {
descRes = R.string.overlay_swipe_desc
}
checkbox(
R.string.overlay_full_screen_swipe,
- Prefs::overlayFullScreenSwipe,
- { Prefs.overlayFullScreenSwipe = it }) {
+ prefs::overlayFullScreenSwipe,
+ { prefs.overlayFullScreenSwipe = it }) {
descRes = R.string.overlay_full_screen_swipe_desc
}
checkbox(
R.string.open_links_in_default,
- Prefs::linksInDefaultApp,
- { Prefs.linksInDefaultApp = it }) {
+ prefs::linksInDefaultApp,
+ { prefs.linksInDefaultApp = it }) {
descRes = R.string.open_links_in_default_desc
}
- checkbox(R.string.viewpager_swipe, Prefs::viewpagerSwipe, { Prefs.viewpagerSwipe = it }) {
+ checkbox(R.string.viewpager_swipe, prefs::viewpagerSwipe, { prefs.viewpagerSwipe = it }) {
descRes = R.string.viewpager_swipe_desc
}
checkbox(
R.string.force_message_bottom,
- Prefs::messageScrollToBottom,
- { Prefs.messageScrollToBottom = it }) {
+ prefs::messageScrollToBottom,
+ { prefs.messageScrollToBottom = it }) {
descRes = R.string.force_message_bottom_desc
}
- checkbox(R.string.enable_pip, Prefs::enablePip, { Prefs.enablePip = it }) {
+ checkbox(R.string.enable_pip, prefs::enablePip, { prefs.enablePip = it }) {
descRes = R.string.enable_pip_desc
}
@@ -78,11 +77,11 @@ fun SettingsActivity.getBehaviourPrefs(): KPrefAdapterBuilder.() -> Unit = {
// }
// }
- checkbox(R.string.exit_confirmation, Prefs::exitConfirmation, { Prefs.exitConfirmation = it }) {
+ checkbox(R.string.exit_confirmation, prefs::exitConfirmation, { prefs.exitConfirmation = it }) {
descRes = R.string.exit_confirmation_desc
}
- checkbox(R.string.analytics, Prefs::analytics, { Prefs.analytics = it }) {
+ checkbox(R.string.analytics, prefs::analytics, { prefs.analytics = it }) {
descRes = R.string.analytics_desc
}
}
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 d250f036..9a4751b8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
@@ -32,7 +32,6 @@ import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.activities.SettingsActivity.Companion.ACTIVITY_REQUEST_DEBUG
import com.pitchedapps.frost.debugger.OfflineWebsite
import com.pitchedapps.frost.facebook.FB_URL_BASE
-import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.parsers.FrostParser
import com.pitchedapps.frost.facebook.parsers.MessageParser
import com.pitchedapps.frost.facebook.parsers.NotifParser
@@ -87,7 +86,7 @@ fun SettingsActivity.getDebugPrefs(): KPrefAdapterBuilder.() -> Unit = {
attempt = launch(Dispatchers.IO) {
try {
- val data = parser.parse(FbCookie.webCookie)
+ val data = parser.parse(fbCookie.webCookie)
withMainContext {
loading.dismiss()
createEmail(parser, data?.data)
@@ -113,7 +112,8 @@ private const val ZIP_NAME = "debug"
fun SettingsActivity.sendDebug(url: String, html: String?) {
val downloader = OfflineWebsite(
- url, FbCookie.webCookie ?: "",
+ url,
+ cookie = fbCookie.webCookie ?: "",
baseUrl = FB_URL_BASE,
html = html,
baseDir = DebugActivity.baseDir(this)
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 9814fd76..30b16f81 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
@@ -21,7 +21,6 @@ import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
import ca.allanwang.kau.logging.KL
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
-import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.REQUEST_RESTART_APPLICATION
/**
@@ -37,8 +36,8 @@ fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = {
// Experimental content ends here --------------------
- checkbox(R.string.verbose_logging, Prefs::verboseLogging, {
- Prefs.verboseLogging = it
+ checkbox(R.string.verbose_logging, prefs::verboseLogging, {
+ prefs.verboseLogging = it
KL.shouldLog = { it != Log.VERBOSE }
}) {
descRes = R.string.verbose_logging_desc
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
index d1350df5..15a0633b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
@@ -23,7 +23,6 @@ import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.enums.FeedSort
-import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.REQUEST_FAB
/**
@@ -31,7 +30,7 @@ import com.pitchedapps.frost.utils.REQUEST_FAB
*/
fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
- text(R.string.newsfeed_sort, Prefs::feedSort, { Prefs.feedSort = it }) {
+ text(R.string.newsfeed_sort, prefs::feedSort, { prefs.feedSort = it }) {
descRes = R.string.newsfeed_sort_desc
onClick = {
materialDialog {
@@ -50,50 +49,50 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
textGetter = { string(FeedSort(it).textRes) }
}
- checkbox(R.string.aggressive_recents, Prefs::aggressiveRecents, {
- Prefs.aggressiveRecents = it
+ checkbox(R.string.aggressive_recents, prefs::aggressiveRecents, {
+ prefs.aggressiveRecents = it
shouldRefreshMain()
}) {
descRes = R.string.aggressive_recents_desc
}
- checkbox(R.string.composer, Prefs::showComposer, {
- Prefs.showComposer = it
+ checkbox(R.string.composer, prefs::showComposer, {
+ prefs.showComposer = it
shouldRefreshMain()
}) {
descRes = R.string.composer_desc
}
- checkbox(R.string.create_fab, Prefs::showCreateFab, {
- Prefs.showCreateFab = it
+ checkbox(R.string.create_fab, prefs::showCreateFab, {
+ prefs.showCreateFab = it
setFrostResult(REQUEST_FAB)
}) {
descRes = R.string.create_fab_desc
}
- checkbox(R.string.suggested_friends, Prefs::showSuggestedFriends, {
- Prefs.showSuggestedFriends = it
+ checkbox(R.string.suggested_friends, prefs::showSuggestedFriends, {
+ prefs.showSuggestedFriends = it
shouldRefreshMain()
}) {
descRes = R.string.suggested_friends_desc
}
- checkbox(R.string.suggested_groups, Prefs::showSuggestedGroups, {
- Prefs.showSuggestedGroups = it
+ checkbox(R.string.suggested_groups, prefs::showSuggestedGroups, {
+ prefs.showSuggestedGroups = it
shouldRefreshMain()
}) {
descRes = R.string.suggested_groups_desc
}
- checkbox(R.string.show_stories, Prefs::showStories, {
- Prefs.showStories = it
+ checkbox(R.string.show_stories, prefs::showStories, {
+ prefs.showStories = it
shouldRefreshMain()
}) {
descRes = R.string.show_stories_desc
}
- checkbox(R.string.facebook_ads, Prefs::showFacebookAds, {
- Prefs.showFacebookAds = it
+ checkbox(R.string.facebook_ads, prefs::showFacebookAds, {
+ prefs.showFacebookAds = it
shouldRefreshMain()
}) {
descRes = R.string.facebook_ads_desc
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Network.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Network.kt
index a1ec33e6..c275227f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Network.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Network.kt
@@ -19,7 +19,6 @@ 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.Prefs
/**
* Created by Allan Wang on 2017-08-08.
@@ -28,8 +27,8 @@ fun SettingsActivity.getNetworkPrefs(): KPrefAdapterBuilder.() -> Unit = {
checkbox(
R.string.network_media_on_metered,
- { !Prefs.loadMediaOnMeteredNetwork },
- { Prefs.loadMediaOnMeteredNetwork = !it }) {
+ { !prefs.loadMediaOnMeteredNetwork },
+ { prefs.loadMediaOnMeteredNetwork = !it }) {
descRes = R.string.network_media_on_metered_desc
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
index b8a80e8d..06159ba5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
@@ -41,6 +41,7 @@ import com.pitchedapps.frost.utils.frostSnackbar
import com.pitchedapps.frost.utils.frostUri
import com.pitchedapps.frost.views.Keywords
import kotlinx.coroutines.launch
+import org.koin.android.ext.android.get
/**
* Created by Allan Wang on 2017-06-29.
@@ -54,8 +55,8 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
text(
R.string.notification_frequency,
- Prefs::notificationFreq,
- { Prefs.notificationFreq = it }) {
+ prefs::notificationFreq,
+ { prefs.notificationFreq = it }) {
val options = longArrayOf(15, 30, 60, 120, 180, 300, 1440, 2880)
val texts =
options.map { if (it <= 0) string(R.string.no_notifications) else minuteToText(it) }
@@ -71,7 +72,7 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
}
}
}
- enabler = { Prefs.hasNotifications }
+ enabler = { prefs.hasNotifications }
textGetter = { minuteToText(it) }
}
@@ -88,36 +89,36 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
}
}
- checkbox(R.string.notification_general, Prefs::notificationsGeneral,
+ checkbox(R.string.notification_general, prefs::notificationsGeneral,
{
- Prefs.notificationsGeneral = it
+ prefs.notificationsGeneral = it
reloadByTitle(R.string.notification_general_all_accounts)
- if (!Prefs.notificationsInstantMessages)
+ if (!prefs.notificationsInstantMessages)
reloadByTitle(R.string.notification_frequency)
}) {
descRes = R.string.notification_general_desc
}
- checkbox(R.string.notification_general_all_accounts, Prefs::notificationAllAccounts,
- { Prefs.notificationAllAccounts = it }) {
+ checkbox(R.string.notification_general_all_accounts, prefs::notificationAllAccounts,
+ { prefs.notificationAllAccounts = it }) {
descRes = R.string.notification_general_all_accounts_desc
- enabler = { Prefs.notificationsGeneral }
+ enabler = { prefs.notificationsGeneral }
}
- checkbox(R.string.notification_messages, Prefs::notificationsInstantMessages,
+ checkbox(R.string.notification_messages, prefs::notificationsInstantMessages,
{
- Prefs.notificationsInstantMessages = it
+ prefs.notificationsInstantMessages = it
reloadByTitle(R.string.notification_messages_all_accounts)
- if (!Prefs.notificationsGeneral)
+ if (!prefs.notificationsGeneral)
reloadByTitle(R.string.notification_frequency)
}) {
descRes = R.string.notification_messages_desc
}
- checkbox(R.string.notification_messages_all_accounts, Prefs::notificationsImAllAccounts,
- { Prefs.notificationsImAllAccounts = it }) {
+ checkbox(R.string.notification_messages_all_accounts, prefs::notificationsImAllAccounts,
+ { prefs.notificationsImAllAccounts = it }) {
descRes = R.string.notification_messages_all_accounts_desc
- enabler = { Prefs.notificationsInstantMessages }
+ enabler = { prefs.notificationsInstantMessages }
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -130,8 +131,8 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
}
}
} else {
- checkbox(R.string.notification_sound, Prefs::notificationSound, {
- Prefs.notificationSound = it
+ checkbox(R.string.notification_sound, prefs::notificationSound, {
+ prefs.notificationSound = it
reloadByTitle(
R.string.notification_ringtone,
R.string.message_ringtone
@@ -139,7 +140,7 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
})
fun KPrefText.KPrefTextContract<String>.ringtone(code: Int) {
- enabler = Prefs::notificationSound
+ enabler = prefs::notificationSound
textGetter = {
if (it.isBlank()) string(R.string.kau_default)
else RingtoneManager.getRingtone(this@getNotificationPrefs, frostUri(it))
@@ -163,21 +164,21 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
}
}
- text(R.string.notification_ringtone, Prefs::notificationRingtone,
- { Prefs.notificationRingtone = it }) {
+ text(R.string.notification_ringtone, prefs::notificationRingtone,
+ { prefs.notificationRingtone = it }) {
ringtone(SettingsActivity.REQUEST_NOTIFICATION_RINGTONE)
}
- text(R.string.message_ringtone, Prefs::messageRingtone,
- { Prefs.messageRingtone = it }) {
+ text(R.string.message_ringtone, prefs::messageRingtone,
+ { prefs.messageRingtone = it }) {
ringtone(SettingsActivity.REQUEST_MESSAGE_RINGTONE)
}
- checkbox(R.string.notification_vibrate, Prefs::notificationVibrate,
- { Prefs.notificationVibrate = it })
+ checkbox(R.string.notification_vibrate, prefs::notificationVibrate,
+ { prefs.notificationVibrate = it })
- checkbox(R.string.notification_lights, Prefs::notificationLights,
- { Prefs.notificationLights = it })
+ checkbox(R.string.notification_lights, prefs::notificationLights,
+ { prefs.notificationLights = it })
}
if (BuildConfig.DEBUG) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt
index 754e19de..aa38fffd 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Security.kt
@@ -20,7 +20,6 @@ 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
/**
@@ -32,15 +31,15 @@ fun SettingsActivity.getSecurityPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.security_disclaimer_info
}
- checkbox(R.string.enable_biometrics, Prefs::biometricsEnabled, {
+ checkbox(R.string.enable_biometrics, prefs::biometricsEnabled, {
launch {
/*
* For security, we should request authentication when:
* - enabling to ensure that it is supported
* - disabling to ensure that it is permitted
*/
- BiometricUtils.authenticate(this@getSecurityPrefs, force = true).await()
- Prefs.biometricsEnabled = it
+ BiometricUtils.authenticate(this@getSecurityPrefs, prefs, force = true).await()
+ prefs.biometricsEnabled = it
reloadByTitle(R.string.enable_biometrics)
}
}) {