Remove iOS 10 support, update Stripe3DS2
This commit is contained in:
parent
4a997de644
commit
221d483053
|
@ -32,3 +32,6 @@ xcuserdata/
|
|||
jazzy
|
||||
jazzy/*
|
||||
docs/docs/undocumented.json
|
||||
|
||||
.build
|
||||
.swiftpm
|
||||
|
|
|
@ -31,12 +31,12 @@ matrix:
|
|||
update: true
|
||||
matrix:
|
||||
include:
|
||||
- name: legacy-tests-10
|
||||
env: TEST_TYPE=legacy-tests-10
|
||||
osx_image: xcode11.6
|
||||
- name: legacy-tests-11
|
||||
env: TEST_TYPE=legacy-tests-11
|
||||
osx_image: xcode11.6
|
||||
- name: installation_spm
|
||||
env: TEST_TYPE=installation_spm
|
||||
osx_image: xcode12
|
||||
|
||||
before_install:
|
||||
- SIMULATOR_ID=$(xcrun instruments -s | grep -o "iPhone 6 (11.4) \[.*\]" | grep -o
|
||||
|
@ -46,13 +46,11 @@ script:
|
|||
- "./ci_scripts/check_version.rb"
|
||||
- "./ci_scripts/check_public_headers.rb"
|
||||
- "./ci_scripts/check_category_linking.rb"
|
||||
- "./ci_scripts/check_resource_bundle.rb"
|
||||
- "./ci_scripts/check_for_new_localized_strings.sh"
|
||||
- '[ "$TEST_TYPE" != lint ] || ./ci_scripts/check_fauxpas.sh'
|
||||
- '[ "$TEST_TYPE" != tests ] || travis_retry ./ci_scripts/run_tests.sh'
|
||||
- '[ "$TEST_TYPE" != integration-tests ] || travis_retry ./ci_scripts/run_integration_tests.sh'
|
||||
- '[ "$TEST_TYPE" != ui-tests ] || travis_retry ./ci_scripts/run_ui_tests.sh'
|
||||
- '[ "$TEST_TYPE" != legacy-tests-10 ] || travis_retry ./ci_scripts/run_legacy_tests.sh "platform=iOS Simulator,name=iPhone 6,OS=10.3.1"'
|
||||
- '[ "$TEST_TYPE" != legacy-tests-11 ] || travis_retry ./ci_scripts/run_legacy_tests.sh "platform=iOS Simulator,name=iPhone 6,OS=11.4"'
|
||||
- '[ "$TEST_TYPE" != builds ] || travis_retry ./ci_scripts/run_builds.sh'
|
||||
- '[ "$TEST_TYPE" != analyzer ] || ./ci_scripts/run_analyzer.sh'
|
||||
|
@ -60,4 +58,5 @@ script:
|
|||
- '[ "$TEST_TYPE" != installation_cocoapods_frameworks_objc ] || ./Tests/installation_tests/cocoapods/with_frameworks_objc/test.sh'
|
||||
- '[ "$TEST_TYPE" != installation_cocoapods_frameworks_swift ] || ./Tests/installation_tests/cocoapods/with_frameworks_swift/test.sh'
|
||||
- '[ "$TEST_TYPE" != installation_carthage ] || ./Tests/installation_tests/carthage/test.sh'
|
||||
- '[ "$TEST_TYPE" != installation_spm ] || ./Tests/installation_tests/swift_package_manager/test.sh'
|
||||
- '[ "$TEST_TYPE" != documentation ] || ./ci_scripts/check_documentation.sh'
|
||||
|
|
|
@ -173,7 +173,6 @@
|
|||
04823F751A6849200098400B /* Frameworks */,
|
||||
04823F761A6849200098400B /* Resources */,
|
||||
04D0761F1A69E66F00094431 /* Embed Frameworks */,
|
||||
04BC29A61CD9468500318357 /* Run Script */,
|
||||
C113E0121ECF9D7F002E6E53 /* Carthage Copy Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
|
@ -284,20 +283,6 @@
|
|||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
04BC29A61CD9468500318357 /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework/integrate-dynamic-framework.sh\"\n";
|
||||
};
|
||||
C113E0121ECF9D7F002E6E53 /* Carthage Copy Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -419,7 +404,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
|
@ -468,7 +453,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Basic Integration/Basic Integration-Bridging-Header.h";
|
||||
|
|
|
@ -228,7 +228,6 @@
|
|||
04533E841A687F5D00C7E52E /* Frameworks */,
|
||||
04533E851A687F5D00C7E52E /* Resources */,
|
||||
04D076181A69C11600094431 /* Embed Frameworks */,
|
||||
B69647F022D80A0700757794 /* Run Script */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -295,27 +294,6 @@
|
|||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
B69647F022D80A0700757794 /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework/integrate-dynamic-framework.sh\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
04533E831A687F5D00C7E52E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
|
|
|
@ -346,7 +346,6 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = "UI Examples/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.stripe.uiexamples;
|
||||
PRODUCT_NAME = "Stripe UI Examples";
|
||||
|
@ -360,7 +359,6 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = "UI Examples/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.stripe.uiexamples;
|
||||
PRODUCT_NAME = "Stripe UI Examples";
|
||||
|
|
Binary file not shown.
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.stripe.stripe-3ds2</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Stripe3DS2</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,6 +0,0 @@
|
|||
framework module Stripe3DS2 {
|
||||
umbrella header "Stripe3DS2.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libStripe3DS2-static-sim.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libStripe3DS2-static-ios.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-x86_64-maccatalyst</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libStripe3DS2-static-catalyst.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>maccatalyst</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -164,5 +164,5 @@ WARNING_CFLAGS = -Wall -Wextra -Wundef -Wfloat-equal
|
|||
// pointers or specific system versions before calling newer APIs.
|
||||
//
|
||||
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0
|
||||
|
||||
|
|
|
@ -34,7 +34,9 @@ typedef void (^STPPaymentAuthorizationStatusCallback)(PKPaymentAuthorizationStat
|
|||
|
||||
@implementation STPBlockBasedApplePayDelegate
|
||||
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
|
||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||
|
||||
- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller
|
||||
didAuthorizePayment:(PKPayment *)payment completion:(STPPaymentAuthorizationStatusCallback)completion {
|
||||
|
@ -88,7 +90,7 @@ typedef void (^STPPaymentAuthorizationStatusCallback)(PKPaymentAuthorizationStat
|
|||
});
|
||||
}
|
||||
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
- (void)paymentAuthorizationViewControllerDidFinish:(__unused PKPaymentAuthorizationViewController *)controller {
|
||||
[self _finish];
|
||||
|
|
|
@ -471,13 +471,7 @@ static BOOL _advancedFraudSignalsEnabled;
|
|||
[paymentRequest setMerchantCapabilities:PKMerchantCapability3DS];
|
||||
[paymentRequest setCountryCode:countryCode.uppercaseString];
|
||||
[paymentRequest setCurrencyCode:currencyCode.uppercaseString];
|
||||
if (@available(iOS 11, *)) {
|
||||
paymentRequest.requiredBillingContactFields = [NSSet setWithArray:@[PKContactFieldPostalAddress]];
|
||||
} else {
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
paymentRequest.requiredBillingAddressFields = PKAddressFieldPostalAddress;
|
||||
#endif
|
||||
}
|
||||
return paymentRequest;
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
] mutableCopy];
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[constraints addObjectsFromArray:@[
|
||||
[_bsbLabel.leadingAnchor constraintEqualToSystemSpacingAfterAnchor:self.layoutMarginsGuide.leadingAnchor multiplier:1.f],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToSystemSpacingAfterAnchor:_bsbLabel.trailingAnchor multiplier:1.f],
|
||||
|
@ -248,15 +247,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[mandateTextLabel.leadingAnchor constraintEqualToSystemSpacingAfterAnchor:self.layoutMarginsGuide.leadingAnchor multiplier:1.f],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToSystemSpacingAfterAnchor:mandateTextLabel.trailingAnchor multiplier:1.f],
|
||||
]];
|
||||
} else {
|
||||
[constraints addObjectsFromArray:@[
|
||||
[_bsbLabel.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToAnchor:_bsbLabel.trailingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
|
||||
[mandateTextLabel.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToAnchor:mandateTextLabel.trailingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
]];
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:constraints];
|
||||
|
||||
|
|
|
@ -256,42 +256,7 @@ STPContactField const STPContactFieldName = @"STPContactFieldName";
|
|||
|| self.postalCode.length > 0);
|
||||
}
|
||||
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
|
||||
+ (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields {
|
||||
switch (billingAddressFields) {
|
||||
case STPBillingAddressFieldsNone:
|
||||
return PKAddressFieldNone;
|
||||
case STPBillingAddressFieldsPostalCode:
|
||||
case STPBillingAddressFieldsFull:
|
||||
return PKAddressFieldPostalAddress;
|
||||
case STPBillingAddressFieldsName:
|
||||
return PKAddressFieldName;
|
||||
}
|
||||
}
|
||||
|
||||
+ (PKAddressField)pkAddressFieldsFromStripeContactFields:(NSSet<STPContactField> *)contactFields {
|
||||
PKAddressField addressFields = PKAddressFieldNone;
|
||||
NSDictionary<STPContactField, NSNumber *> *contactToAddressFieldMap
|
||||
= @{
|
||||
STPContactFieldPostalAddress: @(PKAddressFieldPostalAddress),
|
||||
STPContactFieldEmailAddress: @(PKAddressFieldEmail),
|
||||
STPContactFieldPhoneNumber: @(PKAddressFieldPhone),
|
||||
STPContactFieldName: @(PKAddressFieldName),
|
||||
};
|
||||
|
||||
for (STPContactField contactField in contactFields) {
|
||||
NSNumber *boxedConvertedField = contactToAddressFieldMap[contactField];
|
||||
if (boxedConvertedField != nil) {
|
||||
addressFields = (PKAddressField) (addressFields | [boxedConvertedField unsignedIntegerValue]);
|
||||
}
|
||||
}
|
||||
return addressFields;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+ (NSSet<PKContactField> *)applePayContactFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields API_AVAILABLE(ios(11.0)) {
|
||||
+ (NSSet<PKContactField> *)applePayContactFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields {
|
||||
switch (billingAddressFields) {
|
||||
case STPBillingAddressFieldsNone:
|
||||
return [NSSet setWithArray:@[]];
|
||||
|
@ -303,7 +268,7 @@ STPContactField const STPContactFieldName = @"STPContactFieldName";
|
|||
}
|
||||
}
|
||||
|
||||
+ (NSSet<PKContactField> *)pkContactFieldsFromStripeContactFields:(NSSet<STPContactField> *)contactFields API_AVAILABLE(ios(11.0)) {
|
||||
+ (NSSet<PKContactField> *)pkContactFieldsFromStripeContactFields:(NSSet<STPContactField> *)contactFields {
|
||||
if (contactFields == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
[self updateAppearance];
|
||||
|
||||
self.textField.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[self.textField.leadingAnchor constraintEqualToAnchor:self.contentView.safeAreaLayoutGuide.leadingAnchor constant:15],
|
||||
[self.textField.trailingAnchor constraintEqualToAnchor:self.contentView.safeAreaLayoutGuide.trailingAnchor constant:-15],
|
||||
|
@ -124,20 +123,6 @@
|
|||
|
||||
[self.inputAccessoryToolbar.heightAnchor constraintEqualToConstant:44],
|
||||
]];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[self.textField.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor constant:15],
|
||||
[self.textField.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:-15],
|
||||
|
||||
[self.textField.topAnchor constraintEqualToAnchor:self.contentView.topAnchor constant:1],
|
||||
[self.contentView.bottomAnchor constraintGreaterThanOrEqualToAnchor:self.textField.bottomAnchor],
|
||||
[self.textField.heightAnchor constraintGreaterThanOrEqualToConstant:43],
|
||||
|
||||
|
||||
[self.inputAccessoryToolbar.heightAnchor constraintEqualToConstant:44],
|
||||
]];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -205,9 +190,7 @@
|
|||
break;
|
||||
case STPAddressFieldTypePhone:
|
||||
self.textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
self.textField.textContentType = UITextContentTypeTelephoneNumber;
|
||||
}
|
||||
STPFormTextFieldAutoFormattingBehavior behavior = ([self countryCodeIsUnitedStates] ?
|
||||
STPFormTextFieldAutoFormattingBehaviorPhoneNumbers :
|
||||
STPFormTextFieldAutoFormattingBehaviorNone);
|
||||
|
@ -215,9 +198,7 @@
|
|||
break;
|
||||
case STPAddressFieldTypeEmail:
|
||||
self.textField.keyboardType = UIKeyboardTypeEmailAddress;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
self.textField.textContentType = UITextContentTypeEmailAddress;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -227,17 +227,12 @@
|
|||
});
|
||||
};
|
||||
|
||||
if (@available(iOS 11, *)) {
|
||||
CNMutablePostalAddress *address = [CNMutablePostalAddress new];
|
||||
address.postalCode = zipCode;
|
||||
address.ISOCountryCode = _addressFieldTableViewCountryCode;
|
||||
|
||||
[geocoder geocodePostalAddress:address.copy
|
||||
completionHandler:onCompletion];
|
||||
} else {
|
||||
[geocoder geocodeAddressString:[NSString stringWithFormat:@"%@, %@", zipCode, _addressFieldTableViewCountryCode]
|
||||
completionHandler:onCompletion];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,10 +114,7 @@ typedef NS_ENUM(NSUInteger, STPPaymentState) {
|
|||
- (NSDictionary *)_delegateToAppleDelegateMapping {
|
||||
return @{
|
||||
NSStringFromSelector(@selector(paymentAuthorizationViewController:didSelectShippingMethod:handler:)) : NSStringFromSelector(@selector(applePayContext:didSelectShippingMethod:handler:)),
|
||||
NSStringFromSelector(@selector(paymentAuthorizationViewController:didSelectShippingMethod:completion:)) : NSStringFromSelector(@selector(applePayContext:didSelectShippingMethod:completion:)),
|
||||
NSStringFromSelector(@selector(paymentAuthorizationViewController:didSelectShippingContact:handler:)) : NSStringFromSelector(@selector(applePayContext:didSelectShippingContact:handler:)),
|
||||
NSStringFromSelector(@selector(paymentAuthorizationViewController:didSelectShippingContact:completion:)) : NSStringFromSelector(@selector(applePayContext:didSelectShippingContact:completion:)),
|
||||
|
||||
NSStringFromSelector(@selector(paymentAuthorizationViewController:didSelectShippingContact:handler:)) : NSStringFromSelector(@selector(applePayContext:didSelectShippingContact:handler:))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -151,11 +148,9 @@ typedef NS_ENUM(NSUInteger, STPPaymentState) {
|
|||
|
||||
#pragma mark - PKPaymentAuthorizationViewControllerDelegate
|
||||
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller
|
||||
didAuthorizePayment:(nonnull PKPayment *)payment
|
||||
handler:(nonnull void (^)(PKPaymentAuthorizationResult * _Nonnull))completion API_AVAILABLE(ios(11.0)) {
|
||||
handler:(nonnull void (^)(PKPaymentAuthorizationResult * _Nonnull))completion {
|
||||
// Some observations (on iOS 12 simulator):
|
||||
// - The docs say localizedDescription can be shown in the Apple Pay sheet, but I haven't seen this.
|
||||
// - If you call the completion block w/ a status of .failure and an error, the user is prompted to try again.
|
||||
|
@ -167,41 +162,18 @@ typedef NS_ENUM(NSUInteger, STPPaymentState) {
|
|||
}];
|
||||
}
|
||||
|
||||
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller
|
||||
didAuthorizePayment:(PKPayment *)payment
|
||||
completion:(nonnull void (^)(PKPaymentAuthorizationStatus))completion {
|
||||
[self _completePaymentWithPayment:payment completion:^(PKPaymentAuthorizationStatus status, __unused NSError *error) {
|
||||
completion(status);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller didSelectShippingMethod:(nonnull PKShippingMethod *)shippingMethod handler:(nonnull void (^)(PKPaymentRequestShippingMethodUpdate * _Nonnull))completion API_AVAILABLE(ios(11.0)){
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller didSelectShippingMethod:(nonnull PKShippingMethod *)shippingMethod handler:(nonnull void (^)(PKPaymentRequestShippingMethodUpdate * _Nonnull))completion {
|
||||
if ([self.delegate respondsToSelector:@selector(applePayContext:didSelectShippingMethod:handler:)]) {
|
||||
[self.delegate applePayContext:self didSelectShippingMethod:shippingMethod handler:completion];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller didSelectShippingMethod:(PKShippingMethod *)shippingMethod completion:(void (^)(PKPaymentAuthorizationStatus, NSArray<PKPaymentSummaryItem *> * _Nonnull))completion {
|
||||
if ([self.delegate respondsToSelector:@selector(applePayContext:didSelectShippingMethod:completion:)]) {
|
||||
[self.delegate applePayContext:self didSelectShippingMethod:shippingMethod completion:completion];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller didSelectShippingContact:(PKContact *)contact handler:(void (^)(PKPaymentRequestShippingContactUpdate * _Nonnull))completion API_AVAILABLE(ios(11.0)){
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller didSelectShippingContact:(PKContact *)contact handler:(void (^)(PKPaymentRequestShippingContactUpdate * _Nonnull))completion {
|
||||
if ([self.delegate respondsToSelector:@selector(applePayContext:didSelectShippingContact:handler:)]) {
|
||||
[self.delegate applePayContext:self didSelectShippingContact:contact handler:completion];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller didSelectShippingContact:(PKContact *)contact completion:(void (^)(PKPaymentAuthorizationStatus, NSArray<PKShippingMethod *> * _Nonnull, NSArray<PKPaymentSummaryItem *> * _Nonnull))completion {
|
||||
if ([self.delegate respondsToSelector:@selector(applePayContext:didSelectShippingContact:completion:)]) {
|
||||
[self.delegate applePayContext:self didSelectShippingContact:contact completion:completion];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller {
|
||||
// Note: If you don't dismiss the VC, the UI disappears, the VC blocks interaction, and this method gets called again.
|
||||
// Note: This method is called if the user cancels (taps outside the sheet) or Apple Pay times out (empirically 30 seconds)
|
||||
|
|
|
@ -18,21 +18,30 @@
|
|||
@end
|
||||
|
||||
@implementation STPBundleLocator
|
||||
|
||||
+ (NSBundle *)stripeResourcesBundle {
|
||||
/**
|
||||
Places to check:
|
||||
1. Stripe.bundle (for manual static installations and framework-less Cocoapods)
|
||||
2. Stripe.framework/Stripe.bundle (for framework-based Cocoapods)
|
||||
3. Stripe.framework (for Carthage, manual dynamic installations)
|
||||
4. main bundle (for people dragging all our files into their project)
|
||||
1. Swift Package Manager bundle
|
||||
2. Stripe.bundle (for manual static installations and framework-less Cocoapods)
|
||||
3. Stripe.framework/Stripe.bundle (for framework-based Cocoapods)
|
||||
4. Stripe.framework (for Carthage, manual dynamic installations)
|
||||
5. main bundle (for people dragging all our files into their project)
|
||||
**/
|
||||
|
||||
static NSBundle *ourBundle;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
#ifdef SWIFT_PACKAGE
|
||||
if (Stripe_Stripe_SWIFTPM_MODULE_BUNDLE()) {
|
||||
ourBundle = Stripe_Stripe_SWIFTPM_MODULE_BUNDLE();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ourBundle == nil) {
|
||||
ourBundle = [NSBundle bundleWithPath:@"Stripe.bundle"];
|
||||
}
|
||||
|
||||
if (ourBundle == nil) {
|
||||
// This might be the same as the previous check if not using a dynamic framework
|
||||
NSString *path = [[NSBundle bundleForClass:[STPBundleLocatorInternal class]] pathForResource:@"Stripe" ofType:@"bundle"];
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
if (@available(iOS 11, *)) {
|
||||
self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
|
|
|
@ -78,10 +78,6 @@
|
|||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
self.automaticallyAdjustsScrollViewInsets = YES;
|
||||
#endif
|
||||
|
||||
[self createAndSetupViews];
|
||||
[self updateAppearance];
|
||||
}
|
||||
|
|
|
@ -66,11 +66,7 @@ typedef NS_ENUM(NSUInteger, STPFakeAddPaymentPassViewControllerState) {
|
|||
navBar.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[navBar.leftAnchor constraintEqualToAnchor:self.view.leftAnchor].active = YES;
|
||||
[navBar.rightAnchor constraintEqualToAnchor:self.view.rightAnchor].active = YES;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[navBar.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor].active = YES;
|
||||
} else {
|
||||
[navBar.topAnchor constraintEqualToAnchor:self.view.topAnchor].active = YES;
|
||||
}
|
||||
|
||||
UILabel *contentLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
self.contentLabel = contentLabel;
|
||||
|
|
|
@ -34,11 +34,7 @@
|
|||
_inShouldChangeCharactersInRange = YES;
|
||||
|
||||
BOOL insertingIntoEmptyField = (textField.text.length == 0 && range.location == 0 && range.length == 0);
|
||||
BOOL hasTextContentType = NO;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
// This property is available starting in 10.0, but didn't offer in-app suggestions till 11.0
|
||||
hasTextContentType = textField.textContentType != nil;
|
||||
}
|
||||
BOOL hasTextContentType = textField.textContentType != nil;
|
||||
|
||||
if (hasTextContentType && insertingIntoEmptyField && [string isEqualToString:@" "]) {
|
||||
/* Observed behavior w/iOS 11.0 through 11.2.0 (latest):
|
||||
|
|
|
@ -48,22 +48,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[textField.heightAnchor constraintEqualToConstant:[textField systemLayoutSizeFittingSize:UILayoutFittingExpandedSize].height],
|
||||
] mutableCopy];
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[constraints addObjectsFromArray:@[
|
||||
[formLabel.leadingAnchor constraintEqualToSystemSpacingAfterAnchor:self.layoutMarginsGuide.leadingAnchor multiplier:1.f],
|
||||
|
||||
[textField.leadingAnchor constraintEqualToSystemSpacingAfterAnchor:formLabel.trailingAnchor multiplier:2.f],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToSystemSpacingAfterAnchor:textField.trailingAnchor multiplier:1.f],
|
||||
]];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
[constraints addObjectsFromArray:@[
|
||||
[formLabel.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
|
||||
[textField.leadingAnchor constraintEqualToAnchor:formLabel.trailingAnchor constant:kLabeledFormHorizontalMargin],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToAnchor:textField.trailingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
]];
|
||||
}
|
||||
|
||||
_labelWidthDimension = formLabel.widthAnchor;
|
||||
_formLabel = formLabel;
|
||||
|
|
|
@ -82,7 +82,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[textField2.heightAnchor constraintEqualToConstant:[textField2 systemLayoutSizeFittingSize:UILayoutFittingExpandedSize].height],
|
||||
] mutableCopy];
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[constraints addObjectsFromArray:@[
|
||||
[formLabel.leadingAnchor constraintEqualToSystemSpacingAfterAnchor:self.layoutMarginsGuide.leadingAnchor multiplier:1.f],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:formLabel.trailingAnchor multiplier:1.f],
|
||||
|
@ -90,15 +89,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[textField1.leadingAnchor constraintEqualToSystemSpacingAfterAnchor:self.layoutMarginsGuide.leadingAnchor multiplier:1.f],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToSystemSpacingAfterAnchor:textField2.trailingAnchor multiplier:1.f],
|
||||
]];
|
||||
} else {
|
||||
[constraints addObjectsFromArray:@[
|
||||
[formLabel.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToAnchor:formLabel.trailingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
|
||||
[textField1.leadingAnchor constraintEqualToAnchor:self.layoutMarginsGuide.leadingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
[self.layoutMarginsGuide.trailingAnchor constraintEqualToAnchor:textField2.trailingAnchor constant:kLabeledFormiOS10EdgeInset],
|
||||
]];
|
||||
}
|
||||
|
||||
[NSLayoutConstraint activateConstraints:constraints];
|
||||
|
||||
|
|
|
@ -105,9 +105,7 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) {
|
|||
_paymentCountry = @"US";
|
||||
_paymentAmountModel = [[STPPaymentContextAmountModel alloc] initWithAmount:0];
|
||||
_modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
if (@available(iOS 11, *)) {
|
||||
_largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic;
|
||||
}
|
||||
_state = STPPaymentContextStateNone;
|
||||
[self retryLoading];
|
||||
}
|
||||
|
@ -324,15 +322,11 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) {
|
|||
paymentOptionsViewController.defaultPaymentMethod = strongSelf.defaultPaymentMethod;
|
||||
paymentOptionsViewController.paymentOptionsViewControllerFooterView = strongSelf.paymentOptionsViewControllerFooterView;
|
||||
paymentOptionsViewController.addCardViewControllerFooterView = strongSelf.addCardViewControllerFooterView;
|
||||
if (@available(iOS 11, *)) {
|
||||
paymentOptionsViewController.navigationItem.largeTitleDisplayMode = strongSelf.largeTitleDisplayMode;
|
||||
}
|
||||
|
||||
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:paymentOptionsViewController];
|
||||
navigationController.navigationBar.stp_theme = strongSelf.theme;
|
||||
if (@available(iOS 11, *)) {
|
||||
navigationController.navigationBar.prefersLargeTitles = YES;
|
||||
}
|
||||
navigationController.modalPresentationStyle = strongSelf.modalPresentationStyle;
|
||||
[strongSelf.hostViewController presentViewController:navigationController
|
||||
animated:[strongSelf transitionAnimationsEnabled]
|
||||
|
@ -362,9 +356,7 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) {
|
|||
paymentOptionsViewController.defaultPaymentMethod = strongSelf.defaultPaymentMethod;
|
||||
paymentOptionsViewController.paymentOptionsViewControllerFooterView = strongSelf.paymentOptionsViewControllerFooterView;
|
||||
paymentOptionsViewController.addCardViewControllerFooterView = strongSelf.addCardViewControllerFooterView;
|
||||
if (@available(iOS 11, *)) {
|
||||
paymentOptionsViewController.navigationItem.largeTitleDisplayMode = strongSelf.largeTitleDisplayMode;
|
||||
}
|
||||
|
||||
[navigationController pushViewController:paymentOptionsViewController
|
||||
animated:[strongSelf transitionAnimationsEnabled]];
|
||||
|
@ -448,14 +440,10 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) {
|
|||
strongSelf.state = state;
|
||||
|
||||
STPShippingAddressViewController *addressViewController = [[STPShippingAddressViewController alloc] initWithPaymentContext:strongSelf];
|
||||
if (@available(iOS 11, *)) {
|
||||
addressViewController.navigationItem.largeTitleDisplayMode = strongSelf.largeTitleDisplayMode;
|
||||
}
|
||||
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addressViewController];
|
||||
navigationController.navigationBar.stp_theme = strongSelf.theme;
|
||||
if (@available(iOS 11, *)) {
|
||||
navigationController.navigationBar.prefersLargeTitles = YES;
|
||||
}
|
||||
navigationController.modalPresentationStyle = strongSelf.modalPresentationStyle;
|
||||
[strongSelf.hostViewController presentViewController:navigationController
|
||||
animated:[strongSelf transitionAnimationsEnabled]
|
||||
|
@ -480,9 +468,7 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) {
|
|||
strongSelf.state = STPPaymentContextStateShowingRequestedViewController;
|
||||
|
||||
STPShippingAddressViewController *addressViewController = [[STPShippingAddressViewController alloc] initWithPaymentContext:strongSelf];
|
||||
if (@available(iOS 11, *)) {
|
||||
addressViewController.navigationItem.largeTitleDisplayMode = strongSelf.largeTitleDisplayMode;
|
||||
}
|
||||
[navigationController pushViewController:addressViewController
|
||||
animated:[strongSelf transitionAnimationsEnabled]];
|
||||
}
|
||||
|
@ -703,26 +689,14 @@ typedef NS_ENUM(NSUInteger, STPPaymentContextState) {
|
|||
paymentRequest.paymentSummaryItems = summaryItems;
|
||||
|
||||
|
||||
if (@available(iOS 11, *)) {
|
||||
NSSet<PKContactField> *requiredFields = [STPAddress applePayContactFieldsFromBillingAddressFields:self.configuration.requiredBillingAddressFields];
|
||||
if (requiredFields) {
|
||||
paymentRequest.requiredBillingContactFields = requiredFields;
|
||||
}
|
||||
} else {
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
paymentRequest.requiredBillingAddressFields = [STPAddress applePayAddressFieldsFromBillingAddressFields:self.configuration.requiredBillingAddressFields];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (@available(iOS 11, *)) {
|
||||
NSSet<PKContactField> *requiredFields = [STPAddress pkContactFieldsFromStripeContactFields:self.configuration.requiredShippingAddressFields];
|
||||
NSSet<PKContactField> *shippingRequiredFields = [STPAddress pkContactFieldsFromStripeContactFields:self.configuration.requiredShippingAddressFields];
|
||||
if (requiredFields) {
|
||||
paymentRequest.requiredShippingContactFields = requiredFields;
|
||||
}
|
||||
} else {
|
||||
#if !(defined(TARGET_OS_MACCATALYST) && (TARGET_OS_MACCATALYST != 0))
|
||||
paymentRequest.requiredShippingAddressFields = [STPAddress pkAddressFieldsFromStripeContactFields:self.configuration.requiredShippingAddressFields];
|
||||
#endif
|
||||
paymentRequest.requiredShippingContactFields = shippingRequiredFields;
|
||||
}
|
||||
|
||||
paymentRequest.currencyCode = self.paymentCurrency.uppercaseString;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -243,19 +243,12 @@ typedef void (^STPBoolCompletionBlock)(BOOL success);
|
|||
server-side failures from Stripe.
|
||||
*/
|
||||
if (didLoadSuccessfully == NO) {
|
||||
if (@available(iOS 11, *)) {
|
||||
stpDispatchToMainThreadIfNecessary(^{
|
||||
if ([self.lastKnownSafariVCURL.host containsString:@"stripe.com"]) {
|
||||
[self handleRedirectCompletionWithError:[NSError stp_genericConnectionError]
|
||||
shouldDismissViewController:YES];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
/*
|
||||
We can only track the latest URL loaded on iOS 11, because `safariViewController:initialLoadDidRedirectToURL:`
|
||||
didn't exist prior to that. This might be a spurious error, so we need to ignore it.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,12 +160,8 @@ static UIFont *STPThemeDefaultMediumFont;
|
|||
if (_font != nil) {
|
||||
return [_font copy];
|
||||
} else {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
UIFontMetrics *fontMetrics = [UIFontMetrics metricsForTextStyle:UIFontTextStyleBody];
|
||||
return [fontMetrics scaledFontForFont:STPThemeDefaultFont];
|
||||
} else {
|
||||
return STPThemeDefaultFont;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,12 +169,8 @@ static UIFont *STPThemeDefaultMediumFont;
|
|||
if (_emphasisFont != nil) {
|
||||
return [_emphasisFont copy];
|
||||
} else {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
UIFontMetrics *fontMetrics = [UIFontMetrics metricsForTextStyle:UIFontTextStyleBody];
|
||||
return [fontMetrics scaledFontForFont:STPThemeDefaultMediumFont];
|
||||
} else {
|
||||
return STPThemeDefaultMediumFont;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
//
|
||||
// STPThreeDSButtonCustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/17/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSButtonCustomization.h"
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
|
||||
#import <Stripe/STDSButtonCustomization.h>
|
||||
|
||||
@implementation STPThreeDSButtonCustomization
|
||||
|
||||
+ (instancetype)defaultSettingsForButtonType:(STPThreeDSCustomizationButtonType)type {
|
||||
STDSButtonCustomization *stdsButtonCustomization = [STDSButtonCustomization defaultSettingsForButtonType:(STDSUICustomizationButtonType)type];
|
||||
|
||||
STPThreeDSButtonCustomization *buttonCustomization = [[STPThreeDSButtonCustomization alloc] initWithBackgroundColor:stdsButtonCustomization.backgroundColor cornerRadius:stdsButtonCustomization.cornerRadius];
|
||||
buttonCustomization.buttonCustomization = stdsButtonCustomization;
|
||||
return buttonCustomization;
|
||||
}
|
||||
|
||||
- (instancetype)initWithBackgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_buttonCustomization = [[STDSButtonCustomization alloc] initWithBackgroundColor:backgroundColor cornerRadius:cornerRadius];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UIColor *)backgroundColor {
|
||||
return self.buttonCustomization.backgroundColor;
|
||||
}
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor {
|
||||
self.buttonCustomization.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
- (CGFloat)cornerRadius {
|
||||
return self.buttonCustomization.cornerRadius;
|
||||
}
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)cornerRadius {
|
||||
self.buttonCustomization.cornerRadius = cornerRadius;
|
||||
}
|
||||
|
||||
- (STPThreeDSButtonTitleStyle)titleStyle {
|
||||
return (STPThreeDSButtonTitleStyle)self.buttonCustomization.titleStyle;
|
||||
}
|
||||
|
||||
- (void)setTitleStyle:(STPThreeDSButtonTitleStyle)titleStyle {
|
||||
self.buttonCustomization.titleStyle = (STDSButtonTitleStyle)titleStyle;
|
||||
}
|
||||
|
||||
- (UIFont *)font {
|
||||
return self.buttonCustomization.font;
|
||||
}
|
||||
|
||||
- (void)setFont:(UIFont *)font {
|
||||
self.buttonCustomization.font = font;
|
||||
}
|
||||
|
||||
- (UIColor *)textColor {
|
||||
return self.buttonCustomization.textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
self.buttonCustomization.textColor = textColor;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// STPThreeDSCustomizationSettings.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Cameron Sabol on 5/30/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSCustomizationSettings.h"
|
||||
|
||||
#import "STPThreeDSUICustomization.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation STPThreeDSCustomizationSettings
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_uiCustomization = [STPThreeDSUICustomization defaultSettings];
|
||||
_authenticationTimeout = 5;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [self new];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,76 @@
|
|||
//
|
||||
// STPThreeDSFooterCustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/17/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSFooterCustomization.h"
|
||||
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
#import <Stripe/STDSFooterCustomization.h>
|
||||
|
||||
@implementation STPThreeDSFooterCustomization
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [STPThreeDSFooterCustomization new];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_footerCustomization = [STDSFooterCustomization defaultSettings];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UIColor *)backgroundColor {
|
||||
return self.footerCustomization.backgroundColor;
|
||||
}
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor {
|
||||
self.footerCustomization.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
- (UIColor *)chevronColor {
|
||||
return self.footerCustomization.chevronColor;
|
||||
}
|
||||
|
||||
- (void)setChevronColor:(UIColor *)chevronColor {
|
||||
self.footerCustomization.chevronColor = chevronColor;
|
||||
}
|
||||
|
||||
- (UIColor *)headingTextColor {
|
||||
return self.footerCustomization.headingTextColor;
|
||||
}
|
||||
|
||||
- (void)setHeadingTextColor:(UIColor *)headingTextColor {
|
||||
self.footerCustomization.headingTextColor = headingTextColor;
|
||||
}
|
||||
|
||||
- (UIFont *)headingFont {
|
||||
return self.footerCustomization.headingFont;
|
||||
}
|
||||
|
||||
- (void)setHeadingFont:(UIFont *)headingFont {
|
||||
self.footerCustomization.headingFont = headingFont;
|
||||
}
|
||||
|
||||
- (UIFont *)font {
|
||||
return self.footerCustomization.font;
|
||||
}
|
||||
|
||||
- (void)setFont:(UIFont *)font {
|
||||
self.footerCustomization.font = font;
|
||||
}
|
||||
|
||||
- (UIColor *)textColor {
|
||||
return self.footerCustomization.textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
self.footerCustomization.textColor = textColor;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,60 @@
|
|||
//
|
||||
// STPThreeDSLabelCustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/17/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSLabelCustomization.h"
|
||||
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
#import <Stripe/STDSLabelCustomization.h>
|
||||
|
||||
@implementation STPThreeDSLabelCustomization
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [STPThreeDSLabelCustomization new];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_labelCustomization = [STDSLabelCustomization defaultSettings];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UIFont *)headingFont {
|
||||
return self.labelCustomization.headingFont;
|
||||
}
|
||||
|
||||
- (void)setHeadingFont:(UIFont *)headingFont {
|
||||
self.labelCustomization.headingFont = headingFont;
|
||||
}
|
||||
|
||||
- (UIColor *)headingTextColor {
|
||||
return self.labelCustomization.headingTextColor;
|
||||
}
|
||||
|
||||
- (void)setHeadingTextColor:(UIColor *)headingTextColor {
|
||||
self.labelCustomization.headingTextColor = headingTextColor;
|
||||
}
|
||||
|
||||
- (UIFont *)font {
|
||||
return self.labelCustomization.font;
|
||||
}
|
||||
|
||||
- (void)setFont:(UIFont *)font {
|
||||
self.labelCustomization.font = font;
|
||||
}
|
||||
|
||||
- (UIColor *)textColor {
|
||||
return self.labelCustomization.textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
self.labelCustomization.textColor = textColor;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// STPThreeDSNavigationBarCustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/17/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSNavigationBarCustomization.h"
|
||||
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
#import <Stripe/STDSNavigationBarCustomization.h>
|
||||
|
||||
@implementation STPThreeDSNavigationBarCustomization
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [STPThreeDSNavigationBarCustomization new];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_navigationBarCustomization = [STDSNavigationBarCustomization defaultSettings];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UIColor *)barTintColor {
|
||||
return self.navigationBarCustomization.barTintColor;
|
||||
}
|
||||
|
||||
- (void)setBarTintColor:(UIColor *)barTintColor {
|
||||
self.navigationBarCustomization.barTintColor = barTintColor;
|
||||
}
|
||||
|
||||
- (UIBarStyle)barStyle {
|
||||
return self.navigationBarCustomization.barStyle;
|
||||
}
|
||||
|
||||
- (void)setBarStyle:(UIBarStyle)barStyle {
|
||||
self.navigationBarCustomization.barStyle = barStyle;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)isTranslucent {
|
||||
return self.navigationBarCustomization.translucent;
|
||||
}
|
||||
|
||||
- (void)setTranslucent:(BOOL)translucent {
|
||||
self.navigationBarCustomization.translucent = translucent;
|
||||
}
|
||||
|
||||
- (NSString *)headerText {
|
||||
return self.navigationBarCustomization.headerText;
|
||||
}
|
||||
|
||||
- (void)setHeaderText:(NSString *)headerText {
|
||||
self.navigationBarCustomization.headerText = headerText;
|
||||
}
|
||||
|
||||
- (NSString *)buttonText {
|
||||
return self.navigationBarCustomization.buttonText;
|
||||
}
|
||||
|
||||
- (void)setButtonText:(NSString *)buttonText {
|
||||
self.navigationBarCustomization.buttonText = buttonText;
|
||||
}
|
||||
|
||||
- (UIFont *)font {
|
||||
return self.navigationBarCustomization.font;
|
||||
}
|
||||
|
||||
- (void)setFont:(UIFont *)font {
|
||||
self.navigationBarCustomization.font = font;
|
||||
}
|
||||
|
||||
- (UIColor *)textColor {
|
||||
return self.navigationBarCustomization.textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
self.navigationBarCustomization.textColor = textColor;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,60 @@
|
|||
//
|
||||
// STPThreeDSSelectionCustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/18/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSSelectionCustomization.h"
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
|
||||
#import <Stripe/STDSSelectionCustomization.h>
|
||||
|
||||
@implementation STPThreeDSSelectionCustomization
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [STPThreeDSSelectionCustomization new];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_selectionCustomization = [STDSSelectionCustomization defaultSettings];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UIColor *)primarySelectedColor {
|
||||
return self.selectionCustomization.primarySelectedColor;
|
||||
}
|
||||
|
||||
- (void)setPrimarySelectedColor:(UIColor *)primarySelectedColor {
|
||||
self.selectionCustomization.primarySelectedColor = primarySelectedColor;
|
||||
}
|
||||
|
||||
- (UIColor *)secondarySelectedColor {
|
||||
return self.selectionCustomization.secondarySelectedColor;
|
||||
}
|
||||
|
||||
- (void)setSecondarySelectedColor:(UIColor *)secondarySelectedColor {
|
||||
self.selectionCustomization.secondarySelectedColor = secondarySelectedColor;
|
||||
}
|
||||
|
||||
- (UIColor *)unselectedBackgroundColor {
|
||||
return self.selectionCustomization.unselectedBackgroundColor;
|
||||
}
|
||||
|
||||
- (void)setUnselectedBackgroundColor:(UIColor *)unselectedBackgroundColor {
|
||||
self.selectionCustomization.unselectedBackgroundColor = unselectedBackgroundColor;
|
||||
}
|
||||
|
||||
- (UIColor *)unselectedBorderColor {
|
||||
return self.selectionCustomization.unselectedBorderColor;
|
||||
}
|
||||
|
||||
- (void)setUnselectedBorderColor:(UIColor *)unselectedBorderColor {
|
||||
self.selectionCustomization.unselectedBorderColor = unselectedBorderColor;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,84 @@
|
|||
//
|
||||
// STPThreeDSTextFieldCustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/18/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSTextFieldCustomization.h"
|
||||
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
#import <Stripe/STDSTextFieldCustomization.h>
|
||||
|
||||
@implementation STPThreeDSTextFieldCustomization
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [self new];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_textFieldCustomization = [STDSTextFieldCustomization defaultSettings];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CGFloat)borderWidth {
|
||||
return self.textFieldCustomization.borderWidth;
|
||||
}
|
||||
|
||||
- (void)setBorderWidth:(CGFloat)borderWidth {
|
||||
self.textFieldCustomization.borderWidth = borderWidth;
|
||||
}
|
||||
|
||||
- (UIColor *)borderColor {
|
||||
return self.textFieldCustomization.borderColor;
|
||||
}
|
||||
|
||||
- (void)setBorderColor:(UIColor *)borderColor {
|
||||
self.textFieldCustomization.borderColor = borderColor;
|
||||
}
|
||||
|
||||
- (CGFloat)cornerRadius {
|
||||
return self.textFieldCustomization.cornerRadius;
|
||||
}
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)cornerRadius {
|
||||
self.textFieldCustomization.cornerRadius = cornerRadius;
|
||||
}
|
||||
|
||||
- (UIKeyboardAppearance)keyboardAppearance {
|
||||
return self.textFieldCustomization.keyboardAppearance;
|
||||
}
|
||||
|
||||
- (void)setKeyboardAppearance:(UIKeyboardAppearance)keyboardAppearance {
|
||||
self.textFieldCustomization.keyboardAppearance = keyboardAppearance;
|
||||
}
|
||||
|
||||
- (UIColor *)placeholderTextColor {
|
||||
return self.textFieldCustomization.placeholderTextColor;
|
||||
}
|
||||
|
||||
- (void)setPlaceholderTextColor:(UIColor *)placeholderTextColor {
|
||||
self.textFieldCustomization.placeholderTextColor = placeholderTextColor;
|
||||
}
|
||||
|
||||
- (UIFont *)font {
|
||||
return self.textFieldCustomization.font;
|
||||
}
|
||||
|
||||
- (void)setFont:(UIFont *)font {
|
||||
self.textFieldCustomization.font = font;
|
||||
}
|
||||
|
||||
- (UIColor *)textColor {
|
||||
return self.textFieldCustomization.textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(UIColor *)textColor {
|
||||
self.textFieldCustomization.textColor = textColor;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,123 @@
|
|||
//
|
||||
// STPThreeDSUICustomization.m
|
||||
// StripeiOS
|
||||
//
|
||||
// Created by Yuki Tokuhiro on 6/17/19.
|
||||
// Copyright © 2019 Stripe, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import "STPThreeDSUICustomization.h"
|
||||
#import "STPThreeDSCustomization+Private.h"
|
||||
#import "STPThreeDSFooterCustomization.h"
|
||||
|
||||
#import <Stripe/STDSUICustomization.h>
|
||||
|
||||
@interface STPThreeDSUICustomization()
|
||||
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, STPThreeDSButtonCustomization *> *buttonCustomizationDictionary;
|
||||
@end
|
||||
|
||||
@implementation STPThreeDSUICustomization
|
||||
|
||||
+ (instancetype)defaultSettings {
|
||||
return [STPThreeDSUICustomization new];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Initialize defaults for all properties
|
||||
_footerCustomization = [STPThreeDSFooterCustomization defaultSettings];
|
||||
_labelCustomization = [STPThreeDSLabelCustomization defaultSettings];
|
||||
_navigationBarCustomization = [STPThreeDSNavigationBarCustomization defaultSettings];
|
||||
_selectionCustomization = [STPThreeDSSelectionCustomization defaultSettings];
|
||||
_textFieldCustomization = [STPThreeDSTextFieldCustomization defaultSettings];
|
||||
|
||||
STPThreeDSButtonCustomization *nextButton = [STPThreeDSButtonCustomization defaultSettingsForButtonType:STPThreeDSCustomizationButtonTypeNext];
|
||||
STPThreeDSButtonCustomization *cancelButton = [STPThreeDSButtonCustomization defaultSettingsForButtonType:STPThreeDSCustomizationButtonTypeCancel];
|
||||
STPThreeDSButtonCustomization *resendButton = [STPThreeDSButtonCustomization defaultSettingsForButtonType:STPThreeDSCustomizationButtonTypeResend];
|
||||
STPThreeDSButtonCustomization *submitButton = [STPThreeDSButtonCustomization defaultSettingsForButtonType:STPThreeDSCustomizationButtonTypeSubmit];
|
||||
STPThreeDSButtonCustomization *continueButton = [STPThreeDSButtonCustomization defaultSettingsForButtonType:STPThreeDSCustomizationButtonTypeContinue];
|
||||
_buttonCustomizationDictionary = [@{
|
||||
@(STPThreeDSCustomizationButtonTypeNext): nextButton,
|
||||
@(STPThreeDSCustomizationButtonTypeCancel): cancelButton,
|
||||
@(STPThreeDSCustomizationButtonTypeResend): resendButton,
|
||||
@(STPThreeDSCustomizationButtonTypeSubmit): submitButton,
|
||||
@(STPThreeDSCustomizationButtonTypeContinue): continueButton,
|
||||
} mutableCopy];
|
||||
|
||||
// Initialize the underlying STDS class we are wrapping
|
||||
_uiCustomization = [STDSUICustomization new];
|
||||
[_uiCustomization setButtonCustomization:nextButton.buttonCustomization forType:STDSUICustomizationButtonTypeNext];
|
||||
[_uiCustomization setButtonCustomization:cancelButton.buttonCustomization forType:STDSUICustomizationButtonTypeCancel];
|
||||
[_uiCustomization setButtonCustomization:resendButton.buttonCustomization forType:STDSUICustomizationButtonTypeResend];
|
||||
[_uiCustomization setButtonCustomization:submitButton.buttonCustomization forType:STDSUICustomizationButtonTypeSubmit];
|
||||
[_uiCustomization setButtonCustomization:continueButton.buttonCustomization forType:STDSUICustomizationButtonTypeContinue];
|
||||
|
||||
_uiCustomization.footerCustomization = _footerCustomization.footerCustomization;
|
||||
_uiCustomization.labelCustomization = _labelCustomization.labelCustomization;
|
||||
_uiCustomization.navigationBarCustomization = _navigationBarCustomization.navigationBarCustomization;
|
||||
_uiCustomization.selectionCustomization = _selectionCustomization.selectionCustomization;
|
||||
_uiCustomization.textFieldCustomization = _textFieldCustomization.textFieldCustomization;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setButtonCustomization:(STPThreeDSButtonCustomization *)buttonCustomization forType:(STPThreeDSCustomizationButtonType)buttonType {
|
||||
self.buttonCustomizationDictionary[@(buttonType)] = buttonCustomization;
|
||||
[self.uiCustomization setButtonCustomization:buttonCustomization.buttonCustomization forType:(STDSUICustomizationButtonType)buttonType];
|
||||
}
|
||||
|
||||
- (STPThreeDSButtonCustomization *)buttonCustomizationForButtonType:(STPThreeDSCustomizationButtonType)buttonType {
|
||||
return self.buttonCustomizationDictionary[@(buttonType)];
|
||||
}
|
||||
|
||||
- (void)setFooterCustomization:(STPThreeDSFooterCustomization *)footerCustomization {
|
||||
_footerCustomization = footerCustomization;
|
||||
self.uiCustomization.footerCustomization = footerCustomization.footerCustomization;
|
||||
}
|
||||
|
||||
- (void)setLabelCustomization:(STPThreeDSLabelCustomization *)labelCustomization {
|
||||
_labelCustomization = labelCustomization;
|
||||
self.uiCustomization.labelCustomization = labelCustomization.labelCustomization;
|
||||
}
|
||||
|
||||
- (void)setNavigationBarCustomization:(STPThreeDSNavigationBarCustomization *)navigationBarCustomization {
|
||||
_navigationBarCustomization = navigationBarCustomization;
|
||||
self.uiCustomization.navigationBarCustomization = navigationBarCustomization.navigationBarCustomization;
|
||||
}
|
||||
|
||||
- (void)setSelectionCustomization:(STPThreeDSSelectionCustomization *)selectionCustomization {
|
||||
_selectionCustomization = selectionCustomization;
|
||||
self.uiCustomization.selectionCustomization = selectionCustomization.selectionCustomization;
|
||||
}
|
||||
|
||||
- (void)setTextFieldCustomization:(STPThreeDSTextFieldCustomization *)textFieldCustomization {
|
||||
_textFieldCustomization = textFieldCustomization;
|
||||
self.uiCustomization.textFieldCustomization = textFieldCustomization.textFieldCustomization;
|
||||
}
|
||||
|
||||
- (UIColor *)backgroundColor {
|
||||
return self.uiCustomization.backgroundColor;
|
||||
}
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor {
|
||||
self.uiCustomization.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
- (UIActivityIndicatorViewStyle)activityIndicatorViewStyle {
|
||||
return self.uiCustomization.activityIndicatorViewStyle;
|
||||
}
|
||||
|
||||
- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle {
|
||||
self.uiCustomization.activityIndicatorViewStyle = activityIndicatorViewStyle;
|
||||
}
|
||||
|
||||
- (UIBlurEffectStyle)blurStyle {
|
||||
return self.uiCustomization.blurStyle;
|
||||
}
|
||||
|
||||
- (void)setBlurStyle:(UIBlurEffectStyle)blurStyle {
|
||||
self.uiCustomization.blurStyle = blurStyle;
|
||||
}
|
||||
|
||||
@end
|
|
@ -41,14 +41,6 @@
|
|||
[self setAttributedPlaceholder:attributedPlaceholder];
|
||||
}
|
||||
|
||||
// Workaround for http://www.openradar.appspot.com/19374610
|
||||
- (CGRect)editingRectForBounds:(CGRect)bounds {
|
||||
// danj: I still see a small vertical jump between the editingRect & textRect for text fields in
|
||||
// iOS 10.0-10.3 (but not 9.0 or 11.0-11.2). By using the textRect as the editingRect, this prevents
|
||||
// mismatches causing vertical mis-alignments
|
||||
return [self textRectForBounds:bounds];
|
||||
}
|
||||
|
||||
#pragma mark - Private Methods
|
||||
|
||||
- (void)updateColor {
|
||||
|
|
|
@ -38,13 +38,10 @@ static NSInteger const STPNavigationBarHairlineViewTag = 787473;
|
|||
NSFontAttributeName: theme.emphasisFont,
|
||||
NSForegroundColorAttributeName: theme.primaryForegroundColor,
|
||||
};
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.largeTitleTextAttributes = @{
|
||||
NSForegroundColorAttributeName: theme.primaryForegroundColor,
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef __IPHONE_13_0
|
||||
if (@available(iOS 13.0, *)) {
|
||||
self.standardAppearance.backgroundColor = theme.secondaryBackgroundColor;
|
||||
self.standardAppearance.titleTextAttributes = self.titleTextAttributes;
|
||||
|
@ -76,7 +73,6 @@ static NSInteger const STPNavigationBarHairlineViewTag = 787473;
|
|||
self.scrollEdgeAppearance = self.standardAppearance;
|
||||
self.compactAppearance = self.standardAppearance;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,16 +13,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@implementation UIView (Stripe_SafeAreaBounds)
|
||||
|
||||
- (CGRect)stp_boundsWithHorizontalSafeAreaInsets {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
UIEdgeInsets insets = self.safeAreaInsets;
|
||||
CGRect safeBounds = CGRectMake(self.bounds.origin.x + insets.left,
|
||||
self.bounds.origin.y,
|
||||
self.bounds.size.width - (insets.left + insets.right),
|
||||
self.bounds.size.height);
|
||||
return safeBounds;
|
||||
} else {
|
||||
return self.bounds;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue