// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Autogenerated from Pigeon (v10.1.2), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation #if os(iOS) import Flutter #elseif os(macOS) import FlutterMacOS #else #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { return [result] } private func wrapError(_ error: Any) -> [Any?] { if let flutterError = error as? FlutterError { return [ flutterError.code, flutterError.message, flutterError.details ] } return [ "\(error)", "\(type(of: error))", "Stacktrace: \(Thread.callStackSymbols)" ] } private func nilOrValue(_ value: Any?) -> T? { if value is NSNull { return nil } return value as! T? } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol LegacyNativePlugin { func configure(config: String, completion: @escaping (Result) -> Void) func signOut(completion: @escaping (Result) -> Void) func signIn(username: String, password: String, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class LegacyNativePluginSetup { /// The codec used by LegacyNativePlugin. /// Sets up an instance of `LegacyNativePlugin` to handle messages through the `binaryMessenger`. static func setUp(binaryMessenger: FlutterBinaryMessenger, api: LegacyNativePlugin?) { let configureChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.LegacyNativePlugin.configure", binaryMessenger: binaryMessenger) if let api = api { configureChannel.setMessageHandler { message, reply in let args = message as! [Any?] let configArg = args[0] as! String api.configure(config: configArg) { result in switch result { case .success: reply(wrapResult(nil)) case .failure(let error): reply(wrapError(error)) } } } } else { configureChannel.setMessageHandler(nil) } let signOutChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.LegacyNativePlugin.signOut", binaryMessenger: binaryMessenger) if let api = api { signOutChannel.setMessageHandler { _, reply in api.signOut() { result in switch result { case .success: reply(wrapResult(nil)) case .failure(let error): reply(wrapError(error)) } } } } else { signOutChannel.setMessageHandler(nil) } let signInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.LegacyNativePlugin.signIn", binaryMessenger: binaryMessenger) if let api = api { signInChannel.setMessageHandler { message, reply in let args = message as! [Any?] let usernameArg = args[0] as! String let passwordArg = args[1] as! String api.signIn(username: usernameArg, password: passwordArg) { result in switch result { case .success: reply(wrapResult(nil)) case .failure(let error): reply(wrapError(error)) } } } } else { signInChannel.setMessageHandler(nil) } } }