From 1fd81a660740f7fd2048cc485c2c1b1de52b1942 Mon Sep 17 00:00:00 2001 From: alejandro-all-win-software Date: Thu, 19 Dec 2024 17:25:06 -0600 Subject: [PATCH 1/4] chore: added swift package manager support --- example/ios/Runner.xcodeproj/project.pbxproj | 16 ++++---- packages/stripe_ios/ios/Assets/.gitkeep | 0 .../stripe_ios/ios/Classes/StripeIosPlugin.h | 8 ---- .../stripe_ios/ios/Classes/StripeIosPlugin.m | 22 ---------- packages/stripe_ios/ios/stripe_ios.podspec | 4 +- .../contents.xcworkspacedata | 7 ++++ .../ios/stripe_ios/Package.resolved | 14 +++++++ .../stripe_ios/ios/stripe_ios/Package.swift | 40 +++++++++++++++++++ .../AddToWalletButtonFactory.swift | 2 +- .../stripe_ios}/ApplePayButtonView.swift | 2 + .../stripe_ios}/AuBECSDebitFormFactory.swift | 3 +- .../stripe_ios}/CardFieldFactory.swift | 1 + .../Sources/stripe_ios}/CardFormFactory.swift | 2 + .../Sources/stripe_ios}/RCTBridge.swift | 2 + .../AddressSheet/AddressSheetUtils.swift | 0 .../AddressSheet/AddressSheetView.swift | 2 + .../Stripe Sdk/ApplePayUtils.swift | 1 + .../Stripe Sdk/ApplePayViewController.swift | 1 + .../Stripe Sdk/AuBECSDebitFormView.swift | 1 + .../Stripe Sdk/CardFieldView.swift | 1 + .../stripe_ios}/Stripe Sdk/CardFormView.swift | 1 + .../CustomerSheet/CustomerSheetUtils.swift | 1 + .../ReactNativeCustomerAdapter.swift | 0 .../stripe_ios}/Stripe Sdk/Errors.swift | 1 + .../Stripe Sdk/FinancialConnections.swift | 2 + .../stripe_ios}/Stripe Sdk/Mappers.swift | 1 + .../Stripe Sdk/PaymentMethodFactory.swift | 0 .../Stripe Sdk/PaymentPassFinder.swift | 1 + .../Stripe Sdk/PaymentSheetAppearance.swift | 2 + .../Stripe Sdk/StripeContainerView.swift | 0 .../Stripe Sdk/StripeSdk+CustomerSheet.swift | 2 + .../Stripe Sdk/StripeSdk+PaymentSheet.swift | 1 + .../stripe_ios}/Stripe Sdk/StripeSdk.swift | 1 + .../Stripe Sdk/UIColorExtension.swift | 2 + .../AddToWalletButtonView.swift | 2 + .../PushProvisioningUtils.swift | 2 + .../Sources/stripe_ios/StripeIosPlugin.swift | 8 ++++ .../stripe_ios}/StripePlugin+PayPlugin.swift | 0 .../Sources/stripe_ios}/StripePlugin.swift | 2 +- .../Sources/stripe_objc}/RCTBridge.m | 2 +- .../include/stripe_objc-umbrella.h | 1 + .../stripe_objc/include/stripe_objc.modulemap | 6 +++ .../include/stripe_objc}/RCTBridge.h | 23 ++++++----- 43 files changed, 137 insertions(+), 53 deletions(-) delete mode 100644 packages/stripe_ios/ios/Assets/.gitkeep delete mode 100644 packages/stripe_ios/ios/Classes/StripeIosPlugin.h delete mode 100644 packages/stripe_ios/ios/Classes/StripeIosPlugin.m create mode 100644 packages/stripe_ios/ios/stripe_ios/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 packages/stripe_ios/ios/stripe_ios/Package.resolved create mode 100644 packages/stripe_ios/ios/stripe_ios/Package.swift rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/AddToWalletButtonFactory.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/ApplePayButtonView.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/AuBECSDebitFormFactory.swift (98%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/CardFieldFactory.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/CardFormFactory.swift (99%) rename packages/stripe_ios/ios/{Classes/Bridge => stripe_ios/Sources/stripe_ios}/RCTBridge.swift (98%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/AddressSheet/AddressSheetUtils.swift (100%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/AddressSheet/AddressSheetView.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/ApplePayUtils.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/ApplePayViewController.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/AuBECSDebitFormView.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/CardFieldView.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/CardFormView.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/CustomerSheet/ReactNativeCustomerAdapter.swift (100%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/Errors.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/FinancialConnections.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/Mappers.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/PaymentMethodFactory.swift (100%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/PaymentPassFinder.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/PaymentSheetAppearance.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/StripeContainerView.swift (100%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/StripeSdk+CustomerSheet.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/StripeSdk+PaymentSheet.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/StripeSdk.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/UIColorExtension.swift (98%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift (99%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift (99%) create mode 100644 packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripeIosPlugin.swift rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/StripePlugin+PayPlugin.swift (100%) rename packages/stripe_ios/ios/{Classes => stripe_ios/Sources/stripe_ios}/StripePlugin.swift (99%) rename packages/stripe_ios/ios/{Classes/Bridge => stripe_ios/Sources/stripe_objc}/RCTBridge.m (91%) create mode 100644 packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h create mode 100644 packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc.modulemap rename packages/stripe_ios/ios/{Classes/Bridge => stripe_ios/Sources/stripe_objc/include/stripe_objc}/RCTBridge.h (60%) diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 09131faf1..7c88c655b 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -453,7 +453,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -473,7 +473,7 @@ DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -502,7 +502,7 @@ CURRENT_PROJECT_VERSION = 1; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -535,7 +535,7 @@ CURRENT_PROJECT_VERSION = 1; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -567,7 +567,7 @@ CURRENT_PROJECT_VERSION = 1; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -630,7 +630,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -679,7 +679,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -728,7 +728,7 @@ DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/packages/stripe_ios/ios/Assets/.gitkeep b/packages/stripe_ios/ios/Assets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/stripe_ios/ios/Classes/StripeIosPlugin.h b/packages/stripe_ios/ios/Classes/StripeIosPlugin.h deleted file mode 100644 index 681ec3dd8..000000000 --- a/packages/stripe_ios/ios/Classes/StripeIosPlugin.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import -#import "RCTBridge.h" - - - -@interface StripeIosPlugin : NSObject -@end diff --git a/packages/stripe_ios/ios/Classes/StripeIosPlugin.m b/packages/stripe_ios/ios/Classes/StripeIosPlugin.m deleted file mode 100644 index a7e4fa05b..000000000 --- a/packages/stripe_ios/ios/Classes/StripeIosPlugin.m +++ /dev/null @@ -1,22 +0,0 @@ -#import "StripeIosPlugin.h" -#if __has_include() -#import -#else -// Support project import fallback if the generated compatibility header -// is not copied when this plugin is created as a library. -// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 -#import "stripe_ios-Swift.h" -#endif - -SWIFT_CLASS("StripePlugin") -@interface StripePlugin : NSObject -+ (void)registerWithRegistrar:(NSObject*)registrar ; -@end - - -@implementation StripeIosPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - [StripePlugin registerWithRegistrar:registrar]; - -} -@end diff --git a/packages/stripe_ios/ios/stripe_ios.podspec b/packages/stripe_ios/ios/stripe_ios.podspec index 167db4270..afaaf356f 100644 --- a/packages/stripe_ios/ios/stripe_ios.podspec +++ b/packages/stripe_ios/ios/stripe_ios.podspec @@ -14,7 +14,9 @@ A new flutter plugin project. s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } s.source = { :path => '.' } - s.source_files = 'Classes/**/*' + s.source_files = 'stripe_ios/Sources/**/*.' + s.public_header_files = 'stripe_ios/Sources/stripe_objc/include/**/*.h' + s.module_map = 'stripe_ios/Sources/stripe_objc/include/stripe_objc.modulemap' s.dependency 'Flutter' s.dependency 'Stripe', stripe_version s.dependency 'StripePaymentSheet', stripe_version diff --git a/packages/stripe_ios/ios/stripe_ios/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/packages/stripe_ios/ios/stripe_ios/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/packages/stripe_ios/ios/stripe_ios/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/stripe_ios/ios/stripe_ios/Package.resolved b/packages/stripe_ios/ios/stripe_ios/Package.resolved new file mode 100644 index 000000000..38f17cf34 --- /dev/null +++ b/packages/stripe_ios/ios/stripe_ios/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "stripe-ios-spm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stripe/stripe-ios-spm", + "state" : { + "revision" : "653fc8cfc40b33740401f9bd9faa8588f9a53e5f", + "version" : "23.32.0" + } + } + ], + "version" : 2 +} diff --git a/packages/stripe_ios/ios/stripe_ios/Package.swift b/packages/stripe_ios/ios/stripe_ios/Package.swift new file mode 100644 index 000000000..0ba32a67e --- /dev/null +++ b/packages/stripe_ios/ios/stripe_ios/Package.swift @@ -0,0 +1,40 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "stripe_ios", + platforms: [ + .iOS("13.0") + ], + products: [ + .library(name: "stripe-ios", targets: ["stripe_ios"]) + ], + dependencies: [ + .package(url: "https://github.com/stripe/stripe-ios-spm", .upToNextMajor(from: "23.30.0")) + ], + targets: [ + .target( + name: "stripe_ios", + dependencies: [ + .product(name: "Stripe", package: "stripe-ios-spm"), + .product(name: "StripePayments", package: "stripe-ios-spm"), + .product(name: "StripePaymentsUI", package: "stripe-ios-spm"), + .product(name: "StripePaymentSheet", package: "stripe-ios-spm"), + .product(name: "StripeApplePay", package: "stripe-ios-spm"), + .product(name: "StripeFinancialConnections", package: "stripe-ios-spm"), + "stripe_objc" + ], + resources: [] + ), + .target( + name: "stripe_objc", + dependencies: [], + resources: [], + cSettings: [ + .headerSearchPath("include/stripe_objc") + ] + ) + ] +) diff --git a/packages/stripe_ios/ios/Classes/AddToWalletButtonFactory.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/AddToWalletButtonFactory.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/AddToWalletButtonFactory.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/AddToWalletButtonFactory.swift index 133344dc0..2c39446d8 100644 --- a/packages/stripe_ios/ios/Classes/AddToWalletButtonFactory.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/AddToWalletButtonFactory.swift @@ -5,9 +5,9 @@ // Created by Jaime Blasco on 9/8/21. // +import Flutter import Foundation - public class AddToWalletButtonFactory: NSObject, FlutterPlatformViewFactory { private var messenger: FlutterBinaryMessenger diff --git a/packages/stripe_ios/ios/Classes/ApplePayButtonView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/ApplePayButtonView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift index a439f7886..709e53e04 100644 --- a/packages/stripe_ios/ios/Classes/ApplePayButtonView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift @@ -7,6 +7,8 @@ import Flutter import UIKit +import PassKit +import stripe_objc class ApplePayButtonViewFactory: NSObject, FlutterPlatformViewFactory { private var messenger: FlutterBinaryMessenger diff --git a/packages/stripe_ios/ios/Classes/AuBECSDebitFormFactory.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/AuBECSDebitFormFactory.swift similarity index 98% rename from packages/stripe_ios/ios/Classes/AuBECSDebitFormFactory.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/AuBECSDebitFormFactory.swift index 4a806f05f..2ef086996 100644 --- a/packages/stripe_ios/ios/Classes/AuBECSDebitFormFactory.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/AuBECSDebitFormFactory.swift @@ -5,8 +5,9 @@ // Created by Jaime Blasco on 9/8/21. // +import Flutter import Foundation - +import UIKit public class AuBECSDebitFormFactory: NSObject, FlutterPlatformViewFactory { diff --git a/packages/stripe_ios/ios/Classes/CardFieldFactory.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/CardFieldFactory.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/CardFieldFactory.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/CardFieldFactory.swift index 59293d39e..791a64b77 100644 --- a/packages/stripe_ios/ios/Classes/CardFieldFactory.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/CardFieldFactory.swift @@ -5,6 +5,7 @@ // Created by Jaime Blasco on 7/3/21. // +import Flutter import Foundation import UIKit import Stripe diff --git a/packages/stripe_ios/ios/Classes/CardFormFactory.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/CardFormFactory.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/CardFormFactory.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/CardFormFactory.swift index d8f430104..0f1ae48c4 100644 --- a/packages/stripe_ios/ios/Classes/CardFormFactory.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/CardFormFactory.swift @@ -5,8 +5,10 @@ // Created by Jaime Blasco on 9/8/21. // +import Flutter import Foundation import Stripe +import UIKit public class CardFormFactory: NSObject, FlutterPlatformViewFactory { diff --git a/packages/stripe_ios/ios/Classes/Bridge/RCTBridge.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/RCTBridge.swift similarity index 98% rename from packages/stripe_ios/ios/Classes/Bridge/RCTBridge.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/RCTBridge.swift index c7b8dcaea..b57a0b2a1 100644 --- a/packages/stripe_ios/ios/Classes/Bridge/RCTBridge.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/RCTBridge.swift @@ -5,7 +5,9 @@ // Created by Jaime Blasco on 4/4/21. // +import Flutter import Foundation +import UIKit typealias FlutterMap = Dictionary diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/AddressSheet/AddressSheetUtils.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetUtils.swift similarity index 100% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/AddressSheet/AddressSheetUtils.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetUtils.swift diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/AddressSheet/AddressSheetView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/AddressSheet/AddressSheetView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift index 836bc8c6d..b0db9845f 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/AddressSheet/AddressSheetView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift @@ -7,6 +7,8 @@ import Foundation import StripePaymentSheet +import UIKit +import stripe_objc @objc(AddressSheetView) class AddressSheetView: UIView { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/ApplePayUtils.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/ApplePayUtils.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/ApplePayUtils.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/ApplePayUtils.swift index 75e993a58..3342d8435 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/ApplePayUtils.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/ApplePayUtils.swift @@ -7,6 +7,7 @@ import Foundation import StripePaymentSheet +import PassKit class ApplePayUtils { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/ApplePayViewController.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/ApplePayViewController.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/ApplePayViewController.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/ApplePayViewController.swift index 57e1e472b..ca547018e 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/ApplePayViewController.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/ApplePayViewController.swift @@ -7,6 +7,7 @@ import Foundation import Stripe +import PassKit extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayContextDelegate { func paymentAuthorizationViewController( diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/AuBECSDebitFormView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/AuBECSDebitFormView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift index 6d0cda35d..5487646bd 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/AuBECSDebitFormView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift @@ -1,6 +1,7 @@ import Foundation import UIKit import Stripe +import stripe_objc @objc(AuBECSDebitFormView) class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFieldView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/CardFieldView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift index 200fbba94..eaaa397fd 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFieldView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift @@ -1,6 +1,7 @@ import Foundation import UIKit import Stripe +import stripe_objc class CardFieldView: UIView, STPPaymentCardTextFieldDelegate { @objc var onCardChange: RCTDirectEventBlock? diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift index dad81a68e..e8c8fa853 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift @@ -1,6 +1,7 @@ import Foundation import UIKit import Stripe +import stripe_objc class CardFormView: UIView, STPCardFormViewDelegate { public var cardForm: STPCardFormView? diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift index bd836b7d5..8c6520732 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CustomerSheet/CustomerSheetUtils.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit @_spi(PrivateBetaCustomerSheet) @_spi(STP) import StripePaymentSheet class CustomerSheetUtils { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/CustomerSheet/ReactNativeCustomerAdapter.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CustomerSheet/ReactNativeCustomerAdapter.swift similarity index 100% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/CustomerSheet/ReactNativeCustomerAdapter.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CustomerSheet/ReactNativeCustomerAdapter.swift diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/Errors.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/Errors.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/Errors.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/Errors.swift index 993c9b7a3..74fa73ea2 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/Errors.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/Errors.swift @@ -1,4 +1,5 @@ import Stripe +import Foundation @_spi(STP) import StripeCore enum ErrorType { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/FinancialConnections.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/FinancialConnections.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift index 260baaf85..206cf44f6 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/FinancialConnections.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift @@ -8,6 +8,8 @@ import Foundation import StripeFinancialConnections import Stripe +import stripe_objc +import UIKit class FinancialConnections { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/Mappers.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/Mappers.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/Mappers.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/Mappers.swift index 1909f776c..045ed4073 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/Mappers.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/Mappers.swift @@ -1,5 +1,6 @@ import Stripe import StripePaymentSheet +import PassKit class Mappers { class func createResult(_ key: String, _ value: NSDictionary?) -> NSDictionary { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentMethodFactory.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentMethodFactory.swift similarity index 100% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentMethodFactory.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentMethodFactory.swift diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentPassFinder.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentPassFinder.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentPassFinder.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentPassFinder.swift index 9cd952e54..ec814cf49 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentPassFinder.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentPassFinder.swift @@ -6,6 +6,7 @@ // import Foundation +import PassKit internal class PaymentPassFinder: NSObject { enum PassLocation: String { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentSheetAppearance.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentSheetAppearance.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentSheetAppearance.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentSheetAppearance.swift index f7f7d972a..777277f25 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/PaymentSheetAppearance.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/PaymentSheetAppearance.swift @@ -5,6 +5,8 @@ // Created by Charles Cruzan on 5/11/22. // import StripePaymentSheet +import Foundation +import UIKit internal class PaymentSheetAppearance { class func buildAppearanceFromParams(userParams: NSDictionary?) throws -> PaymentSheet.Appearance { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeContainerView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeContainerView.swift similarity index 100% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/StripeContainerView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeContainerView.swift diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+CustomerSheet.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+CustomerSheet.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift index 49630a3d2..cf276628e 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+CustomerSheet.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift @@ -7,6 +7,8 @@ import Foundation @_spi(PrivateBetaCustomerSheet) @_spi(STP) import StripePaymentSheet +import UIKit +import stripe_objc extension StripeSdk { @objc(initCustomerSheet:customerAdapterOverrides:resolver:rejecter:) diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+PaymentSheet.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+PaymentSheet.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift index 99ba2b784..1e7c4733a 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+PaymentSheet.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift @@ -6,6 +6,7 @@ // import Foundation +import stripe_objc @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(STP) import StripePaymentSheet extension StripeSdk { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift index 6c8390680..72a4fdcac 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift @@ -3,6 +3,7 @@ import Stripe import StripePaymentSheet import StripeFinancialConnections import Foundation +import stripe_objc @objc(StripeSdk) class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdaptivePresentationControllerDelegate { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/UIColorExtension.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/UIColorExtension.swift similarity index 98% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/UIColorExtension.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/UIColorExtension.swift index 245c683eb..d5649ba9b 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/UIColorExtension.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/UIColorExtension.swift @@ -5,6 +5,8 @@ // Created by Arkadiusz Kubaczkowski on 24/11/2020. // +import UIKit + extension UIColor { public convenience init(hexString: String) { let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift index 67624545b..9d7cd42a5 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift @@ -7,6 +7,8 @@ import Foundation import Stripe +import PassKit +import stripe_objc @objc(AddToWalletButtonView) class AddToWalletButtonView: UIView { diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift index 866b8e440..d14cc49f6 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/PushProvisioningUtils.swift @@ -7,6 +7,8 @@ import Foundation import Stripe +import PassKit +import UIKit internal class PushProvisioningUtils { class func canAddCardToWallet( diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripeIosPlugin.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripeIosPlugin.swift new file mode 100644 index 000000000..59d98cb1d --- /dev/null +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripeIosPlugin.swift @@ -0,0 +1,8 @@ +import Flutter + +// MARK: - StripeIosPlugin +public class StripeIosPlugin: NSObject, FlutterPlugin { + @objc public static func register(with registrar: FlutterPluginRegistrar) { + StripePlugin.register(with: registrar) + } +} diff --git a/packages/stripe_ios/ios/Classes/StripePlugin+PayPlugin.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin+PayPlugin.swift similarity index 100% rename from packages/stripe_ios/ios/Classes/StripePlugin+PayPlugin.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin+PayPlugin.swift diff --git a/packages/stripe_ios/ios/Classes/StripePlugin.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift similarity index 99% rename from packages/stripe_ios/ios/Classes/StripePlugin.swift rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift index e92fc950a..c9c37d620 100644 --- a/packages/stripe_ios/ios/Classes/StripePlugin.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift @@ -2,7 +2,7 @@ import Flutter import UIKit import Stripe import PassKit - +import stripe_objc protocol ViewManagerDelegate { var cardFieldView: CardFieldView? { get set } diff --git a/packages/stripe_ios/ios/Classes/Bridge/RCTBridge.m b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m similarity index 91% rename from packages/stripe_ios/ios/Classes/Bridge/RCTBridge.m rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m index 15ff11603..70bde302e 100644 --- a/packages/stripe_ios/ios/Classes/Bridge/RCTBridge.m +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m @@ -1,4 +1,4 @@ -#import "RCTBridge.h" +#import @implementation UIView (React) diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h new file mode 100644 index 000000000..b77b3627c --- /dev/null +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h @@ -0,0 +1 @@ +#import diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc.modulemap b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc.modulemap new file mode 100644 index 000000000..62d9bc302 --- /dev/null +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc.modulemap @@ -0,0 +1,6 @@ +framework module stripe_objc { + umbrella header "stripe_objc-umbrella.h" + + export * + module * { export * } +} diff --git a/packages/stripe_ios/ios/Classes/Bridge/RCTBridge.h b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc/RCTBridge.h similarity index 60% rename from packages/stripe_ios/ios/Classes/Bridge/RCTBridge.h rename to packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc/RCTBridge.h index ba04e97db..238df4593 100644 --- a/packages/stripe_ios/ios/Classes/Bridge/RCTBridge.h +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc/RCTBridge.h @@ -1,35 +1,37 @@ +#import +#import /** * The type of a block that is capable of sending a response to a bridged * operation. Use this for returning callback methods to JS. */ -typedef void (^RCTResponseSenderBlock)(NSArray *response); +typedef void (^RCTResponseSenderBlock)(NSArray *response) NS_SWIFT_NAME(RCTResponseSenderBlock); /** * The type of a block that is capable of sending an error response to a * bridged operation. Use this for returning error information to JS. */ -typedef void (^RCTResponseErrorBlock)(NSError *error); +typedef void (^RCTResponseErrorBlock)(NSError *error) NS_SWIFT_NAME(RCTResponseErrorBlock); /** * Block that bridge modules use to resolve the JS promise waiting for a result. * Nil results are supported and are converted to JS's undefined value. */ -typedef void (^RCTPromiseResolveBlock)(id result); +typedef void (^RCTPromiseResolveBlock)(id result) NS_SWIFT_NAME(RCTPromiseResolveBlock); /** * Block that bridge modules use to reject the JS promise waiting for a result. * The error may be nil but it is preferable to pass an NSError object for more * precise error messages. */ -typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error); +typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error) NS_SWIFT_NAME(RCTPromiseRejectBlock); /** * These block types can be used for mapping input event handlers from JS to view * properties. Unlike JS method callbacks, these can be called multiple times. */ -typedef void (^RCTDirectEventBlock)(NSDictionary *body); -typedef void (^RCTBubblingEventBlock)(NSDictionary *body); +typedef void (^RCTDirectEventBlock)(NSDictionary *body) NS_SWIFT_NAME(RCTDirectEventBlock); +typedef void (^RCTBubblingEventBlock)(NSDictionary *body) NS_SWIFT_NAME(RCTBubblingEventBlock); @interface UIView (React) @@ -38,13 +40,13 @@ typedef void (^RCTBubblingEventBlock)(NSDictionary *body); * Called each time props have been set. * The default implementation does nothing. */ -- (void)didSetProps:(NSArray *)changedProps; +- (void)didSetProps:(NSArray *)changedProps NS_SWIFT_NAME(didSetProps(_:)); /** * Focus manipulation. */ -- (void)reactFocus; -- (void)reactBlur; +- (void)reactFocus NS_SWIFT_NAME(reactFocus()); +- (void)reactBlur NS_SWIFT_NAME(reactBlur()); @end @@ -54,7 +56,8 @@ typedef void (^RCTBubblingEventBlock)(NSDictionary *body); /** * Returns YES if module instance must be created on the main thread. */ -@property (nonatomic, assign, readonly) BOOL requiresMainQueueSetup; +@property (nonatomic, assign, readonly) BOOL requiresMainQueueSetup NS_SWIFT_NAME(requiresMainQueueSetup); @end + From 80d4fefeec012863f2ef012c022af3a563fb1850 Mon Sep 17 00:00:00 2001 From: alejandro-all-win-software Date: Fri, 20 Dec 2024 13:44:45 -0600 Subject: [PATCH 2/4] chore: fixed issues with cocoapods --- example/ios/Runner.xcodeproj/project.pbxproj | 20 +++++++++++++++++++ .../xcshareddata/swiftpm/Package.resolved | 15 ++++++++++++++ .../xcshareddata/xcschemes/Runner.xcscheme | 18 +++++++++++++++++ .../xcshareddata/swiftpm/Package.resolved | 15 ++++++++++++++ example/macos/Podfile.lock | 2 +- example/macos/Runner/AppDelegate.swift | 6 +++++- packages/stripe_ios/ios/stripe_ios.podspec | 14 ++++++++++--- .../stripe_ios/ApplePayButtonView.swift | 2 ++ .../AddressSheet/AddressSheetView.swift | 2 ++ .../Stripe Sdk/AuBECSDebitFormView.swift | 2 ++ .../stripe_ios/Stripe Sdk/CardFieldView.swift | 2 ++ .../stripe_ios/Stripe Sdk/CardFormView.swift | 2 ++ .../Stripe Sdk/FinancialConnections.swift | 4 +++- .../Stripe Sdk/StripeSdk+CustomerSheet.swift | 2 ++ .../Stripe Sdk/StripeSdk+PaymentSheet.swift | 3 ++- .../stripe_ios/Stripe Sdk/StripeSdk.swift | 2 ++ .../AddToWalletButtonView.swift | 2 ++ .../Sources/stripe_ios/StripePlugin.swift | 3 ++- .../Sources/stripe_objc/RCTBridge.m | 4 ++++ .../include/stripe_objc-umbrella.h | 4 ++++ 20 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 7c88c655b..db7432bec 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; C1C00DE1D4D140D43FF1F838 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0319CE3D006F4355FEBFB2E6 /* Pods_Runner.framework */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -81,6 +82,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, C1C00DE1D4D140D43FF1F838 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -189,6 +191,9 @@ productType = "com.apple.product-type.bundle.unit-test"; }; 97C146ED1CF9000F007C117D /* Runner */ = { + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( @@ -214,6 +219,9 @@ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); isa = PBXProject; attributes = { LastUpgradeCheck = 1510; @@ -775,6 +783,18 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000..eba3a879d --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "d75e1870e24786a8f3168abef93b2bf5b3c10211210817b12d64ec80e264c360", + "pins" : [ + { + "identity" : "stripe-ios-spm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stripe/stripe-ios-spm", + "state" : { + "revision" : "653fc8cfc40b33740401f9bd9faa8588f9a53e5f", + "version" : "23.32.0" + } + } + ], + "version" : 3 +} diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index d11d0fa28..2299ebe5f 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } } diff --git a/packages/stripe_ios/ios/stripe_ios.podspec b/packages/stripe_ios/ios/stripe_ios.podspec index afaaf356f..da2315ada 100644 --- a/packages/stripe_ios/ios/stripe_ios.podspec +++ b/packages/stripe_ios/ios/stripe_ios.podspec @@ -14,9 +14,6 @@ A new flutter plugin project. s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } s.source = { :path => '.' } - s.source_files = 'stripe_ios/Sources/**/*.' - s.public_header_files = 'stripe_ios/Sources/stripe_objc/include/**/*.h' - s.module_map = 'stripe_ios/Sources/stripe_objc/include/stripe_objc.modulemap' s.dependency 'Flutter' s.dependency 'Stripe', stripe_version s.dependency 'StripePaymentSheet', stripe_version @@ -24,6 +21,17 @@ A new flutter plugin project. s.dependency 'StripePaymentsUI', stripe_version s.dependency 'StripeApplePay', stripe_version s.dependency 'StripeFinancialConnections', stripe_version + + s.subspec 'stripe_objc' do |ss| + ss.source_files = 'stripe_ios/Sources/**/*.{m,h}' + ss.public_header_files = 'stripe_ios/Sources/stripe_objc/include/**/*.h' + end + + s.subspec 'stripe_ios' do |ss| + ss.source_files = 'stripe_ios/Sources/**/*.{swift}' + ss.dependency 'stripe_ios/stripe_objc' + end + s.platform = :ios, '13.0' # Flutter.framework does not contain a i386 slice. diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift index 709e53e04..9732d4233 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/ApplePayButtonView.swift @@ -8,7 +8,9 @@ import Flutter import UIKit import PassKit +#if canImport(stripe_objc) import stripe_objc +#endif class ApplePayButtonViewFactory: NSObject, FlutterPlatformViewFactory { private var messenger: FlutterBinaryMessenger diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift index b0db9845f..2a21a63c2 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AddressSheet/AddressSheetView.swift @@ -8,7 +8,9 @@ import Foundation import StripePaymentSheet import UIKit +#if canImport(stripe_objc) import stripe_objc +#endif @objc(AddressSheetView) class AddressSheetView: UIView { diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift index 5487646bd..62e83c78f 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/AuBECSDebitFormView.swift @@ -1,7 +1,9 @@ import Foundation import UIKit import Stripe +#if canImport(stripe_objc) import stripe_objc +#endif @objc(AuBECSDebitFormView) class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate { diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift index eaaa397fd..7105394c9 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFieldView.swift @@ -1,7 +1,9 @@ import Foundation import UIKit import Stripe +#if canImport(stripe_objc) import stripe_objc +#endif class CardFieldView: UIView, STPPaymentCardTextFieldDelegate { @objc var onCardChange: RCTDirectEventBlock? diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift index e8c8fa853..8dda09ddd 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/CardFormView.swift @@ -1,7 +1,9 @@ import Foundation import UIKit import Stripe +#if canImport(stripe_objc) import stripe_objc +#endif class CardFormView: UIView, STPCardFormViewDelegate { public var cardForm: STPCardFormView? diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift index 206cf44f6..4f7e934b9 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/FinancialConnections.swift @@ -8,8 +8,10 @@ import Foundation import StripeFinancialConnections import Stripe -import stripe_objc import UIKit +#if canImport(stripe_objc) +import stripe_objc +#endif class FinancialConnections { diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift index cf276628e..76993384a 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+CustomerSheet.swift @@ -8,7 +8,9 @@ import Foundation @_spi(PrivateBetaCustomerSheet) @_spi(STP) import StripePaymentSheet import UIKit +#if canImport(stripe_objc) import stripe_objc +#endif extension StripeSdk { @objc(initCustomerSheet:customerAdapterOverrides:resolver:rejecter:) diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift index 1e7c4733a..b87001dc4 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk+PaymentSheet.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(stripe_objc) import stripe_objc +#endif @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(STP) import StripePaymentSheet extension StripeSdk { @@ -311,4 +313,3 @@ extension StripeSdk { } } } - diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift index 72a4fdcac..84beb7a38 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/StripeSdk.swift @@ -3,7 +3,9 @@ import Stripe import StripePaymentSheet import StripeFinancialConnections import Foundation +#if canImport(stripe_objc) import stripe_objc +#endif @objc(StripeSdk) class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdaptivePresentationControllerDelegate { diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift index 9d7cd42a5..0e4522685 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/Stripe Sdk/pushprovisioning/AddToWalletButtonView.swift @@ -8,7 +8,9 @@ import Foundation import Stripe import PassKit +#if canImport(stripe_objc) import stripe_objc +#endif @objc(AddToWalletButtonView) class AddToWalletButtonView: UIView { diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift index c9c37d620..e5edc83a2 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift @@ -2,7 +2,9 @@ import Flutter import UIKit import Stripe import PassKit +#if canImport(stripe_objc) import stripe_objc +#endif protocol ViewManagerDelegate { var cardFieldView: CardFieldView? { get set } @@ -660,4 +662,3 @@ extension StripePlugin { result(nil) } } - diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m index 70bde302e..ff3ecc0bc 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/RCTBridge.m @@ -1,4 +1,8 @@ +#if __has_include() #import +#else +#import "RCTBridge.h" +#endif @implementation UIView (React) diff --git a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h index b77b3627c..7232e69b6 100644 --- a/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h +++ b/packages/stripe_ios/ios/stripe_ios/Sources/stripe_objc/include/stripe_objc-umbrella.h @@ -1 +1,5 @@ +#if __has_include() #import +#else +#import "RCTBridge.h" +#endif From bf7b8babcf3f581f6887ee55e0d8eb88efe82694 Mon Sep 17 00:00:00 2001 From: alejandro-all-win-software Date: Fri, 20 Dec 2024 15:06:47 -0600 Subject: [PATCH 3/4] chore: updated stripe_ios changelog --- packages/stripe_ios/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/stripe_ios/CHANGELOG.md b/packages/stripe_ios/CHANGELOG.md index 2f3a5ea93..cc3d23e15 100644 --- a/packages/stripe_ios/CHANGELOG.md +++ b/packages/stripe_ios/CHANGELOG.md @@ -1,3 +1,8 @@ +## 11.3.1 + +**Features** +- Adds support for Swift Package Manager for compatibility with new projects. + ## 11.3.0 Align with Stripe React Native [0.39.0](https://github.com/stripe/stripe-react-native/releases/tag/v0.39.0): **Features** From 1b62bf3e2c6f5b45cda2eab08c738fa19d25a705 Mon Sep 17 00:00:00 2001 From: alejandro-all-win-software Date: Fri, 20 Dec 2024 15:10:47 -0600 Subject: [PATCH 4/4] chore: updated stripe_ios pubspec version --- packages/stripe_ios/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stripe_ios/pubspec.yaml b/packages/stripe_ios/pubspec.yaml index abb296338..e9cc03aeb 100644 --- a/packages/stripe_ios/pubspec.yaml +++ b/packages/stripe_ios/pubspec.yaml @@ -1,6 +1,6 @@ name: stripe_ios description: Stripe platform implementation for iOS -version: 11.3.0 +version: 11.3.1 repository: https://github.com/flutter-stripe/flutter_stripe homepage: https://pub.dev/packages/flutter_stripe