-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): authenticate first when enabling security settings #991
Conversation
# Conflicts: # app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt # app/src/main/java/com/lagradost/cloudstream3/ui/account/AccountSelectActivity.kt # app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsAccount.kt
} | ||
|
||
override fun onAuthenticationError() { | ||
updateAuthPreference(!isAuthEnabled(context ?: requireContext())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove requireContext
private fun updateAuthPreference(enabled: Boolean) { | ||
val biometricKey = getString(R.string.biometric_key) | ||
|
||
PreferenceManager.getDefaultSharedPreferences(context ?: requireContext()).edit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove requireContext
@@ -262,23 +296,27 @@ class SettingsAccount : PreferenceFragmentCompat() { | |||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | |||
hideKeyboard() | |||
setPreferencesFromResource(R.xml.settings_account, rootKey) | |||
// hide preference on tvs and emulators | |||
if (!isLayout(PHONE)) { | |||
getPref(R.string.biometric_key)?.isEnabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPref(R.string.biometric_key)?.isEnabled = isLayout(PHONE)
hide the preference in tvs
authenticate when disabling the settings for more secure reasons
authenticate when enabling to test if device is capable or not (turn on when succceded).