From f428e5bd2e98b11d37a25847d6abeedab445fec8 Mon Sep 17 00:00:00 2001 From: Biruk Dubale Date: Fri, 18 Dec 2020 11:26:26 -0500 Subject: [PATCH 1/2] [local_auth] Fix iOS app crash issue: alerts should be alled in the main thread --- packages/local_auth/CHANGELOG.md | 3 +++ packages/local_auth/ios/Classes/FLTLocalAuthPlugin.m | 11 ++++++++--- packages/local_auth/pubspec.yaml | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/local_auth/CHANGELOG.md b/packages/local_auth/CHANGELOG.md index d83798ad4889..cf4989f6a10e 100644 --- a/packages/local_auth/CHANGELOG.md +++ b/packages/local_auth/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.1-nullsafety.1 + +* Fix a crash in iOS on biometric lockout in the app ## 1.0.0-nullsafety * Migrate to null safety. diff --git a/packages/local_auth/ios/Classes/FLTLocalAuthPlugin.m b/packages/local_auth/ios/Classes/FLTLocalAuthPlugin.m index aa0c217ef543..46a8bb52d47e 100644 --- a/packages/local_auth/ios/Classes/FLTLocalAuthPlugin.m +++ b/packages/local_auth/ios/Classes/FLTLocalAuthPlugin.m @@ -62,9 +62,14 @@ - (void)alertMessage:(NSString *)message }]; [alert addAction:additionalAction]; } - [[UIApplication sharedApplication].delegate.window.rootViewController presentViewController:alert - animated:YES - completion:nil]; + @try { + dispatch_async(dispatch_get_main_queue(), ^{ + [[UIApplication sharedApplication].delegate.window.rootViewController presentViewController:alert animated:YES completion:nil]; + }); + } @catch (NSException *exception) { + NSLog(@"Exception presentViewController: %@", exception); + } @finally { + } } - (void)getAvailableBiometrics:(FlutterResult)result { diff --git a/packages/local_auth/pubspec.yaml b/packages/local_auth/pubspec.yaml index f61f8b3ca4a7..30acd7264314 100644 --- a/packages/local_auth/pubspec.yaml +++ b/packages/local_auth/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth description: Flutter plugin for Android and iOS device authentication sensors such as Fingerprint Reader and Touch ID. homepage: https://github.com/flutter/plugins/tree/master/packages/local_auth -version: 1.0.0-nullsafety +version: 1.0.0-nullsafety.1 flutter: plugin: From bffe03453513a0da7b775cc2d11e9d5d19d43fdc Mon Sep 17 00:00:00 2001 From: Biruk Dubale <64862608+callbiruk@users.noreply.github.com> Date: Tue, 30 Mar 2021 09:52:21 -0400 Subject: [PATCH 2/2] Update CHANGELOG.md --- packages/local_auth/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/local_auth/CHANGELOG.md b/packages/local_auth/CHANGELOG.md index 00d943744457..35ddb67d830b 100644 --- a/packages/local_auth/CHANGELOG.md +++ b/packages/local_auth/CHANGELOG.md @@ -1,6 +1,7 @@ * Migrate to null safety. * Allow pin, passcode, and pattern authentication with `authenticate` method. * Fix incorrect error handling switch case fallthrough. +* Fix crash on biometric lockout * Update README for Android Integration. * Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. * Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)).