diff --git a/AUTHORS b/AUTHORS index 6ea7eeec4f51..be6c57cfb161 100644 --- a/AUTHORS +++ b/AUTHORS @@ -75,5 +75,6 @@ Amir Panahandeh Daniele Cambi Michele Benedetti Taskulu LDA +Alexander Rabin LinXunFeng Hashir Shoaib diff --git a/packages/local_auth/local_auth_darwin/CHANGELOG.md b/packages/local_auth/local_auth_darwin/CHANGELOG.md index 28d789ca0f68..1f3fed054dce 100644 --- a/packages/local_auth/local_auth_darwin/CHANGELOG.md +++ b/packages/local_auth/local_auth_darwin/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.0 + +* Adds macOS support. + ## 1.3.1 * Adjusts implementation for improved testability, and removes use of OCMock. diff --git a/packages/local_auth/local_auth_darwin/README.md b/packages/local_auth/local_auth_darwin/README.md index 6c9309205429..39650ce1110f 100644 --- a/packages/local_auth/local_auth_darwin/README.md +++ b/packages/local_auth/local_auth_darwin/README.md @@ -1,6 +1,6 @@ # local_auth_darwin -The iOS implementation of [`local_auth`][1]. +The iOS and macOS implementation of [`local_auth`][1]. ## Usage diff --git a/packages/local_auth/local_auth_darwin/darwin/Tests/FLALocalAuthPluginTests.swift b/packages/local_auth/local_auth_darwin/darwin/Tests/FLALocalAuthPluginTests.swift index 865be355fd16..73da7123b38f 100644 --- a/packages/local_auth/local_auth_darwin/darwin/Tests/FLALocalAuthPluginTests.swift +++ b/packages/local_auth/local_auth_darwin/darwin/Tests/FLALocalAuthPluginTests.swift @@ -2,16 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import Flutter import XCTest @testable import local_auth_darwin +#if os(iOS) + import Flutter +#else + import FlutterMacOS +#endif + // Set a long timeout to avoid flake due to slow CI. private let timeout: TimeInterval = 30.0 /// A context factory that returns preset contexts. final class StubAuthContextFactory: NSObject, FLADAuthContextFactory { + var contexts: [FLADAuthContext] init(contexts: [FLADAuthContext]) { self.contexts = contexts @@ -23,6 +29,74 @@ final class StubAuthContextFactory: NSObject, FLADAuthContextFactory { } } +final class StubViewProvider: NSObject, FLAViewProvider { + #if os(macOS) + var view: NSView + var window: NSWindow + override init() { + self.window = NSWindow() + self.view = NSView() + self.window.contentView = self.view + } + #endif +} + +#if os(macOS) + final class TestAlert: NSObject, FLANSAlert { + var messageText: String = "" + var buttons: [String] = [] + var presentingWindow: NSWindow? + + func addButton(withTitle title: String) -> NSButton { + buttons.append(title) + return NSButton() // The return value is not used by the plugin. + } + + func beginSheetModal(for sheetWindow: NSWindow) async -> NSApplication.ModalResponse { + presentingWindow = sheetWindow + return NSApplication.ModalResponse.OK + } + } +#else + final class TestAlertController: NSObject, FLAUIAlertController { + var actions: [UIAlertAction] = [] + var presented = false + var presentingViewController: UIViewController? + + func add(_ action: UIAlertAction) { + actions.append(action) + } + + func present( + on presentingViewController: UIViewController, animated flag: Bool, + completion: (() -> Void)? = nil + ) { + presented = true + self.presentingViewController = presentingViewController + } + } +#endif + +final class StubAlertFactory: NSObject, FLADAlertFactory { + #if os(macOS) + var alert: TestAlert = TestAlert() + #else + var alertController: TestAlertController = TestAlertController() + #endif + + #if os(macOS) + func createAlert() -> FLANSAlert { + return self.alert + } + #else + func createAlertController( + withTitle title: String?, message: String?, preferredStyle: UIAlertController.Style + ) -> FLAUIAlertController { + return self.alertController + } + #endif +} + final class StubAuthContext: NSObject, FLADAuthContext { /// Whether calls to this stub are expected to be for biometric authentication. /// @@ -75,8 +149,12 @@ class FLALocalAuthPluginTests: XCTestCase { func testSuccessfullAuthWithBiometrics() throws { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider + ) let strings = createAuthStrings() stubAuthContext.expectBiometrics = true @@ -99,8 +177,12 @@ class FLALocalAuthPluginTests: XCTestCase { func testSuccessfullAuthWithoutBiometrics() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() + let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() stubAuthContext.evaluateResponse = true @@ -123,8 +205,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testFailedAuthWithBiometrics() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() stubAuthContext.expectBiometrics = true @@ -153,8 +238,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testFailedWithUnknownErrorCode() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() stubAuthContext.evaluateError = NSError(domain: "error", code: 99) @@ -177,8 +265,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testSystemCancelledWithoutStickyAuth() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() stubAuthContext.evaluateError = NSError(domain: "error", code: LAError.systemCancel.rawValue) @@ -201,8 +292,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testFailedAuthWithoutBiometrics() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() stubAuthContext.evaluateError = NSError( @@ -228,10 +322,50 @@ class FLALocalAuthPluginTests: XCTestCase { self.waitForExpectations(timeout: timeout) } + func testFailedAuthShowsAlert() { + let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() + let plugin = FLALocalAuthPlugin( + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) + + let strings = createAuthStrings() + stubAuthContext.canEvaluateError = NSError( + domain: "error", code: LAError.biometryNotEnrolled.rawValue) + + #if os(macOS) + let expectation = expectation(description: "Result is called") + #endif + plugin.authenticate( + with: FLADAuthOptions.make( + withBiometricOnly: false, + sticky: false, + useErrorDialogs: true), + strings: strings + ) { resultDetails, error in + // TODO(stuartmorgan): Add a wrapper around UIAction to allow accessing the handler, so + // that the test can trigger the callback on iOS as well, and then unfork this. + #if os(macOS) + expectation.fulfill() + #endif + } + #if os(macOS) + self.waitForExpectations(timeout: timeout) + XCTAssertEqual(alertFactory.alert.presentingWindow, viewProvider.view.window) + #else + XCTAssertTrue(alertFactory.alertController.presented) + XCTAssertEqual(alertFactory.alertController.actions.count, 2) + #endif + } + func testLocalizedFallbackTitle() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() strings.localizedFallbackTitle = "a title" @@ -255,8 +389,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testSkippedLocalizedFallbackTitle() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) let strings = createAuthStrings() strings.localizedFallbackTitle = nil @@ -278,8 +415,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testDeviceSupportsBiometrics_withEnrolledHardware() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) stubAuthContext.expectBiometrics = true @@ -291,8 +431,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testDeviceSupportsBiometrics_withNonEnrolledHardware() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) stubAuthContext.expectBiometrics = true stubAuthContext.canEvaluateError = NSError( @@ -306,8 +449,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testDeviceSupportsBiometrics_withNoBiometricHardware() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) stubAuthContext.expectBiometrics = true stubAuthContext.canEvaluateError = NSError(domain: "error", code: 0) @@ -320,11 +466,17 @@ class FLALocalAuthPluginTests: XCTestCase { func testGetEnrolledBiometricsWithFaceID() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) stubAuthContext.expectBiometrics = true - stubAuthContext.biometryType = .faceID + if #available(iOS 11, macOS 10.15, *) { + stubAuthContext.biometryType = .faceID + + } var error: FlutterError? let result = plugin.getEnrolledBiometricsWithError(&error) @@ -335,8 +487,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testGetEnrolledBiometricsWithTouchID() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) stubAuthContext.expectBiometrics = true stubAuthContext.biometryType = .touchID @@ -350,8 +505,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testGetEnrolledBiometricsWithoutEnrolledHardware() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) stubAuthContext.expectBiometrics = true stubAuthContext.canEvaluateError = NSError( @@ -365,8 +523,11 @@ class FLALocalAuthPluginTests: XCTestCase { func testIsDeviceSupportedHandlesSupported() { let stubAuthContext = StubAuthContext() + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) var error: FlutterError? let result = plugin.isDeviceSupportedWithError(&error) @@ -378,8 +539,11 @@ class FLALocalAuthPluginTests: XCTestCase { let stubAuthContext = StubAuthContext() // An arbitrary error to cause canEvaluatePolicy to return false. stubAuthContext.canEvaluateError = NSError(domain: "error", code: 1) + let alertFactory = StubAlertFactory() + let viewProvider = StubViewProvider() let plugin = FLALocalAuthPlugin( - contextFactory: StubAuthContextFactory(contexts: [stubAuthContext])) + contextFactory: StubAuthContextFactory(contexts: [stubAuthContext]), + alertFactory: alertFactory, viewProvider: viewProvider) var error: FlutterError? let result = plugin.isDeviceSupportedWithError(&error) diff --git a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin.podspec b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin.podspec index e3947dd28175..9e2b96213be6 100644 --- a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin.podspec +++ b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin.podspec @@ -16,8 +16,11 @@ Downloaded by pub (not CocoaPods). s.documentation_url = 'https://pub.dev/packages/local_auth_darwin' s.source_files = 'local_auth_darwin/Sources/local_auth_darwin/**/*.{h,m}' s.public_header_files = 'local_auth_darwin/Sources/local_auth_darwin/include/**/*.h' - s.dependency 'Flutter' - s.platform = :ios, '12.0' + s.ios.dependency 'Flutter' + s.osx.dependency 'FlutterMacOS' + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.14' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.resource_bundles = {'local_auth_darwin_privacy' => ['local_auth_darwin/Sources/local_auth_darwin/Resources/PrivacyInfo.xcprivacy']} end diff --git a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/FLALocalAuthPlugin.m b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/FLALocalAuthPlugin.m index c8bc35980858..00cb00eb0a9b 100644 --- a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/FLALocalAuthPlugin.m +++ b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/FLALocalAuthPlugin.m @@ -68,6 +68,140 @@ @implementation FLADefaultAuthContextFactory #pragma mark - +#if TARGET_OS_OSX +/// A default alert that wraps NSAlert. +// TODO(stuartmorgan): When converting to Swift, eliminate this class and use an extension to make +// NSAlert declare conformance to FLANSAlert. +@interface FLADefaultNSAlert : NSObject +/// Returns a wrapper for the given NSAlert. +- (instancetype)initWithAlert:(NSAlert *)alert NS_DESIGNATED_INITIALIZER; +- (instancetype)init NS_UNAVAILABLE; + +/// The wrapped alert. +@property(nonatomic) NSAlert *alert; +@end + +@implementation FLADefaultNSAlert +- (instancetype)initWithAlert:(NSAlert *)alert { + self = [super init]; + if (self) { + _alert = alert; + } + return self; +} + +- (NSString *)messageText { + return self.alert.messageText; +} + +- (void)setMessageText:(NSString *)messageText { + self.alert.messageText = messageText; +} + +- (NSButton *)addButtonWithTitle:(NSString *)title { + return [self.alert addButtonWithTitle:title]; +} + +- (void)beginSheetModalForWindow:(NSWindow *)sheetWindow + completionHandler:(void (^_Nullable)(NSModalResponse returnCode))handler { + [self.alert beginSheetModalForWindow:sheetWindow completionHandler:handler]; +} +@end +#elif TARGET_OS_IOS +/// A default alert controller that wraps UIAlertController. +// TODO(stuartmorgan): When converting to Swift, eliminate this class and use an extension to make +// UIAlertController declare conformance to FLAUIAlertController. +@interface FLADefaultUIAlertController : NSObject +/// Returns a wrapper for the given UIAlertController. +- (instancetype)initWithAlertController:(UIAlertController *)controller NS_DESIGNATED_INITIALIZER; +- (instancetype)init NS_UNAVAILABLE; + +/// The wrapped alert controller. +@property(nonatomic) UIAlertController *controller; +@end + +@implementation FLADefaultUIAlertController +- (instancetype)initWithAlertController:(UIAlertController *)controller { + self = [super init]; + if (self) { + _controller = controller; + } + return self; +} + +- (void)addAction:(UIAlertAction *)action { + [self.controller addAction:action]; +} + +- (void)presentOnViewController:(UIViewController *)presentingViewController + animated:(BOOL)flag + completion:(void (^__nullable)(void))completion { + [presentingViewController presentViewController:self.controller + animated:flag + completion:completion]; +} +@end +#endif + +/// A default alert factory that wraps standard UIAlertController and NSAlert allocation for iOS and +/// macOS respectfully. +@interface FLADefaultAlertFactory : NSObject +@end + +@implementation FLADefaultAlertFactory + +#if TARGET_OS_OSX +- (NSObject *)createAlert { + // TODO(stuartmorgan): When converting to Swift, just return NSAlert here. + return [[FLADefaultNSAlert alloc] initWithAlert:[[NSAlert alloc] init]]; +} +#elif TARGET_OS_IOS +- (NSObject *)createAlertControllerWithTitle:(nullable NSString *)title + message:(nullable NSString *)message + preferredStyle: + (UIAlertControllerStyle)preferredStyle { + // TODO(stuartmorgan): When converting to Swift, just return UIAlertController here. + return [[FLADefaultUIAlertController alloc] + initWithAlertController:[UIAlertController alertControllerWithTitle:title + message:message + preferredStyle:preferredStyle]]; +} +#endif +@end + +#pragma mark - + +/// A default view provider that wraps the FlutterPluginRegistrar. +// TODO(stuartmorgan): When converting to Swift, eliminate this class and use an extension to make +// FlutterPluginRegistrar declare conformance to FLAViewProvider. +@interface FLADefaultViewProvider : NSObject +/// Returns a wrapper for the given registrar. +- (instancetype)initWithRegistrar:(NSObject *)registrar + NS_DESIGNATED_INITIALIZER; +- (instancetype)init NS_UNAVAILABLE; + +/// The wrapped registrar. +@property(nonatomic) NSObject *registrar; +@end + +@implementation FLADefaultViewProvider +- (instancetype)initWithRegistrar:(NSObject *)registrar { + self = [super init]; + if (self) { + _registrar = registrar; + } + return self; +} + +#if TARGET_OS_OSX +- (NSView *)view { + return self.registrar.view; +} +#endif +@end + +#pragma mark - + /// A data container for sticky auth state. @interface FLAStickyAuthState : NSObject @property(nonatomic, strong, nonnull) FLADAuthOptions *options; @@ -94,27 +228,45 @@ - (instancetype)initWithOptions:(nonnull FLADAuthOptions *)options #pragma mark - +/// A flutter plugin for local authentication. @interface FLALocalAuthPlugin () + +/// Manages the last call state for sticky auth. @property(nonatomic, strong, nullable) FLAStickyAuthState *lastCallState; + +/// The factory to create LAContexts. @property(nonatomic, strong) NSObject *authContextFactory; + +/// The factory to create alerts. +@property(nonatomic, strong) NSObject *alertFactory; + +/// The Flutter view provider. +@property(nonatomic, strong) NSObject *viewProvider; @end @implementation FLALocalAuthPlugin + (void)registerWithRegistrar:(NSObject *)registrar { - FLALocalAuthPlugin *instance = [[FLALocalAuthPlugin alloc] init]; + NSObject *alertFactory = [[FLADefaultAlertFactory alloc] init]; + NSObject *authContextFactory = + [[FLADefaultAuthContextFactory alloc] init]; + FLALocalAuthPlugin *instance = [[FLALocalAuthPlugin alloc] + initWithContextFactory:authContextFactory + alertFactory:alertFactory + viewProvider:[[FLADefaultViewProvider alloc] initWithRegistrar:registrar]]; [registrar addApplicationDelegate:instance]; SetUpFLADLocalAuthApi([registrar messenger], instance); } -- (instancetype)init { - return [self initWithContextFactory:[[FLADefaultAuthContextFactory alloc] init]]; -} - -- (instancetype)initWithContextFactory:(NSObject *)factory { +/// Returns an instance that uses the given factory to create LAContexts. +- (instancetype)initWithContextFactory:(NSObject *)authFactory + alertFactory:(NSObject *)alertFactory + viewProvider:(NSObject *)viewProvider { self = [super init]; if (self) { - _authContextFactory = factory; + _viewProvider = viewProvider; + _authContextFactory = authFactory; + _alertFactory = alertFactory; } return self; } @@ -178,9 +330,13 @@ - (nullable NSNumber *)deviceCanSupportBiometricsWithError: if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) { if (authError == nil) { - if (context.biometryType == LABiometryTypeFaceID) { - [biometrics addObject:[FLADAuthBiometricWrapper makeWithValue:FLADAuthBiometricFace]]; - } else if (context.biometryType == LABiometryTypeTouchID) { + if (@available(macOS 10.15, iOS 11.0, *)) { + if (context.biometryType == LABiometryTypeFaceID) { + [biometrics addObject:[FLADAuthBiometricWrapper makeWithValue:FLADAuthBiometricFace]]; + return biometrics; + } + } + if (context.biometryType == LABiometryTypeTouchID) { [biometrics addObject:[FLADAuthBiometricWrapper makeWithValue:FLADAuthBiometricFingerprint]]; } @@ -201,10 +357,21 @@ - (void)showAlertWithMessage:(NSString *)message dismissButtonTitle:(NSString *)dismissButtonTitle openSettingsButtonTitle:(NSString *)openSettingsButtonTitle completion:(FLADAuthCompletion)completion { - UIAlertController *alert = - [UIAlertController alertControllerWithTitle:@"" - message:message - preferredStyle:UIAlertControllerStyleAlert]; +#if TARGET_OS_OSX + id alert = [_alertFactory createAlert]; + alert.messageText = message; + [alert addButtonWithTitle:dismissButtonTitle]; + NSWindow *window = self.viewProvider.view.window; + [alert beginSheetModalForWindow:window + completionHandler:^(NSModalResponse returnCode) { + [self handleSucceeded:NO withCompletion:completion]; + }]; + return; +#elif TARGET_OS_IOS + id alert = + [_alertFactory createAlertControllerWithTitle:@"" + message:message + preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:dismissButtonTitle style:UIAlertActionStyleDefault @@ -227,9 +394,11 @@ - (void)showAlertWithMessage:(NSString *)message }]; [alert addAction:additionalAction]; } - [[UIApplication sharedApplication].delegate.window.rootViewController presentViewController:alert - animated:YES - completion:nil]; + [alert + presentOnViewController:[UIApplication sharedApplication].delegate.window.rootViewController + animated:YES + completion:nil]; +#endif } - (void)handleAuthReplyWithSuccess:(BOOL)success @@ -305,6 +474,8 @@ - (void)handleError:(NSError *)authError #pragma mark - AppDelegate +// This method is called when the app is resumed from the background only on iOS +#if TARGET_OS_IOS - (void)applicationDidBecomeActive:(UIApplication *)application { if (self.lastCallState != nil) { [self authenticateWithOptions:_lastCallState.options @@ -312,5 +483,6 @@ - (void)applicationDidBecomeActive:(UIApplication *)application { completion:_lastCallState.resultHandler]; } } +#endif @end diff --git a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin.h b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin.h index 7168f350fe04..e54e24be490f 100644 --- a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin.h +++ b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin.h @@ -1,10 +1,18 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#import +#if TARGET_OS_OSX +#import +#elif TARGET_OS_IOS #import +#endif #import "messages.g.h" @interface FLALocalAuthPlugin : NSObject + +- (instancetype)init NS_UNAVAILABLE; + @end diff --git a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin_Test.h b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin_Test.h index cfba07b8fb4f..685e61d4c8cc 100644 --- a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin_Test.h +++ b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/FLALocalAuthPlugin_Test.h @@ -1,8 +1,14 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#import +#if TARGET_OS_OSX +#import +#elif TARGET_OS_IOS #import +#endif + #import NS_ASSUME_NONNULL_BEGIN @@ -22,13 +28,72 @@ NS_ASSUME_NONNULL_BEGIN /// Protocol for a source of FLADAuthContext instances. Used to allow context injection in unit /// tests. @protocol FLADAuthContextFactory +- (NSObject *)createAuthContext; +@end + +#pragma mark - + +#if TARGET_OS_OSX +/// Protocol for interacting with NSAlert instances, abstracted to allow using mock/fake instances +/// in unit tests. +@protocol FLANSAlert @required -- (id)createAuthContext; +@property(copy) NSString *messageText; +- (NSButton *)addButtonWithTitle:(NSString *)title; +- (void)beginSheetModalForWindow:(NSWindow *)sheetWindow + completionHandler:(void (^_Nullable)(NSModalResponse returnCode))handler; @end +#endif // TARGET_OS_OSX + +#if TARGET_OS_IOS +/// Protocol for interacting with UIAlertController instances, abstracted to allow using mock/fake +/// instances in unit tests. +@protocol FLAUIAlertController +@required +- (void)addAction:(UIAlertAction *)action; +// Reversed wrapper of presentViewController:... since the protocol can't be passed to the real +// method. +- (void)presentOnViewController:(UIViewController *)presentingViewController + animated:(BOOL)flag + completion:(void (^__nullable)(void))completion NS_SWIFT_DISABLE_ASYNC; +@end +#endif // TARGET_OS_IOS + +/// Protocol for a source of alert factory that wraps standard UIAlertController and NSAlert +/// allocation for iOS and macOS respectfully. Used to allow context injection in unit tests. +@protocol FLADAlertFactory + +#if TARGET_OS_OSX +- (NSObject *)createAlert; +#elif TARGET_OS_IOS +- (NSObject *)createAlertControllerWithTitle:(nullable NSString *)title + message:(nullable NSString *)message + preferredStyle: + (UIAlertControllerStyle)preferredStyle; +#endif + +@end + +/// Protocol for a provider of the view containing the Flutter content, abstracted to allow using +/// mock/fake instances in unit tests. +@protocol FLAViewProvider +@required +#if TARGET_OS_OSX +@property(readonly, nonatomic) NSView *view; +#elif TARGET_OS_IOS +// TODO(stuartmorgan): Add a view accessor once https://github.com/flutter/flutter/issues/104117 +// is resolved, and use that in 'showAlertWithMessage:...'. +#endif + +@end + +#pragma mark - @interface FLALocalAuthPlugin () /// Returns an instance that uses the given factory to create LAContexts. -- (instancetype)initWithContextFactory:(NSObject *)factory +- (instancetype _Nonnull)initWithContextFactory:(NSObject *)authFactory + alertFactory:(NSObject *)alertFactory + viewProvider:(NSObject *)viewProvider NS_DESIGNATED_INITIALIZER; @end diff --git a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/messages.g.h b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/messages.g.h index e15d520472a8..7f77dc6ea9f5 100644 --- a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/messages.g.h +++ b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/include/local_auth_darwin/messages.g.h @@ -58,14 +58,14 @@ typedef NS_ENUM(NSUInteger, FLADAuthBiometric) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithReason:(NSString *)reason lockOut:(NSString *)lockOut - goToSettingsButton:(NSString *)goToSettingsButton - goToSettingsDescription:(NSString *)goToSettingsDescription + goToSettingsButton:(nullable NSString *)goToSettingsButton + goToSettingsDescription:(nullable NSString *)goToSettingsDescription cancelButton:(NSString *)cancelButton localizedFallbackTitle:(nullable NSString *)localizedFallbackTitle; @property(nonatomic, copy) NSString *reason; @property(nonatomic, copy) NSString *lockOut; -@property(nonatomic, copy) NSString *goToSettingsButton; -@property(nonatomic, copy) NSString *goToSettingsDescription; +@property(nonatomic, copy, nullable) NSString *goToSettingsButton; +@property(nonatomic, copy, nullable) NSString *goToSettingsDescription; @property(nonatomic, copy) NSString *cancelButton; @property(nonatomic, copy, nullable) NSString *localizedFallbackTitle; @end diff --git a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/messages.g.m b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/messages.g.m index 6ab8ee5edf95..7a316a14359f 100644 --- a/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/messages.g.m +++ b/packages/local_auth/local_auth_darwin/darwin/local_auth_darwin/Sources/local_auth_darwin/messages.g.m @@ -81,8 +81,8 @@ - (NSArray *)toList; @implementation FLADAuthStrings + (instancetype)makeWithReason:(NSString *)reason lockOut:(NSString *)lockOut - goToSettingsButton:(NSString *)goToSettingsButton - goToSettingsDescription:(NSString *)goToSettingsDescription + goToSettingsButton:(nullable NSString *)goToSettingsButton + goToSettingsDescription:(nullable NSString *)goToSettingsDescription cancelButton:(NSString *)cancelButton localizedFallbackTitle:(nullable NSString *)localizedFallbackTitle { FLADAuthStrings *pigeonResult = [[FLADAuthStrings alloc] init]; diff --git a/packages/local_auth/local_auth_darwin/example/.gitignore b/packages/local_auth/local_auth_darwin/example/.gitignore new file mode 100644 index 000000000000..29a3a5017f04 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/local_auth/local_auth_darwin/example/.metadata b/packages/local_auth/local_auth_darwin/example/.metadata new file mode 100644 index 000000000000..87b4b9ab251c --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "68bfaea224880b488c617afe30ab12091ea8fa4e" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e + base_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e + - platform: macos + create_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e + base_revision: 68bfaea224880b488c617afe30ab12091ea8fa4e + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/local_auth/local_auth_darwin/example/macos/.gitignore b/packages/local_auth/local_auth_darwin/example/macos/.gitignore new file mode 100644 index 000000000000..746adbb6b9e1 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Flutter/Flutter-Debug.xcconfig b/packages/local_auth/local_auth_darwin/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 000000000000..4b81f9b2d200 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/local_auth/local_auth_darwin/example/macos/Flutter/Flutter-Release.xcconfig b/packages/local_auth/local_auth_darwin/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 000000000000..5caa9d1579e4 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/local_auth/local_auth_darwin/example/macos/Podfile b/packages/local_auth/local_auth_darwin/example/macos/Podfile new file mode 100644 index 000000000000..c795730db8ed --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/project.pbxproj b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..8392afcc7297 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,820 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 274905EC52005E05DF633ACA /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 91FACED086369F6DB644E8B1 /* Pods_Runner.framework */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 3A858B24A41D64C4BF302405 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB20D00B3AAB343668A80A59 /* Pods_RunnerTests.framework */; }; + E62C10892C07DA2A000E3CCC /* FLALocalAuthPluginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E62C10882C07DA2A000E3CCC /* FLALocalAuthPluginTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 09A6D0964FC42F6CEB3383B0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 6DC2CC18007F1B81C5CD38EB /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 6E148E4EE27FBB2587C8CCE0 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 7C88C93F66E851DCCA28120C /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 8CA026E1D618025C0D52DD90 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 91FACED086369F6DB644E8B1 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + CB20D00B3AAB343668A80A59 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DC8BF0B04B7666C6A6EA0D26 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + E62C10882C07DA2A000E3CCC /* FLALocalAuthPluginTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FLALocalAuthPluginTests.swift; path = ../../../darwin/Tests/FLALocalAuthPluginTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3A858B24A41D64C4BF302405 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 274905EC52005E05DF633ACA /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + E62C10882C07DA2A000E3CCC /* FLALocalAuthPluginTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 42D886FD4D6805989133E5D0 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* example.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 42D886FD4D6805989133E5D0 /* Pods */ = { + isa = PBXGroup; + children = ( + 09A6D0964FC42F6CEB3383B0 /* Pods-Runner.debug.xcconfig */, + 8CA026E1D618025C0D52DD90 /* Pods-Runner.release.xcconfig */, + DC8BF0B04B7666C6A6EA0D26 /* Pods-Runner.profile.xcconfig */, + 7C88C93F66E851DCCA28120C /* Pods-RunnerTests.debug.xcconfig */, + 6E148E4EE27FBB2587C8CCE0 /* Pods-RunnerTests.release.xcconfig */, + 6DC2CC18007F1B81C5CD38EB /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 91FACED086369F6DB644E8B1 /* Pods_Runner.framework */, + CB20D00B3AAB343668A80A59 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 079FC72150E3D6C338EFB4FA /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + 4A22C8F8819194F5DFFCC074 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 15765A7727B689B854708867 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 42F7693C713BF5CD10521737 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + LastSwiftMigration = 1540; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 079FC72150E3D6C338EFB4FA /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 15765A7727B689B854708867 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 42F7693C713BF5CD10521737 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4A22C8F8819194F5DFFCC074 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RunnerTests/Pods-RunnerTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RunnerTests/Pods-RunnerTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RunnerTests/Pods-RunnerTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E62C10892C07DA2A000E3CCC /* FLALocalAuthPluginTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7C88C93F66E851DCCA28120C /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6E148E4EE27FBB2587C8CCE0 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6DC2CC18007F1B81C5CD38EB /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000000..15368eccb25a --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..21a3cc14c74e --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000000..18d981003d68 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/AppDelegate.swift b/packages/local_auth/local_auth_darwin/example/macos/Runner/AppDelegate.swift new file mode 100644 index 000000000000..5cec4c48f620 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000000..a2ec33f19f11 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 000000000000..82b6f9d9a33e Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 000000000000..13b35eba55c6 Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 000000000000..0a3f5fa40fb3 Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 000000000000..bdb57226d5f2 Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 000000000000..f083318e09ca Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 000000000000..326c0e72c9d8 Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 000000000000..2f1632cfddf3 Binary files /dev/null and b/packages/local_auth/local_auth_darwin/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Base.lproj/MainMenu.xib b/packages/local_auth/local_auth_darwin/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 000000000000..80e867a4e06b --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/AppInfo.xcconfig b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 000000000000..bdb88cb7b7e3 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.example + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2024 dev.flutter.plugins. All rights reserved. diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Debug.xcconfig b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 000000000000..36b0fd9464f4 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Release.xcconfig b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 000000000000..dff4f49561c8 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Warnings.xcconfig b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 000000000000..42bcbf4780b1 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/DebugProfile.entitlements b/packages/local_auth/local_auth_darwin/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 000000000000..dddb8a30c851 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Info.plist b/packages/local_auth/local_auth_darwin/example/macos/Runner/Info.plist new file mode 100644 index 000000000000..eeb242927f38 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSFaceIDUsageDescription + Test for local auth + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/MainFlutterWindow.swift b/packages/local_auth/local_auth_darwin/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 000000000000..f21908966e95 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,19 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/packages/local_auth/local_auth_darwin/example/macos/Runner/Release.entitlements b/packages/local_auth/local_auth_darwin/example/macos/Runner/Release.entitlements new file mode 100644 index 000000000000..852fa1a4728a --- /dev/null +++ b/packages/local_auth/local_auth_darwin/example/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart b/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart index 240aa6e6018e..4552330a2125 100644 --- a/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart +++ b/packages/local_auth/local_auth_darwin/lib/local_auth_darwin.dart @@ -2,24 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:io'; + import 'package:flutter/foundation.dart' show visibleForTesting; import 'package:flutter/services.dart'; import 'package:local_auth_platform_interface/local_auth_platform_interface.dart'; import 'src/messages.g.dart'; import 'types/auth_messages_ios.dart'; +import 'types/auth_messages_macos.dart'; export 'package:local_auth_darwin/types/auth_messages_ios.dart'; export 'package:local_auth_platform_interface/types/auth_messages.dart'; export 'package:local_auth_platform_interface/types/auth_options.dart'; export 'package:local_auth_platform_interface/types/biometric_type.dart'; -/// The implementation of [LocalAuthPlatform] for iOS. +/// The implementation of [LocalAuthPlatform] for iOS and macOS. class LocalAuthDarwin extends LocalAuthPlatform { /// Creates a new plugin implementation instance. LocalAuthDarwin({ @visibleForTesting LocalAuthApi? api, - }) : _api = api ?? LocalAuthApi(); + @visibleForTesting bool? overrideUseMacOSAuthMessages, + }) : _api = api ?? LocalAuthApi(), + _useMacOSAuthMessages = + overrideUseMacOSAuthMessages ?? Platform.isMacOS; /// Registers this class as the default instance of [LocalAuthPlatform]. static void registerWith() { @@ -27,6 +33,7 @@ class LocalAuthDarwin extends LocalAuthPlatform { } final LocalAuthApi _api; + final bool _useMacOSAuthMessages; @override Future authenticate({ @@ -40,7 +47,9 @@ class LocalAuthDarwin extends LocalAuthPlatform { biometricOnly: options.biometricOnly, sticky: options.stickyAuth, useErrorDialogs: options.useErrorDialogs), - _pigeonStringsFromAuthMessages(localizedReason, authMessages)); + _useMacOSAuthMessages + ? _pigeonStringsFromMacOSAuthMessages(localizedReason, authMessages) + : _pigeonStringsFromiOSAuthMessages(localizedReason, authMessages)); // TODO(stuartmorgan): Replace this with structured errors, coordinated // across all platform implementations, per // https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#platform-exception-handling @@ -93,11 +102,11 @@ class LocalAuthDarwin extends LocalAuthPlatform { @override Future isDeviceSupported() async => _api.isDeviceSupported(); - /// Always returns false as this method is not supported on iOS. + /// Always returns false as this method is not supported on iOS or macOS. @override Future stopAuthentication() async => false; - AuthStrings _pigeonStringsFromAuthMessages( + AuthStrings _pigeonStringsFromiOSAuthMessages( String localizedReason, Iterable messagesList) { IOSAuthMessages? messages; for (final AuthMessages entry in messagesList) { @@ -118,4 +127,23 @@ class LocalAuthDarwin extends LocalAuthPlatform { localizedFallbackTitle: messages?.localizedFallbackTitle, ); } + + AuthStrings _pigeonStringsFromMacOSAuthMessages( + String localizedReason, Iterable messagesList) { + MacOSAuthMessages? messages; + for (final AuthMessages entry in messagesList) { + if (entry is MacOSAuthMessages) { + messages = entry; + break; + } + } + return AuthStrings( + reason: localizedReason, + lockOut: messages?.lockOut ?? macOSLockOut, + goToSettingsDescription: + messages?.goToSettingsDescription ?? macOSGoToSettingsDescription, + cancelButton: messages?.cancelButton ?? macOSCancelButton, + localizedFallbackTitle: messages?.localizedFallbackTitle, + ); + } } diff --git a/packages/local_auth/local_auth_darwin/lib/src/messages.g.dart b/packages/local_auth/local_auth_darwin/lib/src/messages.g.dart index a3d722da5ec9..25ccf3d46cb7 100644 --- a/packages/local_auth/local_auth_darwin/lib/src/messages.g.dart +++ b/packages/local_auth/local_auth_darwin/lib/src/messages.g.dart @@ -49,8 +49,8 @@ class AuthStrings { AuthStrings({ required this.reason, required this.lockOut, - required this.goToSettingsButton, - required this.goToSettingsDescription, + this.goToSettingsButton, + this.goToSettingsDescription, required this.cancelButton, this.localizedFallbackTitle, }); @@ -59,9 +59,9 @@ class AuthStrings { String lockOut; - String goToSettingsButton; + String? goToSettingsButton; - String goToSettingsDescription; + String? goToSettingsDescription; String cancelButton; @@ -83,8 +83,8 @@ class AuthStrings { return AuthStrings( reason: result[0]! as String, lockOut: result[1]! as String, - goToSettingsButton: result[2]! as String, - goToSettingsDescription: result[3]! as String, + goToSettingsButton: result[2] as String?, + goToSettingsDescription: result[3] as String?, cancelButton: result[4]! as String, localizedFallbackTitle: result[5] as String?, ); diff --git a/packages/local_auth/local_auth_darwin/lib/types/auth_messages_macos.dart b/packages/local_auth/local_auth_darwin/lib/types/auth_messages_macos.dart new file mode 100644 index 000000000000..16ce91a15bb8 --- /dev/null +++ b/packages/local_auth/local_auth_darwin/lib/types/auth_messages_macos.dart @@ -0,0 +1,87 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/foundation.dart'; +import 'package:intl/intl.dart'; +import 'package:local_auth_platform_interface/types/auth_messages.dart'; + +/// Class wrapping all authentication messages needed on macOS. +/// Provides default values for all messages. +@immutable +class MacOSAuthMessages extends AuthMessages { + /// Constructs a new instance. + const MacOSAuthMessages({ + this.lockOut, + this.goToSettingsDescription, + this.cancelButton, + this.localizedFallbackTitle, + }); + + /// Message advising the user to re-enable biometrics on their device. + final String? lockOut; + + /// Message advising the user to go to the settings and configure Biometrics + /// for their device. + final String? goToSettingsDescription; + + /// Message shown on a button that the user can click to leave the current + /// dialog. + /// Maximum 30 characters. + final String? cancelButton; + + /// The localized title for the fallback button in the dialog presented to + /// the user during authentication. + final String? localizedFallbackTitle; + + @override + Map get args { + return { + 'lockOut': lockOut ?? macOSLockOut, + 'okButton': cancelButton ?? macOSCancelButton, + if (localizedFallbackTitle != null) + 'localizedFallbackTitle': localizedFallbackTitle!, + }; + } + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MacOSAuthMessages && + runtimeType == other.runtimeType && + lockOut == other.lockOut && + cancelButton == other.cancelButton && + localizedFallbackTitle == other.localizedFallbackTitle; + + @override + int get hashCode => Object.hash( + super.hashCode, + lockOut, + cancelButton, + localizedFallbackTitle, + ); +} + +// Default Strings for MacOSAuthMessages plugin. Currently supports English. +// Intl.message must be string literals. + +/// Message advising the user to re-enable biometrics on their device. +/// It shows in a dialog on macOS. +String get macOSLockOut => Intl.message( + 'Biometric authentication is disabled. Please restart your computer and try again.', + desc: 'Message advising the user to re-enable biometrics on their device.'); + +/// Message advising the user to go to the settings and configure Biometrics +/// for their device. +String get macOSGoToSettingsDescription => Intl.message( + 'Biometric authentication is not set up on your device. Please enable ' + 'Touch ID on your computer in the Settings app.', + desc: + 'Message advising the user to go to the settings and configure Biometrics ' + 'for their device.'); + +/// Message shown on a button that the user can click to leave the current +/// dialog. +String get macOSCancelButton => Intl.message('OK', + desc: 'Message showed on a button that the user can click to leave the ' + 'current dialog. Maximum 30 characters.'); diff --git a/packages/local_auth/local_auth_darwin/pigeons/messages.dart b/packages/local_auth/local_auth_darwin/pigeons/messages.dart index 121e89886516..7f35a7208997 100644 --- a/packages/local_auth/local_auth_darwin/pigeons/messages.dart +++ b/packages/local_auth/local_auth_darwin/pigeons/messages.dart @@ -25,16 +25,16 @@ class AuthStrings { const AuthStrings({ required this.reason, required this.lockOut, - required this.goToSettingsButton, - required this.goToSettingsDescription, + this.goToSettingsButton, + this.goToSettingsDescription, required this.cancelButton, required this.localizedFallbackTitle, }); final String reason; final String lockOut; - final String goToSettingsButton; - final String goToSettingsDescription; + final String? goToSettingsButton; + final String? goToSettingsDescription; final String cancelButton; final String? localizedFallbackTitle; } diff --git a/packages/local_auth/local_auth_darwin/pubspec.yaml b/packages/local_auth/local_auth_darwin/pubspec.yaml index 05a6be6cd59a..3dd236aac1f4 100644 --- a/packages/local_auth/local_auth_darwin/pubspec.yaml +++ b/packages/local_auth/local_auth_darwin/pubspec.yaml @@ -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: 1.3.1 +version: 1.4.0 environment: sdk: ^3.2.3 @@ -16,6 +16,10 @@ flutter: pluginClass: FLALocalAuthPlugin dartPluginClass: LocalAuthDarwin sharedDarwinSource: true + macos: + pluginClass: FLALocalAuthPlugin + dartPluginClass: LocalAuthDarwin + sharedDarwinSource: true dependencies: flutter: diff --git a/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart b/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart index 6075b50571f8..4dfc2646e267 100644 --- a/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart +++ b/packages/local_auth/local_auth_darwin/test/local_auth_darwin_test.dart @@ -6,6 +6,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:local_auth_darwin/local_auth_darwin.dart'; import 'package:local_auth_darwin/src/messages.g.dart'; +import 'package:local_auth_darwin/types/auth_messages_macos.dart'; import 'package:local_auth_platform_interface/local_auth_platform_interface.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -86,6 +87,8 @@ void main() { group('authenticate', () { group('strings', () { test('passes default values when nothing is provided', () async { + plugin = LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: false); + when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails(result: AuthResult.success)); @@ -108,6 +111,8 @@ void main() { test('passes default values when only other platform values are provided', () async { + plugin = LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: false); + when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails(result: AuthResult.success)); @@ -129,7 +134,78 @@ void main() { expect(strings.localizedFallbackTitle, null); }); - test('passes all non-default values correctly', () async { + test( + 'passes default values when only MacOSAuthMessages platform values are provided', + () async { + plugin = LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: true); + + when(api.authenticate(any, any)).thenAnswer( + (_) async => AuthResultDetails(result: AuthResult.success)); + + const String reason = 'test reason'; + await plugin.authenticate( + localizedReason: reason, + authMessages: [const MacOSAuthMessages()]); + + final VerificationResult result = + verify(api.authenticate(any, captureAny)); + final AuthStrings strings = result.captured[0] as AuthStrings; + expect(strings.reason, reason); + // These should all be the default values from + // auth_messages_ios.dart + expect(strings.lockOut, macOSLockOut); + expect(strings.goToSettingsDescription, macOSGoToSettingsDescription); + expect(strings.cancelButton, macOSCancelButton); + expect(strings.localizedFallbackTitle, null); + }); + + test( + 'passes all non-default values correctly with IOSAuthMessages', + () async { + plugin = + LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: false); + + when(api.authenticate(any, any)).thenAnswer( + (_) async => AuthResultDetails(result: AuthResult.success)); + + // These are arbitrary values; all that matters is that: + // - they are different from the defaults, and + // - they are different from each other. + const String reason = 'A'; + const String lockOut = 'B'; + const String goToSettingsButton = 'C'; + const String gotToSettingsDescription = 'D'; + const String cancel = 'E'; + const String localizedFallbackTitle = 'F'; + + await plugin.authenticate( + localizedReason: reason, + authMessages: [ + const IOSAuthMessages( + lockOut: lockOut, + goToSettingsButton: goToSettingsButton, + goToSettingsDescription: gotToSettingsDescription, + cancelButton: cancel, + localizedFallbackTitle: localizedFallbackTitle, + ), + AnotherPlatformAuthMessages(), + ]); + + final VerificationResult result = + verify(api.authenticate(any, captureAny)); + final AuthStrings strings = result.captured[0] as AuthStrings; + expect(strings.reason, reason); + expect(strings.lockOut, lockOut); + expect(strings.goToSettingsButton, goToSettingsButton); + expect(strings.goToSettingsDescription, gotToSettingsDescription); + expect(strings.cancelButton, cancel); + expect(strings.localizedFallbackTitle, localizedFallbackTitle); + }, + ); + + test('passes all non-default values correctly with MacOSAuthMessages', + () async { + plugin = LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: true); when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails(result: AuthResult.success)); @@ -138,16 +214,12 @@ void main() { // - they are different from each other. const String reason = 'A'; const String lockOut = 'B'; - const String goToSettingsButton = 'C'; - const String gotToSettingsDescription = 'D'; const String cancel = 'E'; const String localizedFallbackTitle = 'F'; await plugin .authenticate(localizedReason: reason, authMessages: [ - const IOSAuthMessages( + const MacOSAuthMessages( lockOut: lockOut, - goToSettingsButton: goToSettingsButton, - goToSettingsDescription: gotToSettingsDescription, cancelButton: cancel, localizedFallbackTitle: localizedFallbackTitle, ), @@ -159,13 +231,13 @@ void main() { final AuthStrings strings = result.captured[0] as AuthStrings; expect(strings.reason, reason); expect(strings.lockOut, lockOut); - expect(strings.goToSettingsButton, goToSettingsButton); - expect(strings.goToSettingsDescription, gotToSettingsDescription); expect(strings.cancelButton, cancel); expect(strings.localizedFallbackTitle, localizedFallbackTitle); }); test('passes provided messages with default fallbacks', () async { + plugin = LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: false); + when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails(result: AuthResult.success)); @@ -202,6 +274,8 @@ void main() { group('options', () { test('passes default values', () async { + plugin = LocalAuthDarwin(api: api, overrideUseMacOSAuthMessages: false); + when(api.authenticate(any, any)).thenAnswer( (_) async => AuthResultDetails(result: AuthResult.success));