Skip to content

[local_auth]: Renamed local_auth_ios to local_auth_darwin #5809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ packages/google_sign_in/google_sign_in_ios/** @vashworth
packages/image_picker/image_picker_ios/** @vashworth
packages/in_app_purchase/in_app_purchase_storekit/** @louisehsu
packages/ios_platform_images/** @jmagman
packages/local_auth/local_auth_ios/** @louisehsu
packages/local_auth/local_auth_darwin/** @louisehsu
packages/path_provider/path_provider_foundation/** @jmagman
packages/pointer_interceptor/pointer_interceptor_ios/** @ditman
packages/quick_actions/quick_actions_ios/** @hellohuanlin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ Anton Borries <[email protected]>
Alex Li <[email protected]>
Rahul Raj <[email protected]>
Bodhi Mulders <[email protected]>
Om Phatak <[email protected]>
3 changes: 3 additions & 0 deletions packages/local_auth/local_auth_darwin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.2.0

* Renames the package previously published as [`local_auth_ios`](https://pub.dev/packages/local_auth_ios)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# local\_auth\_ios
# local_auth_darwin

The iOS implementation of [`local_auth`][1].

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// Autogenerated from Pigeon (v13.1.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import <Foundation/Foundation.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// Autogenerated from Pigeon (v13.1.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import "messages.g.h"
Expand All @@ -16,6 +16,20 @@
#error File requires ARC to be enabled.
#endif

static NSArray *wrapResult(id result, FlutterError *error) {
if (error) {
return @[
error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null]
];
}
return @[ result ?: [NSNull null] ];
}

static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
id result = array[key];
return (result == [NSNull null]) ? nil : result;
}

/// Possible outcomes of an authentication attempt.
@implementation FLAAuthResultBox
- (instancetype)initWithValue:(FLAAuthResult)value {
Expand All @@ -38,19 +52,6 @@ - (instancetype)initWithValue:(FLAAuthBiometric)value {
}
@end

static NSArray *wrapResult(id result, FlutterError *error) {
if (error) {
return @[
error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null]
];
}
return @[ result ?: [NSNull null] ];
}
static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
id result = array[key];
return (result == [NSNull null]) ? nil : result;
}

@interface FLAAuthStrings ()
+ (FLAAuthStrings *)fromList:(NSArray *)list;
+ (nullable FLAAuthStrings *)nullableFromList:(NSArray *)list;
Expand Down Expand Up @@ -263,7 +264,7 @@ void SetUpFLALocalAuthApi(id<FlutterBinaryMessenger> binaryMessenger,
/// Returns true if this device supports authentication.
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.local_auth_ios.LocalAuthApi.isDeviceSupported"
initWithName:@"dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.isDeviceSupported"
binaryMessenger:binaryMessenger
codec:FLALocalAuthApiGetCodec()];
if (api) {
Expand All @@ -284,7 +285,8 @@ void SetUpFLALocalAuthApi(id<FlutterBinaryMessenger> binaryMessenger,
/// any biometrics are enrolled or not.
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.local_auth_ios.LocalAuthApi.deviceCanSupportBiometrics"
initWithName:
@"dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.deviceCanSupportBiometrics"
binaryMessenger:binaryMessenger
codec:FLALocalAuthApiGetCodec()];
if (api) {
Expand All @@ -305,7 +307,7 @@ void SetUpFLALocalAuthApi(id<FlutterBinaryMessenger> binaryMessenger,
/// without additional setup.
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.local_auth_ios.LocalAuthApi.getEnrolledBiometrics"
initWithName:@"dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.getEnrolledBiometrics"
binaryMessenger:binaryMessenger
codec:FLALocalAuthApiGetCodec()];
if (api) {
Expand All @@ -326,7 +328,7 @@ void SetUpFLALocalAuthApi(id<FlutterBinaryMessenger> binaryMessenger,
/// [strings] for any UI.
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.local_auth_ios.LocalAuthApi.authenticate"
initWithName:@"dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.authenticate"
binaryMessenger:binaryMessenger
codec:FLALocalAuthApiGetCodec()];
if (api) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@import LocalAuthentication;
@import XCTest;
@import local_auth_ios;
@import local_auth_darwin;

#import <OCMock/OCMock.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
Copy link
Member

@jmagman jmagman Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this needs the PrivacyInfo.xcprivacy pulled in and resource_bundles updated to local_auth_darwin_privacy:

 -> local_auth_darwin (0.0.1)
    - NOTE  | url: The URL (https://pub.dev/packages/local_auth_darwin) is not reachable.
    - ERROR | [iOS] file patterns: The `resource_bundles` pattern for `local_auth_ios_privacy` did not match any file.

Log

See https://github.com/flutter/packages/pull/5846/files#diff-3224e4fc5e9a47bae7d7c5dcc243e869174b97b0b4e8572a6e58fde8c0b3f5d5

#
Pod::Spec.new do |s|
s.name = 'local_auth_ios'
s.name = 'local_auth_darwin'
s.version = '0.0.1'
s.summary = 'Flutter Local Auth'
s.description = <<-DESC
Expand All @@ -13,12 +13,12 @@ Downloaded by pub (not CocoaPods).
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/local_auth' }
s.documentation_url = 'https://pub.dev/packages/local_auth_ios'
s.documentation_url = 'https://pub.dev/packages/local_auth_darwin'
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.platform = :ios, '12.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.resource_bundles = {'local_auth_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
s.resource_bundles = {'local_auth_darwin_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
end

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'package:local_auth_ios/local_auth_ios.dart';
import 'package:local_auth_darwin/local_auth_darwin.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets('canCheckBiometrics', (WidgetTester tester) async {
expect(
LocalAuthIOS().getEnrolledBiometrics(),
LocalAuthDarwin().getEnrolledBiometrics(),
completion(isList),
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
3398D2D126163948005A052F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3398D2DC261649CD005A052F /* liblocal_auth.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocal_auth.a; sourceTree = BUILT_PRODUCTS_DIR; };
3398D2DF26164A03005A052F /* liblocal_auth.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocal_auth.a; sourceTree = BUILT_PRODUCTS_DIR; };
3398D2E326164AD8005A052F /* FLTLocalAuthPluginTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLTLocalAuthPluginTests.m; sourceTree = "<group>"; };
3398D2E326164AD8005A052F /* FLTLocalAuthPluginTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FLTLocalAuthPluginTests.m; path = ../../darwin/Tests/FLTLocalAuthPluginTests.m; sourceTree = SOURCE_ROOT; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
658CDD04B21E4EA92F8EF229 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -359,11 +359,11 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/local_auth_ios/local_auth_ios_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/local_auth_darwin/local_auth_darwin_privacy.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/local_auth_ios_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/local_auth_darwin_privacy.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:local_auth_ios/local_auth_ios.dart';
import 'package:local_auth_darwin/local_auth_darwin.dart';
import 'package:local_auth_platform_interface/local_auth_platform_interface.dart';

void main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: local_auth_ios_example
description: Demonstrates how to use the local_auth_ios plugin.
name: local_auth_darwin_example
description: Demonstrates how to use the local_auth_darwin plugin.
publish_to: none

environment:
Expand All @@ -9,9 +9,9 @@ environment:
dependencies:
flutter:
sdk: flutter
local_auth_ios:
local_auth_darwin:
# When depending on this package from a real application you should use:
# local_auth: ^x.y.z
# local_auth_darwin: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import 'package:local_auth_platform_interface/local_auth_platform_interface.dart
import 'src/messages.g.dart';
import 'types/auth_messages_ios.dart';

export 'package:local_auth_ios/types/auth_messages_ios.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.
class LocalAuthIOS extends LocalAuthPlatform {
class LocalAuthDarwin extends LocalAuthPlatform {
/// Creates a new plugin implementation instance.
LocalAuthIOS({
LocalAuthDarwin({
@visibleForTesting LocalAuthApi? api,
}) : _api = api ?? LocalAuthApi();

/// Registers this class as the default instance of [LocalAuthPlatform].
static void registerWith() {
LocalAuthPlatform.instance = LocalAuthIOS();
LocalAuthPlatform.instance = LocalAuthDarwin();
}

final LocalAuthApi _api;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// Autogenerated from Pigeon (v13.1.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

Expand All @@ -11,15 +11,11 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';

List<Object?> wrapResponse(
{Object? result, PlatformException? error, bool empty = false}) {
if (empty) {
return <Object?>[];
}
if (error == null) {
return <Object?>[result];
}
return <Object?>[error.code, error.message, error.details];
PlatformException _createConnectionError(String channelName) {
return PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel: "$channelName".',
);
}

/// Possible outcomes of an authentication attempt.
Expand Down Expand Up @@ -231,16 +227,16 @@ class LocalAuthApi {

/// Returns true if this device supports authentication.
Future<bool> isDeviceSupported() async {
const String channelName =
'dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.isDeviceSupported';
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.local_auth_ios.LocalAuthApi.isDeviceSupported',
codec,
binaryMessenger: _binaryMessenger);
channelName,
codec,
binaryMessenger: _binaryMessenger,
);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
throw _createConnectionError(channelName);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
Expand All @@ -260,16 +256,16 @@ class LocalAuthApi {
/// Returns true if this device can support biometric authentication, whether
/// any biometrics are enrolled or not.
Future<bool> deviceCanSupportBiometrics() async {
const String channelName =
'dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.deviceCanSupportBiometrics';
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.local_auth_ios.LocalAuthApi.deviceCanSupportBiometrics',
codec,
binaryMessenger: _binaryMessenger);
channelName,
codec,
binaryMessenger: _binaryMessenger,
);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
throw _createConnectionError(channelName);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
Expand All @@ -289,16 +285,16 @@ class LocalAuthApi {
/// Returns the biometric types that are enrolled, and can thus be used
/// without additional setup.
Future<List<AuthBiometricWrapper?>> getEnrolledBiometrics() async {
const String channelName =
'dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.getEnrolledBiometrics';
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.local_auth_ios.LocalAuthApi.getEnrolledBiometrics',
codec,
binaryMessenger: _binaryMessenger);
channelName,
codec,
binaryMessenger: _binaryMessenger,
);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
throw _createConnectionError(channelName);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
Expand All @@ -319,16 +315,17 @@ class LocalAuthApi {
/// [strings] for any UI.
Future<AuthResultDetails> authenticate(
AuthOptions arg_options, AuthStrings arg_strings) async {
const String channelName =
'dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.authenticate';
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.local_auth_ios.LocalAuthApi.authenticate', codec,
binaryMessenger: _binaryMessenger);
channelName,
codec,
binaryMessenger: _binaryMessenger,
);
final List<Object?>? replyList = await channel
.send(<Object?>[arg_options, arg_strings]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
throw _createConnectionError(channelName);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'package:pigeon/pigeon.dart';

@ConfigurePigeon(PigeonOptions(
dartOut: 'lib/src/messages.g.dart',
objcHeaderOut: 'ios/Classes/messages.g.h',
objcSourceOut: 'ios/Classes/messages.g.m',
objcHeaderOut: 'darwin/Classes/messages.g.h',
objcSourceOut: 'darwin/Classes/messages.g.m',
objcOptions: ObjcOptions(
prefix: 'FLA',
),
Expand Down
Loading