Skip to content

Commit

Permalink
Moved generated pigeon code for iOS into a dedicated folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-SD committed Feb 5, 2025
1 parent fe37dc2 commit ef6b1e3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.4.0

### New

- Set minimum SDK version to Flutter 3.16/Dart 3.2

## 1.3.0

### New
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
#endif

/// Error class for passing custom error details to Dart side.
final class PigeonError: Error {
final class AdyenPigeonError: Error {
let code: String
let message: String?
let details: Any?
Expand All @@ -25,7 +25,7 @@ final class PigeonError: Error {

var localizedDescription: String {
return
"PigeonError(code: \(code), message: \(message ?? "<nil>"), details: \(details ?? "<nil>")"
"AdyenPigeonError(code: \(code), message: \(message ?? "<nil>"), details: \(details ?? "<nil>")"
}
}

Expand All @@ -34,7 +34,7 @@ private func wrapResult(_ result: Any?) -> [Any?] {
}

private func wrapError(_ error: Any) -> [Any?] {
if let pigeonError = error as? PigeonError {
if let pigeonError = error as? AdyenPigeonError {
return [
pigeonError.code,
pigeonError.message,
Expand All @@ -55,8 +55,8 @@ private func wrapError(_ error: Any) -> [Any?] {
]
}

private func createConnectionError(withChannelName channelName: String) -> PigeonError {
return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "")
private func createConnectionError(withChannelName channelName: String) -> AdyenPigeonError {
return AdyenPigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "")
}

private func isNullish(_ value: Any?) -> Bool {
Expand Down Expand Up @@ -1912,8 +1912,8 @@ class DropInPlatformInterfaceSetup {
}
/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift.
protocol DropInFlutterInterfaceProtocol {
func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, PigeonError>) -> Void)
func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, PigeonError>) -> Void)
func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void)
func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void)
}
class DropInFlutterInterface: DropInFlutterInterfaceProtocol {
private let binaryMessenger: FlutterBinaryMessenger
Expand All @@ -1925,7 +1925,7 @@ class DropInFlutterInterface: DropInFlutterInterfaceProtocol {
var codec: PlatformApiPigeonCodec {
return PlatformApiPigeonCodec.shared
}
func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, PigeonError>) -> Void) {
func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void) {
let channelName: String = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication\(messageChannelSuffix)"
let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in
Expand All @@ -1937,13 +1937,13 @@ class DropInFlutterInterface: DropInFlutterInterfaceProtocol {
let code: String = listResponse[0] as! String
let message: String? = nilOrValue(listResponse[1])
let details: String? = nilOrValue(listResponse[2])
completion(.failure(PigeonError(code: code, message: message, details: details)))
completion(.failure(AdyenPigeonError(code: code, message: message, details: details)))
} else {
completion(.success(Void()))
}
}
}
func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, PigeonError>) -> Void) {
func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void) {
let channelName: String = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication\(messageChannelSuffix)"
let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in
Expand All @@ -1955,7 +1955,7 @@ class DropInFlutterInterface: DropInFlutterInterfaceProtocol {
let code: String = listResponse[0] as! String
let message: String? = nilOrValue(listResponse[1])
let details: String? = nilOrValue(listResponse[2])
completion(.failure(PigeonError(code: code, message: message, details: details)))
completion(.failure(AdyenPigeonError(code: code, message: message, details: details)))
} else {
completion(.success(Void()))
}
Expand Down Expand Up @@ -2098,8 +2098,8 @@ class ComponentPlatformInterfaceSetup {
}
/// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift.
protocol ComponentFlutterInterfaceProtocol {
func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result<Void, PigeonError>) -> Void)
func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result<Void, PigeonError>) -> Void)
func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void)
func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void)
}
class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol {
private let binaryMessenger: FlutterBinaryMessenger
Expand All @@ -2111,7 +2111,7 @@ class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol {
var codec: PlatformApiPigeonCodec {
return PlatformApiPigeonCodec.shared
}
func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result<Void, PigeonError>) -> Void) {
func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void) {
let channelName: String = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs\(messageChannelSuffix)"
let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([cardComponentConfigurationDTOArg, sessionDTOArg] as [Any?]) { response in
Expand All @@ -2123,13 +2123,13 @@ class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol {
let code: String = listResponse[0] as! String
let message: String? = nilOrValue(listResponse[1])
let details: String? = nilOrValue(listResponse[2])
completion(.failure(PigeonError(code: code, message: message, details: details)))
completion(.failure(AdyenPigeonError(code: code, message: message, details: details)))
} else {
completion(.success(Void()))
}
}
}
func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result<Void, PigeonError>) -> Void) {
func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result<Void, AdyenPigeonError>) -> Void) {
let channelName: String = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication\(messageChannelSuffix)"
let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec)
channel.sendMessage([componentCommunicationModelArg] as [Any?]) { response in
Expand All @@ -2141,7 +2141,7 @@ class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol {
let code: String = listResponse[0] as! String
let message: String? = nilOrValue(listResponse[1])
let details: String? = nilOrValue(listResponse[2])
completion(.failure(PigeonError(code: code, message: message, details: details)))
completion(.failure(AdyenPigeonError(code: code, message: message, details: details)))
} else {
completion(.success(Void()))
}
Expand Down
4 changes: 2 additions & 2 deletions pigeons/platform_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import 'package:pigeon/pigeon.dart';
package: "com.adyen.checkout.flutter.generated",
errorClassName: "AdyenPigeonError",
),
swiftOut: 'ios/Classes/PlatformApi.swift',
swiftOptions: SwiftOptions(),
swiftOut: 'ios/Classes/generated/PlatformApi.swift',
swiftOptions: SwiftOptions(errorClassName: "AdyenPigeonError"),
dartPackageName: 'adyen_checkout',
))
enum Environment {
Expand Down

0 comments on commit ef6b1e3

Please sign in to comment.