Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 2ed420b

Browse files
committed
[local_auth] Fixed auth PR reviews.
1 parent aed3a2b commit 2ed420b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/local_auth/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.6.0+3
1+
## 0.6.1
22

33
* Added ability to stop authentication (For Android).
44

packages/local_auth/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private LocalAuthPlugin(Registrar registrar) {
3838
@Override
3939
public void onMethodCall(MethodCall call, final Result result) {
4040
if (call.method.equals("authenticateWithBiometrics")) {
41-
if (!authInProgress.compareAndSet(false, true)) {
41+
if (authInProgress.get()) {
4242
// Apps should not invoke another authentication request while one is in progress,
4343
// so we classify this as an error condition. If we ever find a legitimate use case for
4444
// this, we can try to cancel the ongoing auth and start a new one but for now, not worth
@@ -60,6 +60,7 @@ public void onMethodCall(MethodCall call, final Result result) {
6060
null);
6161
return;
6262
}
63+
authInProgress.set(true);
6364
authenticationHelper =
6465
new AuthenticationHelper(
6566
(FragmentActivity) activity,

packages/local_auth/lib/local_auth.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,15 @@ class LocalAuthentication {
9191
}
9292

9393
/// Returns true if auth was cancelled successfully.
94+
/// This api only works for Android.
9495
/// Returns false if there was some error or no auth in progress.
9596
///
9697
/// Returns [Future] bool true or false:
9798
Future<bool> stopAuthentication() {
9899
if (_platform.isAndroid) {
99100
return _channel.invokeMethod<bool>('stopAuthentication');
100101
}
101-
final Future<bool> future = Future<bool>(() => true);
102-
Completer<bool>().complete(future);
103-
return future;
102+
return Future<bool>.sync(() => true);
104103
}
105104

106105
/// Returns true if device is capable of checking biometrics

packages/local_auth/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for Android and iOS device authentication sensors
33
such as Fingerprint Reader and Touch ID.
44
author: Flutter Team <flutter-dev@googlegroups.com>
55
homepage: https://github.com/flutter/plugins/tree/master/packages/local_auth
6-
version: 0.6.0+3
6+
version: 0.6.1
77

88
flutter:
99
plugin:
@@ -16,7 +16,7 @@ dependencies:
1616
sdk: flutter
1717
meta: ^1.0.5
1818
intl: ">=0.15.1 <0.17.0"
19-
platform: ^2.0.0
19+
platform: ^2.0.0
2020

2121
dev_dependencies:
2222
flutter_test:

0 commit comments

Comments
 (0)