From 3504ca19175b2f8d123f864740b60962a5fd2b37 Mon Sep 17 00:00:00 2001 From: "Bodhi Mulders (BeMacized)" Date: Wed, 13 Apr 2022 13:42:19 +0200 Subject: [PATCH 1/2] Change stopAuthentication to return false instead of throwing on iOS. --- packages/local_auth/local_auth_ios/CHANGELOG.md | 4 ++++ packages/local_auth/local_auth_ios/lib/local_auth_ios.dart | 3 ++- packages/local_auth/local_auth_ios/pubspec.yaml | 2 +- .../local_auth/local_auth_ios/test/local_auth_test.dart | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/local_auth/local_auth_ios/CHANGELOG.md b/packages/local_auth/local_auth_ios/CHANGELOG.md index 7f198f2d66c0..b10010d721fb 100644 --- a/packages/local_auth/local_auth_ios/CHANGELOG.md +++ b/packages/local_auth/local_auth_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.1 + +* Changes `stopAuthentication` to always return false instead of throwing an error. + ## 1.0.0 * Initial release from migration to federated architecture. diff --git a/packages/local_auth/local_auth_ios/lib/local_auth_ios.dart b/packages/local_auth/local_auth_ios/lib/local_auth_ios.dart index 7d085ccf14d9..d92d076d79fb 100644 --- a/packages/local_auth/local_auth_ios/lib/local_auth_ios.dart +++ b/packages/local_auth/local_auth_ios/lib/local_auth_ios.dart @@ -81,8 +81,9 @@ class LocalAuthIOS extends LocalAuthPlatform { Future isDeviceSupported() async => (await _channel.invokeMethod('isDeviceSupported')) ?? false; + /// Always returns false as this method is not supported on iOS. @override Future stopAuthentication() async { - throw UnimplementedError('stopAuthentication() is not supported on iOS.'); + return false; } } diff --git a/packages/local_auth/local_auth_ios/pubspec.yaml b/packages/local_auth/local_auth_ios/pubspec.yaml index a9126fdea676..537b1a64d003 100644 --- a/packages/local_auth/local_auth_ios/pubspec.yaml +++ b/packages/local_auth/local_auth_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth_ios description: iOS implementation of the local_auth plugin. repository: https://github.com/flutter/plugins/tree/master/packages/local_auth/local_auth_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22 -version: 1.0.0 +version: 1.0.1 environment: sdk: ">=2.14.0 <3.0.0" diff --git a/packages/local_auth/local_auth_ios/test/local_auth_test.dart b/packages/local_auth/local_auth_ios/test/local_auth_test.dart index b529764adbd6..180383bc258c 100644 --- a/packages/local_auth/local_auth_ios/test/local_auth_test.dart +++ b/packages/local_auth/local_auth_ios/test/local_auth_test.dart @@ -75,9 +75,9 @@ void main() { ); }); - test('stopAuthentication throws UnimplementedError', () async { - expect(() async => await localAuthentication.stopAuthentication(), - throwsUnimplementedError); + test('stopAuthentication returns false', () async { + final bool result = await localAuthentication.stopAuthentication(); + expect(result, false); }); group('With device auth fail over', () { From f923f8ff66ae1622a582d287733b06f6efaea2a1 Mon Sep 17 00:00:00 2001 From: "Bodhi Mulders (BeMacized)" Date: Wed, 13 Apr 2022 13:54:07 +0200 Subject: [PATCH 2/2] Mark change as breaking --- packages/local_auth/local_auth_ios/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/local_auth/local_auth_ios/CHANGELOG.md b/packages/local_auth/local_auth_ios/CHANGELOG.md index b10010d721fb..d826cc8032e5 100644 --- a/packages/local_auth/local_auth_ios/CHANGELOG.md +++ b/packages/local_auth/local_auth_ios/CHANGELOG.md @@ -1,6 +1,6 @@ ## 1.0.1 -* Changes `stopAuthentication` to always return false instead of throwing an error. +* BREAKING CHANGE: Changes `stopAuthentication` to always return false instead of throwing an error. ## 1.0.0