Skip to content
Draft
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
4 changes: 4 additions & 0 deletions packages/local_auth/local_auth/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ dev_dependencies:

flutter:
uses-material-design: true
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
local_auth_darwin: {path: ../../../../packages/local_auth/local_auth_darwin}
4 changes: 4 additions & 0 deletions packages/local_auth/local_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ topics:
- authentication
- biometrics
- local-auth
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
local_auth_darwin: {path: ../../../packages/local_auth/local_auth_darwin}
3 changes: 2 additions & 1 deletion packages/local_auth/local_auth_darwin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.0.4

* Adds support for localizedCancelTitle.
* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

## 2.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ final class StubAuthContext: NSObject, AuthContext, @unchecked Sendable {
// Overridden as read-write to allow stubbing.
var biometryType: LABiometryType = .none
var localizedFallbackTitle: String?
var localizedCancelTitle: String?

func canEvaluatePolicy(_ policy: LAPolicy, error: NSErrorPointer) -> Bool {
#expect(
Expand Down Expand Up @@ -333,6 +334,26 @@ struct LocalAuthPluginTests {
}
}

@Test
func localizedCancelTitle() async {
let stubAuthContext = StubAuthContext()
let plugin = LocalAuthPlugin(
contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]))

let strings = createAuthStrings()
stubAuthContext.evaluateResponse = true

await withCheckedContinuation { continuation in
plugin.authenticate(
options: AuthOptions(biometricOnly: false, sticky: false),
strings: strings
) { resultDetails in
#expect(stubAuthContext.localizedCancelTitle == strings.cancelButton)
continuation.resume()
}
}
}

@Test
func deviceSupportsBiometricsWithEnrolledHardware() throws {
let stubAuthContext = StubAuthContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public final class LocalAuthPlugin: NSObject, FlutterPlugin, LocalAuthApi, @unch
var context = authContextFactory.createAuthContext()
lastCallState = nil
context.localizedFallbackTitle = strings.localizedFallbackTitle
context.localizedCancelTitle = strings.cancelButton

let policy =
options.biometricOnly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ protocol AuthContext {
/// Direct passthrough to LAContext's localizedFallbackTitle.
var localizedFallbackTitle: String? { get set }

/// Direct passthrough to LAContext's localizedCancelTitle.
var localizedCancelTitle: String? { get set }

/// Direct passthrough to LAContext's biometry type.
var biometryType: LABiometryType { get }

Expand Down
2 changes: 1 addition & 1 deletion packages/local_auth/local_auth_darwin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: local_auth_darwin
description: iOS implementation of the local_auth plugin.
repository: https://github.com/flutter/packages/tree/main/packages/local_auth/local_auth_darwin
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
version: 2.0.3
version: 2.0.4

environment:
sdk: ^3.10.0
Expand Down