Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Format pigeon file
  • Loading branch information
okorohelijah committed Aug 4, 2025
commit 187bbbedec67edb823a264ada115166e8a8172ea
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool {

func deepHashmessages(value: Any?, hasher: inout Hasher) {
if let valueList = value as? [AnyHashable] {
for item in valueList { deepHashmessages(value: item, hasher: &hasher) }
return
for item in valueList { deepHashmessages(value: item, hasher: &hasher) }
return
}

if let valueDict = value as? [AnyHashable: AnyHashable] {
for key in valueDict.keys {
for key in valueDict.keys {
hasher.combine(key)
deepHashmessages(value: valueDict[key]!, hasher: &hasher)
}
Expand All @@ -129,6 +129,8 @@ func deepHashmessages(value: Any?, hasher: inout Hasher) {
return hasher.combine(String(describing: value))
}



/// Possible outcomes of an authentication attempt.
enum AuthResult: Int {
/// The user authenticated successfully.
Expand Down Expand Up @@ -168,6 +170,7 @@ struct AuthStrings: Hashable {
var cancelButton: String
var localizedFallbackTitle: String? = nil


// swift-format-ignore: AlwaysUseLowerCamelCase
static func fromList(_ pigeonVar_list: [Any?]) -> AuthStrings? {
let reason = pigeonVar_list[0] as! String
Expand Down Expand Up @@ -197,8 +200,7 @@ struct AuthStrings: Hashable {
]
}
static func == (lhs: AuthStrings, rhs: AuthStrings) -> Bool {
return deepEqualsmessages(lhs.toList(), rhs.toList())
}
return deepEqualsmessages(lhs.toList(), rhs.toList()) }
func hash(into hasher: inout Hasher) {
deepHashmessages(value: toList(), hasher: &hasher)
}
Expand All @@ -210,6 +212,7 @@ struct AuthOptions: Hashable {
var sticky: Bool
var useErrorDialogs: Bool


// swift-format-ignore: AlwaysUseLowerCamelCase
static func fromList(_ pigeonVar_list: [Any?]) -> AuthOptions? {
let biometricOnly = pigeonVar_list[0] as! Bool
Expand All @@ -230,8 +233,7 @@ struct AuthOptions: Hashable {
]
}
static func == (lhs: AuthOptions, rhs: AuthOptions) -> Bool {
return deepEqualsmessages(lhs.toList(), rhs.toList())
}
return deepEqualsmessages(lhs.toList(), rhs.toList()) }
func hash(into hasher: inout Hasher) {
deepHashmessages(value: toList(), hasher: &hasher)
}
Expand All @@ -246,6 +248,7 @@ struct AuthResultDetails: Hashable {
/// System-provided error details, if any.
var errorDetails: String? = nil


// swift-format-ignore: AlwaysUseLowerCamelCase
static func fromList(_ pigeonVar_list: [Any?]) -> AuthResultDetails? {
let result = pigeonVar_list[0] as! AuthResult
Expand All @@ -266,8 +269,7 @@ struct AuthResultDetails: Hashable {
]
}
static func == (lhs: AuthResultDetails, rhs: AuthResultDetails) -> Bool {
return deepEqualsmessages(lhs.toList(), rhs.toList())
}
return deepEqualsmessages(lhs.toList(), rhs.toList()) }
func hash(into hasher: inout Hasher) {
deepHashmessages(value: toList(), hasher: &hasher)
}
Expand Down Expand Up @@ -337,6 +339,7 @@ class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter())
}


/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol LocalAuthApi {
/// Returns true if this device supports authentication.
Expand All @@ -349,23 +352,17 @@ protocol LocalAuthApi {
func getEnrolledBiometrics() throws -> [AuthBiometric]
/// Attempts to authenticate the user with the provided [options], and using
/// [strings] for any UI.
func authenticate(
options: AuthOptions, strings: AuthStrings,
completion: @escaping (Result<AuthResultDetails, Error>) -> Void)
func authenticate(options: AuthOptions, strings: AuthStrings, completion: @escaping (Result<AuthResultDetails, Error>) -> Void)
}

/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
class LocalAuthApiSetup {
static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared }
/// Sets up an instance of `LocalAuthApi` to handle messages through the `binaryMessenger`.
static func setUp(
binaryMessenger: FlutterBinaryMessenger, api: LocalAuthApi?, messageChannelSuffix: String = ""
) {
static func setUp(binaryMessenger: FlutterBinaryMessenger, api: LocalAuthApi?, messageChannelSuffix: String = "") {
let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : ""
/// Returns true if this device supports authentication.
let isDeviceSupportedChannel = FlutterBasicMessageChannel(
name: "dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.isDeviceSupported\(channelSuffix)",
binaryMessenger: binaryMessenger, codec: codec)
let isDeviceSupportedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.isDeviceSupported\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
isDeviceSupportedChannel.setMessageHandler { _, reply in
do {
Expand All @@ -380,10 +377,7 @@ class LocalAuthApiSetup {
}
/// Returns true if this device can support biometric authentication, whether
/// any biometrics are enrolled or not.
let deviceCanSupportBiometricsChannel = FlutterBasicMessageChannel(
name:
"dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.deviceCanSupportBiometrics\(channelSuffix)",
binaryMessenger: binaryMessenger, codec: codec)
let deviceCanSupportBiometricsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.deviceCanSupportBiometrics\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
deviceCanSupportBiometricsChannel.setMessageHandler { _, reply in
do {
Expand All @@ -398,10 +392,7 @@ class LocalAuthApiSetup {
}
/// Returns the biometric types that are enrolled, and can thus be used
/// without additional setup.
let getEnrolledBiometricsChannel = FlutterBasicMessageChannel(
name:
"dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.getEnrolledBiometrics\(channelSuffix)",
binaryMessenger: binaryMessenger, codec: codec)
let getEnrolledBiometricsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.getEnrolledBiometrics\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
getEnrolledBiometricsChannel.setMessageHandler { _, reply in
do {
Expand All @@ -416,9 +407,7 @@ class LocalAuthApiSetup {
}
/// Attempts to authenticate the user with the provided [options], and using
/// [strings] for any UI.
let authenticateChannel = FlutterBasicMessageChannel(
name: "dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.authenticate\(channelSuffix)",
binaryMessenger: binaryMessenger, codec: codec)
let authenticateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.local_auth_darwin.LocalAuthApi.authenticate\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
authenticateChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
Expand Down