| Línea 84... |
Línea 84... |
| 84 |
View view= inflater.inflate(R.layout.fragment_biometric_options, container, false);
|
84 |
View view= inflater.inflate(R.layout.fragment_biometric_options, container, false);
|
| 85 |
iTwoGetSkills = (ITwoGetSkills) getActivity();
|
85 |
iTwoGetSkills = (ITwoGetSkills) getActivity();
|
| 86 |
username = view.findViewById(R.id.textView21);
|
86 |
username = view.findViewById(R.id.textView21);
|
| 87 |
username.setText("Hola "+(iTwoGetSkills.getPreference().getFirstName()));
|
87 |
username.setText("Hola "+(iTwoGetSkills.getPreference().getFirstName()));
|
| Línea -... |
Línea 88... |
| - |
|
88 |
|
| - |
|
89 |
BiometricManager biometricManager = BiometricManager.from(getActivity().getApplicationContext());
|
| - |
|
90 |
switch (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)) {
|
| - |
|
91 |
case BiometricManager.BIOMETRIC_SUCCESS:
|
| - |
|
92 |
Log.d("MY_APP_TAG", "App can authenticate using biometrics.");
|
| - |
|
93 |
break;
|
| - |
|
94 |
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
|
| - |
|
95 |
getActivity().runOnUiThread(() -> {
|
| - |
|
96 |
iTwoGetSkills.getPreference().setBiometriclogin(false);
|
| - |
|
97 |
iTwoGetSkills.invokeFragment(Constants.IDX_FRAGMENT_SIGNIN);
|
| - |
|
98 |
Toast.makeText(getActivity().getApplicationContext(), "Este dispositivo no cuenta con sensor de huellas, inicia con tu correo", Toast.LENGTH_SHORT).show();
|
| - |
|
99 |
});
|
| - |
|
100 |
break;
|
| - |
|
101 |
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
|
| - |
|
102 |
Log.e("MY_APP_TAG", "Biometric features are currently unavailable.");
|
| - |
|
103 |
break;
|
| - |
|
104 |
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
|
| - |
|
105 |
// Prompts the user to create credentials that your app accepts.
|
| - |
|
106 |
final Intent enrollIntent = new Intent(Settings.ACTION_BIOMETRIC_ENROLL);
|
| - |
|
107 |
enrollIntent.putExtra(Settings.EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED,
|
| - |
|
108 |
BiometricManager.Authenticators.BIOMETRIC_STRONG);
|
| - |
|
109 |
startActivityForResult(enrollIntent, REQUEST_CODE);
|
| - |
|
110 |
break;
|
| - |
|
111 |
}
|
| 88 |
|
112 |
|
| 89 |
executor = ContextCompat.getMainExecutor(getActivity().getApplicationContext());
|
113 |
executor = ContextCompat.getMainExecutor(getActivity().getApplicationContext());
|
| 90 |
biometricPrompt = new BiometricPrompt(getActivity(),
|
114 |
biometricPrompt = new BiometricPrompt(getActivity(),
|
| 91 |
executor, new BiometricPrompt.AuthenticationCallback() {
|
115 |
executor, new BiometricPrompt.AuthenticationCallback() {
|
| 92 |
@Override
|
116 |
@Override
|
| 93 |
public void onAuthenticationError(int errorCode,
|
117 |
public void onAuthenticationError(int errorCode,
|
| 94 |
@NonNull CharSequence errString) {
|
118 |
@NonNull CharSequence errString) {
|
| - |
|
119 |
super.onAuthenticationError(errorCode, errString);
|
| 95 |
super.onAuthenticationError(errorCode, errString);
|
120 |
|
| - |
|
121 |
if(errorCode==11)
|
| 96 |
Toast.makeText(requireActivity().getApplicationContext(),
|
122 |
{
|
| - |
|
123 |
Toast.makeText(requireActivity().getApplicationContext(), "Necesitas registrar una huella antes de usar esta función", Toast.LENGTH_SHORT).show();
|
| 97 |
"Se canceló la operación", Toast.LENGTH_SHORT)
|
124 |
}
|
| - |
|
125 |
else
|
| - |
|
126 |
{
|
| - |
|
127 |
Toast.makeText(requireActivity().getApplicationContext(), "No puedes usar Fingerprint OnRoom en este momento, ingresa con tu correo", Toast.LENGTH_SHORT).show();
|
| 98 |
.show();
|
128 |
}
|
| Línea 99... |
Línea 129... |
| 99 |
}
|
129 |
}
|
| 100 |
|
130 |
|
| 101 |
@Override
|
131 |
@Override
|
| Línea 146... |
Línea 176... |
| 146 |
// iTwoGetSkills.showNavigationAndToolbar();
|
176 |
// iTwoGetSkills.showNavigationAndToolbar();
|
| 147 |
});
|
177 |
});
|
| 148 |
}
|
178 |
}
|
| 149 |
});
|
179 |
});
|
| Línea 150... |
Línea -... |
| 150 |
|
- |
|
| 151 |
BiometricManager biometricManager = BiometricManager.from(getActivity().getApplicationContext());
|
- |
|
| 152 |
switch (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)) {
|
- |
|
| 153 |
case BiometricManager.BIOMETRIC_SUCCESS:
|
- |
|
| 154 |
Log.d("MY_APP_TAG", "App can authenticate using biometrics.");
|
- |
|
| 155 |
break;
|
- |
|
| 156 |
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
|
- |
|
| 157 |
Log.e("MY_APP_TAG", "No biometric features available on this device.");
|
- |
|
| 158 |
break;
|
- |
|
| 159 |
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
|
- |
|
| 160 |
Log.e("MY_APP_TAG", "Biometric features are currently unavailable.");
|
- |
|
| 161 |
break;
|
- |
|
| 162 |
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
|
- |
|
| 163 |
// Prompts the user to create credentials that your app accepts.
|
- |
|
| 164 |
final Intent enrollIntent = new Intent(Settings.ACTION_BIOMETRIC_ENROLL);
|
- |
|
| 165 |
enrollIntent.putExtra(Settings.EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED,
|
- |
|
| 166 |
BiometricManager.Authenticators.BIOMETRIC_STRONG);
|
- |
|
| 167 |
startActivityForResult(enrollIntent, REQUEST_CODE);
|
- |
|
| 168 |
break;
|
180 |
|
| 169 |
}
|
181 |
|
| 170 |
return view;
|
182 |
return view;
|
| 171 |
}
|
183 |
}
|
| 172 |
}
|
184 |
}
|