Skip to content
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

Merged
merged 6 commits into from
Mar 25, 2024

Conversation

IndusAryan
Copy link
Contributor

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).

@IndusAryan IndusAryan marked this pull request as ready for review March 16, 2024 20:34
# 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()))
Copy link
Collaborator

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()
Copy link
Collaborator

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
Copy link
Collaborator

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)

@fire-light42 fire-light42 merged commit 2293742 into recloudstream:master Mar 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants