From 49c970abc73a2ef0f40a544bf2f0b11014a21a8f Mon Sep 17 00:00:00 2001 From: Rachel Bonny Date: Tue, 5 Oct 2021 14:49:38 +0200 Subject: [PATCH] refactor(ios): refactor error check --- CHANGELOG.md | 4 ++++ example/pubspec.lock | 2 +- ios/Classes/ScreenLockCheckPlugin.m | 2 +- pubspec.yaml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6539676..7112f12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.1 + +- Refactored ios local authentication check + ## 1.2.0 - Fixed bug with ios no lockscreen case diff --git a/example/pubspec.lock b/example/pubspec.lock index 7703abf..9f0e57d 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -94,7 +94,7 @@ packages: path: ".." relative: true source: path - version: "1.2.0" + version: "1.2.1" sky_engine: dependency: transitive description: flutter diff --git a/ios/Classes/ScreenLockCheckPlugin.m b/ios/Classes/ScreenLockCheckPlugin.m index e639dcd..448fcaa 100644 --- a/ios/Classes/ScreenLockCheckPlugin.m +++ b/ios/Classes/ScreenLockCheckPlugin.m @@ -15,7 +15,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { LAContext *context = [LAContext new]; NSError *error; BOOL isLockScreenEnabled = [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&error]; - if (error != nil && !([error.domain isEqualToString:@"com.apple.LocalAuthentication"] && error.code == -5)) { + if (error != nil && error.code != LAErrorPasscodeNotSet) { result([FlutterError errorWithCode:@"UNAVAILABLE" message:@"Local authentication context is unavailable" details:error.localizedDescription]); diff --git a/pubspec.yaml b/pubspec.yaml index 51672ef..f260814 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: screen_lock_check description: A plugin that checks whether the user has enabled a passcode, pattern lock, face id or touch id on their device. -version: 1.2.0 +version: 1.2.1 homepage: https://github.com/koa-health/screen_lock_check environment: