Access shared prefs in fxa pairing (#14997)

pull/101/head
Elise Richards 4 years ago committed by GitHub
parent 79180250ea
commit 4afaf34a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,7 +32,6 @@ import org.mozilla.fenix.ext.showToolbar
class PairFragment : Fragment(R.layout.fragment_pair), UserInteractionHandler {
private val qrFeature = ViewBoundFeatureWrapper<QrFeature>()
private val preferences = PreferenceManager.getDefaultSharedPreferences(context)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -71,10 +70,11 @@ class PairFragment : Fragment(R.layout.fragment_pair), UserInteractionHandler {
view = view
)
val cameraPermissionsDenied = preferences.getBoolean(
getPreferenceKey(R.string.pref_key_camera_permissions),
false
)
val cameraPermissionsDenied = PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(
getPreferenceKey(R.string.pref_key_camera_permissions),
false
)
qrFeature.withFeature {
if (cameraPermissionsDenied) {
@ -116,13 +116,15 @@ class PairFragment : Fragment(R.layout.fragment_pair), UserInteractionHandler {
qrFeature.withFeature {
it.onPermissionsResult(permissions, grantResults)
}
preferences.edit().putBoolean(
getPreferenceKey(R.string.pref_key_camera_permissions), false
).apply()
PreferenceManager.getDefaultSharedPreferences(context)
.edit().putBoolean(
getPreferenceKey(R.string.pref_key_camera_permissions), false
).apply()
} else {
preferences.edit().putBoolean(
getPreferenceKey(R.string.pref_key_camera_permissions), true
).apply()
PreferenceManager.getDefaultSharedPreferences(context)
.edit().putBoolean(
getPreferenceKey(R.string.pref_key_camera_permissions), true
).apply()
findNavController().popBackStack(R.id.turnOnSyncFragment, false)
}
}

Loading…
Cancel
Save