Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void run() {
}

private void updateFingerprintDialog(DialogState state, String message) {
if (cancellationSignal.isCanceled() || !fingerprintDialog.isShowing()) {
if (cancellationSignal.isCanceled() || (fingerprintDialog != null && !fingerprintDialog.isShowing())) {
return;
}
// TextView resultInfo = (TextView) fingerprintDialog.findViewById(R.id.fingerprint_status);
Expand All @@ -225,13 +225,13 @@ private void updateFingerprintDialog(DialogState state, String message) {
// Suppress inflateParams lint because dialogs do not need to attach to a parent view.
@SuppressLint("InflateParams")
private void showFingerprintDialog() {
// View view = LayoutInflater.from(activity).inflate(R.layout.scan_fp, null, false);
// TextView fpDescription = (TextView) view.findViewById(R.id.fingerprint_description);
// TextView title = (TextView) view.findViewById(R.id.fingerprint_signin);
// TextView status = (TextView) view.findViewById(R.id.fingerprint_status);
// fpDescription.setText((String) call.argument("localizedReason"));
// title.setText((String) call.argument("signInTitle"));
// status.setText((String) call.argument("fingerprintHint"));
View view = LayoutInflater.from(activity).inflate(R.layout.scan_fp, null, false);
TextView fpDescription = (TextView) view.findViewById(R.id.fingerprint_description);
TextView title = (TextView) view.findViewById(R.id.fingerprint_signin);
TextView status = (TextView) view.findViewById(R.id.fingerprint_status);
fpDescription.setText((String) call.argument("localizedReason"));
title.setText((String) call.argument("signInTitle"));
status.setText((String) call.argument("fingerprintHint"));
Context context = new ContextThemeWrapper(activity, R.style.AlertDialogCustom);
OnClickListener cancelHandler =
new OnClickListener() {
Expand All @@ -240,13 +240,13 @@ public void onClick(DialogInterface dialog, int which) {
stop(false);
}
};
fingerprintDialog =
new AlertDialog.Builder(context)
// .setView(view)
// .setNegativeButton((String) call.argument(CANCEL_BUTTON), cancelHandler)
// .setCancelable(false)
.show();
fingerprintDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND‌​);
if (call.argument("showFPDialog"))
fingerprintDialog =
new AlertDialog.Builder(context)
.setView(view)
.setNegativeButton((String) call.argument(CANCEL_BUTTON), cancelHandler)
.setCancelable(false).show();
//fingerprintDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}

// Suppress inflateParams lint because dialogs do not need to attach to a parent view.
Expand Down
6 changes: 6 additions & 0 deletions lib/flutter_local_auth_invisible.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class LocalAuthentication {
/// back to Dart and it is up to the client app to restart authentication or
/// do something else.
///
/// [showFPDialog] is used to show fingerprint dialog. If showFPDialog is set
/// to true, authentication dialog is shown. If it is set to
/// false (default), then authentication dialog is not shown
///
/// Construct [AndroidAuthStrings] and [IOSAuthStrings] if you want to
/// customize messages in the dialogs.
///
Expand All @@ -64,6 +68,7 @@ class LocalAuthentication {
@required String localizedReason,
bool useErrorDialogs = true,
bool stickyAuth = false,
bool showFPDialog = false,
AndroidAuthMessages androidAuthStrings = const AndroidAuthMessages(),
IOSAuthMessages iOSAuthStrings = const IOSAuthMessages(),
bool sensitiveTransaction = true,
Expand All @@ -73,6 +78,7 @@ class LocalAuthentication {
'localizedReason': localizedReason,
'useErrorDialogs': useErrorDialogs,
'stickyAuth': stickyAuth,
'showFPDialog': showFPDialog,
'sensitiveTransaction': sensitiveTransaction,
};
if (_platform.isIOS) {
Expand Down