diff --git a/.travis.yml b/.travis.yml index 13ac1ac06b5..7260648faa2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode8.3 +osx_image: xcode9.2 branches: only: - master @@ -9,8 +9,7 @@ env: - TEST_TYPE=installation_carthage - TEST_TYPE=installation_cocoapods - TEST_TYPE=installation_cocoapods_frameworks -# Fauxpas 1.7.2 does not build our project correctly https://bitbucket.org/ali_rantakari/faux-pas/issues/117/unrecoverable-compiler-error-translation -# - TEST_TYPE=lint + - TEST_TYPE=lint - TEST_TYPE=tests - TEST_TYPE=analyzer - TEST_TYPE=documentation @@ -19,7 +18,7 @@ env: secure: gZMOaHQIeG7nplBCuH7EKf9o6Ez2rtoSskrv3nOTziSxFfZq322MrxvkidDpEN7AKWYQm27FO+tCzgq0slXb578lQ9P5ySDwEdExKtk/jMtKsBsf3cr4dzSMiqV5D5TbsH2jE9HQlpYUoJeoMBicR2XsTmd7wiu2jAzNBFqGfiY= before_install: -- SIMULATOR_ID=$(xcrun instruments -s | grep -o "iPhone 6 (10.3) \[.*\]" | grep -o +- SIMULATOR_ID=$(xcrun instruments -s | grep -o "iPhone 6 (11.2) \[.*\]" | grep -o "\[.*\]" | sed "s/^\[\(.*\)\]$/\1/") script: - open -a "simulator" --args -CurrentDeviceUDID $SIMULATOR_ID diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ed2a0004f7..c072b2de3a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## 12.0.0 2017-12-XX +* Minimum supported iOS version is now 9.0. + * If you need to support iOS 8, the last supported version is [11.5.0](https://github.com/stripe/stripe-ios/releases/tag/v11.5.0) +* Minimum supported Xcode version is now 9.0 +* `AddressBook` framework support has been removed. * `STPRedirectContext` will no longer retain itself for the duration of the redirect, you must explicitly maintain a reference to it yourself. +* See MIGRATING.md for more information on any of the previously mentioned breaking API changes. ## 11.5.0 2017-11-09 * Adds a new helper method to `STPSourceParams` for creating reusable Alipay sources. [#811](https://github.com/stripe/stripe-ios/pull/811) diff --git a/Example/Custom Integration (ObjC).xcodeproj/xcshareddata/xcschemes/Custom Integration (ObjC).xcscheme b/Example/Custom Integration (ObjC).xcodeproj/xcshareddata/xcschemes/Custom Integration (ObjC).xcscheme index 79938cb6fe2..91b6d1e5e7b 100644 --- a/Example/Custom Integration (ObjC).xcodeproj/xcshareddata/xcschemes/Custom Integration (ObjC).xcscheme +++ b/Example/Custom Integration (ObjC).xcodeproj/xcshareddata/xcschemes/Custom Integration (ObjC).xcscheme @@ -1,6 +1,6 @@ 'MIT', :file => 'LICENSE' } s.homepage = 'https://stripe.com/docs/mobile/ios' s.authors = { 'Stripe' => 'support+github@stripe.com' } s.source = { :git => 'https://github.com/stripe/stripe-ios.git', :tag => "v#{s.version}" } - s.frameworks = 'Foundation', 'Security', 'WebKit', 'PassKit', 'AddressBook', 'CoreLocation' - s.weak_frameworks = 'Contacts' + s.frameworks = 'Foundation', 'Security', 'WebKit', 'PassKit', 'Contacts', 'CoreLocation' s.requires_arc = true s.platform = :ios - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' s.public_header_files = 'Stripe/PublicHeaders/*.h' s.source_files = 'Stripe/PublicHeaders/*.h', 'Stripe/*.{h,m}' s.ios.resource_bundle = { 'Stripe' => 'Stripe/Resources/**/*' } - s.compiler_flags = '-Wno-unguarded-availability' end diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index b41afa89cee..dfe200e5acc 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -550,7 +550,6 @@ C1FEE5971CBFF11400A7632B /* STPPostalCodeValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5951CBFF11400A7632B /* STPPostalCodeValidator.m */; }; C1FEE5991CBFF24000A7632B /* STPPostalCodeValidatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5981CBFF24000A7632B /* STPPostalCodeValidatorTest.m */; }; F1122A7E1DFB84E000A8B1AF /* UINavigationBar+StripeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F1122A7D1DFB84E000A8B1AF /* UINavigationBar+StripeTest.m */; }; - F116E94B1D83404D0026A52A /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04B94BC71A47B78A00092C46 /* AddressBook.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; F116E94C1D83405E0026A52A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11C74B9B164043050071C2CA /* Foundation.framework */; }; F116E94D1D8340640026A52A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A0D74F918F6106100966D7B /* Security.framework */; }; F12829DA1D7747E4008B10D6 /* STPBundleLocator.h in Headers */ = {isa = PBXBuildFile; fileRef = F12829D81D7747E4008B10D6 /* STPBundleLocator.h */; }; @@ -631,7 +630,7 @@ F152322C1EA9306100D65C67 /* NSURLComponents+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = F15232291EA9306100D65C67 /* NSURLComponents+Stripe.m */; }; F152322D1EA9306100D65C67 /* NSURLComponents+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = F15232291EA9306100D65C67 /* NSURLComponents+Stripe.m */; }; F152322F1EA9344600D65C67 /* iDEALSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F152322E1EA9344000D65C67 /* iDEALSource.json */; }; - F15232311EA93E6800D65C67 /* Contacts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15232301EA93E6800D65C67 /* Contacts.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F15232311EA93E6800D65C67 /* Contacts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15232301EA93E6800D65C67 /* Contacts.framework */; settings = {ATTRIBUTES = (Required, ); }; }; F15675401DB544D3004468E3 /* STPAddCardViewControllerLocalizationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F156753F1DB544D3004468E3 /* STPAddCardViewControllerLocalizationTests.m */; }; F15AC18E1DBA9CA90009EADE /* FBSnapshotTestCase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15AC18D1DBA9CA90009EADE /* FBSnapshotTestCase.framework */; }; F15AC1901DBA9CC60009EADE /* FBSnapshotTestCase.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = F15AC18D1DBA9CA90009EADE /* FBSnapshotTestCase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -654,6 +653,10 @@ F1A2F92D1EEB6A70006B0456 /* NSCharacterSet+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = F1A2F92A1EEB6A70006B0456 /* NSCharacterSet+Stripe.h */; }; F1A2F92E1EEB6A70006B0456 /* NSCharacterSet+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */; }; F1A2F92F1EEB6A70006B0456 /* NSCharacterSet+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */; }; + F1A7A0531FE053CE00B47D4A /* FauxPasAnnotations.h in Headers */ = {isa = PBXBuildFile; fileRef = F10239381FDF4144006273B5 /* FauxPasAnnotations.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F1A7A0541FE053D900B47D4A /* FauxPasAnnotations.h in Headers */ = {isa = PBXBuildFile; fileRef = F10239381FDF4144006273B5 /* FauxPasAnnotations.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F1B8534F1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h in Headers */ = {isa = PBXBuildFile; fileRef = F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */; }; + F1B853501FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */; }; F1B980941DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */; }; F1BA241E1E57BE5E00E4A1CF /* CardSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F1BA241C1E57BE5700E4A1CF /* CardSource.json */; }; F1BA24211E57BECA00E4A1CF /* 3DSSource.json in Resources */ = {isa = PBXBuildFile; fileRef = F1BA241F1E57BEC600E4A1CF /* 3DSSource.json */; }; @@ -1101,6 +1104,7 @@ C1FEE5941CBFF11400A7632B /* STPPostalCodeValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPPostalCodeValidator.h; sourceTree = ""; }; C1FEE5951CBFF11400A7632B /* STPPostalCodeValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPostalCodeValidator.m; sourceTree = ""; }; C1FEE5981CBFF24000A7632B /* STPPostalCodeValidatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPostalCodeValidatorTest.m; sourceTree = ""; }; + F10239381FDF4144006273B5 /* FauxPasAnnotations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FauxPasAnnotations.h; path = PublicHeaders/FauxPasAnnotations.h; sourceTree = ""; }; F1122A7D1DFB84E000A8B1AF /* UINavigationBar+StripeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+StripeTest.m"; sourceTree = ""; }; F12829D81D7747E4008B10D6 /* STPBundleLocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPBundleLocator.h; sourceTree = ""; }; F12829D91D7747E4008B10D6 /* STPBundleLocator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPBundleLocator.m; sourceTree = ""; }; @@ -1159,6 +1163,8 @@ F1A0197A1EA5733200354301 /* STPSourceParams+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPSourceParams+Private.h"; sourceTree = ""; }; F1A2F92A1EEB6A70006B0456 /* NSCharacterSet+Stripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCharacterSet+Stripe.h"; sourceTree = ""; }; F1A2F92B1EEB6A70006B0456 /* NSCharacterSet+Stripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSCharacterSet+Stripe.m"; sourceTree = ""; }; + F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBSnapshotTestCase+STPViewControllerLoading.h"; sourceTree = ""; }; + F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FBSnapshotTestCase+STPViewControllerLoading.m"; sourceTree = ""; }; F1B980931DB550E60075332E /* STPPaymentMethodsViewControllerLocalizationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPPaymentMethodsViewControllerLocalizationTests.m; sourceTree = ""; }; F1BA241C1E57BE5700E4A1CF /* CardSource.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CardSource.json; sourceTree = ""; }; F1BA241F1E57BEC600E4A1CF /* 3DSSource.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = 3DSSource.json; sourceTree = ""; }; @@ -1224,7 +1230,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F116E94B1D83404D0026A52A /* AddressBook.framework in Frameworks */, F15232311EA93E6800D65C67 /* Contacts.framework in Frameworks */, F1D765CE1EDE331500F37005 /* CoreLocation.framework in Frameworks */, F116E94C1D83405E0026A52A /* Foundation.framework in Frameworks */, @@ -1378,6 +1383,8 @@ C18867D71E8B07F600A77634 /* Functional */, C18867D81E8B093300A77634 /* Unit */, C1D23FB71D37FE0F002FD83C /* JSON */, + F1B8534D1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h */, + F1B8534E1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m */, C18867D91E8B0C4100A77634 /* STPFixtures.h */, C18867DA1E8B0C4100A77634 /* STPFixtures.m */, F1D96F981DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h */, @@ -1584,6 +1591,7 @@ isa = PBXGroup; children = ( 04CDB4A91A5F30A700B854EE /* Stripe.h */, + F10239381FDF4144006273B5 /* FauxPasAnnotations.h */, F1728CED1EAAA2D9002E0C29 /* API Bindings */, F1728CEB1EAAA267002E0C29 /* Categories */, F1728CEE1EAAA2EA002E0C29 /* Helpers */, @@ -1969,6 +1977,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + F1B8534F1FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.h in Headers */, F1D96F9A1DC7DCDE00477E64 /* STPLocalizationUtils+STPTestAdditions.h in Headers */, F148ABFA1D5E88C40014FD92 /* STPTestUtils.h in Headers */, C1CFCB6D1ED5E0F800BE45DF /* STPMocks.h in Headers */, @@ -2092,6 +2101,7 @@ 04F94DA31D229F18004FC826 /* STPAddressViewModel.h in Headers */, 0438EF3A1B7416BB00D506CC /* STPPaymentCardTextFieldViewModel.h in Headers */, 04B31DF31D09F0A800EF1631 /* UIViewController+Stripe_NavigationItemProxy.h in Headers */, + F1A7A0541FE053D900B47D4A /* FauxPasAnnotations.h in Headers */, 8B429ADF1EF9EFFA00F95F34 /* STPFile+Private.h in Headers */, 0426B9771CEBD001006AC8DD /* UINavigationBar+Stripe_Theme.h in Headers */, 04CDE5BE1BC1F21500548833 /* STPCardParams.h in Headers */, @@ -2194,6 +2204,7 @@ 04E39F541CECF7A100AF3B96 /* STPPaymentMethodTuple.h in Headers */, F15232241EA9303800D65C67 /* STPURLCallbackHandler.h in Headers */, C18410761EC2529400178149 /* STPEphemeralKeyManager.h in Headers */, + F1A7A0531FE053CE00B47D4A /* FauxPasAnnotations.h in Headers */, 04F416261CA3639500486FB5 /* STPAddCardViewController.h in Headers */, 049880FC1CED5A2300EA4FFD /* STPPaymentConfiguration.h in Headers */, F1852F931D80B6EC00367C86 /* STPStringUtils.h in Headers */, @@ -2331,7 +2342,7 @@ CLASSPREFIX = STP; LastSwiftUpdateCheck = 0730; LastTestingUpgradeCheck = 0510; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Stripe, Inc"; TargetAttributes = { 045E7C021A5F41DE004751EF = { @@ -2655,6 +2666,7 @@ 8BD87B901EFB17AA00269C2B /* STPSourceRedirectTest.m in Sources */, 04415C6A1A6605B5001225ED /* STPApplePayFunctionalTest.m in Sources */, 8BE5AE8B1EF8905B0081A33C /* STPCardParamsTest.m in Sources */, + F1B853501FDF544B0065A49E /* FBSnapshotTestCase+STPViewControllerLoading.m in Sources */, F1D3A25F1EB015B30095BFA9 /* UIImage+StripeTests.m in Sources */, 04415C6B1A6605B5001225ED /* STPBankAccountFunctionalTest.m in Sources */, 8B6DC9751F0171D20025E811 /* STPSourceReceiverTest.m in Sources */, diff --git a/Stripe.xcodeproj/xcshareddata/xcschemes/StripeiOS.xcscheme b/Stripe.xcodeproj/xcshareddata/xcschemes/StripeiOS.xcscheme index 36a19d918d0..69190fc173e 100644 --- a/Stripe.xcodeproj/xcshareddata/xcschemes/StripeiOS.xcscheme +++ b/Stripe.xcodeproj/xcshareddata/xcschemes/StripeiOS.xcscheme @@ -1,6 +1,6 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 11.5.0 + 12.0.0 CFBundleSignature ???? CFBundleVersion - 11.5.0 + 12.0.0 NSPrincipalClass diff --git a/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.h b/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.h index 9b0df0c206a..ee5a8e6d061 100644 --- a/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.h +++ b/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.h @@ -11,8 +11,6 @@ #import "STPAPIClient.h" #import "STPPaymentContext.h" -#define FAUXPAS_IGNORED_IN_FILE(...) -FAUXPAS_IGNORED_IN_FILE(APIAvailability) NS_ASSUME_NONNULL_BEGIN diff --git a/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.m b/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.m index 2e937ba2efc..b6ef2b74412 100644 --- a/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.m +++ b/Stripe/PKPaymentAuthorizationViewController+Stripe_Blocks.m @@ -11,7 +11,6 @@ #import "PKPaymentAuthorizationViewController+Stripe_Blocks.h" #import "STPAPIClient+ApplePay.h" -FAUXPAS_IGNORED_IN_FILE(APIAvailability) static char kSTPBlockBasedApplePayDelegateAssociatedObjectKey; @@ -76,23 +75,6 @@ - (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewC }); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -- (void)paymentAuthorizationViewController:(__unused PKPaymentAuthorizationViewController *)controller - didSelectShippingAddress:(ABRecordRef)address - completion:(STPApplePayShippingAddressCompletionBlock)completion { - STPAddress *stpAddress = [[STPAddress alloc] initWithABRecord:address]; - self.onShippingAddressSelection(stpAddress, ^(STPShippingStatus status, NSArray* shippingMethods, NSArray *summaryItems) { - if (status == STPShippingStatusInvalid) { - completion(PKPaymentAuthorizationStatusInvalidShippingPostalAddress, shippingMethods, summaryItems); - } - else { - completion(PKPaymentAuthorizationStatusSuccess, shippingMethods, summaryItems); - } - }); -} -#pragma clang diagnostic pop - - (void)paymentAuthorizationViewControllerDidFinish:(__unused PKPaymentAuthorizationViewController *)controller { if (self.didSucceed) { self.onFinish(STPPaymentStatusSuccess, nil); diff --git a/Stripe/PublicHeaders/FauxPasAnnotations.h b/Stripe/PublicHeaders/FauxPasAnnotations.h new file mode 100644 index 00000000000..2d18c9af752 --- /dev/null +++ b/Stripe/PublicHeaders/FauxPasAnnotations.h @@ -0,0 +1,40 @@ +// +// FauxPasAnnotations.h +// --- +// +// This file defines macros that can be used to suppress +// specific Faux Pas diagnostics within desired units of +// code. +// +// The arguments to the macros should be the short names of +// the rules whose diagnostics should be suppressed. The +// suppression macros should be present _inside_ whichever +// code entity they refer to. For example, if you wish +// to suppress diagnostics from the `NSLogUsed` and +// `DotSyntax` rules within an Objective-C method, you +// would do this: +// +// - (void) myMethod { +// FAUXPAS_IGNORED_IN_METHOD(NSLogUsed, DotSyntax) +// +// NSLog(@"Hello world from %@", self.class); +// } +// +// The FAUXPAS_IGNORED() macro refers to the innermost +// code entity it is contained in (an Obj-C method, a C +// function, or an Obj-C class). This macro cannot be used +// to suppress diagnostics within the whole file. For that, +// use the more explicit FAUXPAS_IGNORED_IN_FILE() macro. +// +// --- +// http://fauxpasapp.com +// + +#pragma once + +#define FAUXPAS_IGNORED(...) +#define FAUXPAS_IGNORED_IN_FILE(...) +#define FAUXPAS_IGNORED_IN_METHOD(...) +#define FAUXPAS_IGNORED_IN_FUNCTION(...) +#define FAUXPAS_IGNORED_IN_CLASS(...) +#define FAUXPAS_IGNORED_ON_LINE(...) diff --git a/Stripe/PublicHeaders/STPAPIClient+ApplePay.h b/Stripe/PublicHeaders/STPAPIClient+ApplePay.h index 485f39e9c39..f1704eb0ed0 100644 --- a/Stripe/PublicHeaders/STPAPIClient+ApplePay.h +++ b/Stripe/PublicHeaders/STPAPIClient+ApplePay.h @@ -10,9 +10,6 @@ #import "STPAPIClient.h" -#define FAUXPAS_IGNORED_IN_FILE(...) -FAUXPAS_IGNORED_IN_FILE(APIAvailability) - /** STPAPIClient extensions to create Stripe tokens from Apple Pay PKPayment objects. */ diff --git a/Stripe/PublicHeaders/STPAPIClient.h b/Stripe/PublicHeaders/STPAPIClient.h index 5ac4996dcbd..18f1ce92155 100644 --- a/Stripe/PublicHeaders/STPAPIClient.h +++ b/Stripe/PublicHeaders/STPAPIClient.h @@ -8,15 +8,13 @@ #import #import + +#import "FauxPasAnnotations.h" #import "STPBlocks.h" #import "STPFile.h" NS_ASSUME_NONNULL_BEGIN -#define FAUXPAS_IGNORED_ON_LINE(...) -#define FAUXPAS_IGNORED_IN_FILE(...) -FAUXPAS_IGNORED_IN_FILE(APIAvailability) - /** The current version of this library. */ @@ -240,7 +238,7 @@ static NSString *const STPSDKVersion = @"11.5.0"; */ + (PKPaymentRequest *)paymentRequestWithMerchantIdentifier:(NSString *)merchantIdentifier country:(NSString *)countryCode - currency:(NSString *)currencyCode NS_AVAILABLE_IOS(8_0); + currency:(NSString *)currencyCode; @end diff --git a/Stripe/PublicHeaders/STPAddress.h b/Stripe/PublicHeaders/STPAddress.h index 0e720efb473..0b45414f4eb 100644 --- a/Stripe/PublicHeaders/STPAddress.h +++ b/Stripe/PublicHeaders/STPAddress.h @@ -6,17 +6,8 @@ // Copyright © 2016 Stripe, Inc. All rights reserved. // -#define FAUXPAS_IGNORED_IN_METHOD(...) -#define FAUXPAS_IGNORED_ON_LINE(...) - #import #import - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -#import -#pragma clang diagnostic pop - #import "STPAPIResponseDecodable.h" @class CNContact; @@ -108,41 +99,20 @@ typedef NS_ENUM(NSUInteger, STPBillingAddressFields) { + (nullable NSDictionary *)shippingInfoForChargeWithAddress:(nullable STPAddress *)address shippingMethod:(nullable PKShippingMethod *)method; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - -/** - Initializes a new STPAddress with data from an Address Book record. - - @param record The Address Book record you want to populate the STPAddress from. - @return A new STPAddress instance with data copied from the passed in record. - */ -- (instancetype)initWithABRecord:(ABRecordRef)record; - - -/** - Generates an Address Book record representation of this STPAddress. - - @return A new autoreleased Address Book record with data copied from this - STPAddress instance. - */ -- (ABRecordRef)ABRecordValue; -#pragma clang diagnostic pop - /** Initializes a new STPAddress with data from an PassKit contact. @param contact The PassKit contact you want to populate the STPAddress from. @return A new STPAddress instance with data copied from the passed in contact. */ -- (instancetype)initWithPKContact:(PKContact *)contact NS_AVAILABLE_IOS(9_0); FAUXPAS_IGNORED_ON_LINE(APIAvailability); +- (instancetype)initWithPKContact:(PKContact *)contact; /** Generates a PassKit contact representation of this STPAddress. @return A new PassKit contact with data copied from this STPAddress instance. */ -- (PKContact *)PKContactValue NS_AVAILABLE_IOS(9_0); FAUXPAS_IGNORED_ON_LINE(APIAvailability); +- (PKContact *)PKContactValue; /** Initializes a new STPAddress with a contact from the Contacts framework. @@ -151,7 +121,7 @@ typedef NS_ENUM(NSUInteger, STPBillingAddressFields) { @return A new STPAddress instance with data copied from the passed in contact. */ -- (instancetype)initWithCNContact:(CNContact *)contact NS_AVAILABLE_IOS(9_0); FAUXPAS_IGNORED_ON_LINE(APIAvailability); +- (instancetype)initWithCNContact:(CNContact *)contact; /** diff --git a/Stripe/PublicHeaders/STPRedirectContext.h b/Stripe/PublicHeaders/STPRedirectContext.h index e4f7dd0e367..5510a628c60 100644 --- a/Stripe/PublicHeaders/STPRedirectContext.h +++ b/Stripe/PublicHeaders/STPRedirectContext.h @@ -156,7 +156,7 @@ NS_EXTENSION_UNAVAILABLE("Redirect based sources are not available in extensions @param presentingViewController The view controller to present the Safari view controller from. */ -- (void)startSafariViewControllerRedirectFlowFromViewController:(UIViewController *)presentingViewController NS_AVAILABLE_IOS(9_0); +- (void)startSafariViewControllerRedirectFlowFromViewController:(UIViewController *)presentingViewController; /** Starts a redirect flow by calling `openURL` to bounce the user out to diff --git a/Stripe/PublicHeaders/Stripe.h b/Stripe/PublicHeaders/Stripe.h index 40a852736ca..df39ac3ff72 100644 --- a/Stripe/PublicHeaders/Stripe.h +++ b/Stripe/PublicHeaders/Stripe.h @@ -6,6 +6,7 @@ // Copyright (c) 2012 Stripe. All rights reserved. // +#import "FauxPasAnnotations.h" #import "STPAddCardViewController.h" #import "STPAddress.h" #import "STPAPIClient+ApplePay.h" diff --git a/Stripe/STPAPIClient+ApplePay.m b/Stripe/STPAPIClient+ApplePay.m index 0640ab234ae..502946b5f20 100644 --- a/Stripe/STPAPIClient+ApplePay.m +++ b/Stripe/STPAPIClient+ApplePay.m @@ -5,19 +5,16 @@ // Created by Jack Flintermann on 12/19/14. // -#import +#import "STPAPIClient+ApplePay.h" #import "NSError+Stripe.h" #import "PKPayment+Stripe.h" -#import "STPAPIClient+ApplePay.h" #import "STPAPIClient+Private.h" #import "STPAnalyticsClient.h" #import "STPSourceParams.h" #import "STPTelemetryClient.h" #import "STPToken.h" -FAUXPAS_IGNORED_IN_FILE(APIAvailability) - @implementation STPAPIClient (ApplePay) - (void)createTokenWithPayment:(PKPayment *)payment completion:(STPTokenCompletionBlock)completion { @@ -45,55 +42,6 @@ - (void)createSourceWithPayment:(PKPayment *)payment completion:(STPSourceComple }]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -+ (NSDictionary *)addressParamsFromABRecord:(ABRecordRef)billingAddress { - if (billingAddress) { - NSMutableDictionary *params = [NSMutableDictionary dictionary]; - - NSString *firstName = (__bridge_transfer NSString*)ABRecordCopyValue(billingAddress, kABPersonFirstNameProperty); - NSString *lastName = (__bridge_transfer NSString*)ABRecordCopyValue(billingAddress, kABPersonLastNameProperty); - if (firstName.length && lastName.length) { - params[@"name"] = [NSString stringWithFormat:@"%@ %@", firstName, lastName]; - } - - ABMultiValueRef addressValues = ABRecordCopyValue(billingAddress, kABPersonAddressProperty); - if (addressValues != NULL) { - if (ABMultiValueGetCount(addressValues) > 0) { - CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressValues, 0); - NSString *line1 = CFDictionaryGetValue(dict, kABPersonAddressStreetKey); - if (line1) { - params[@"address_line1"] = line1; - } - NSString *city = CFDictionaryGetValue(dict, kABPersonAddressCityKey); - if (city) { - params[@"address_city"] = city; - } - NSString *state = CFDictionaryGetValue(dict, kABPersonAddressStateKey); - if (state) { - params[@"address_state"] = state; - } - NSString *zip = CFDictionaryGetValue(dict, kABPersonAddressZIPKey); - if (zip) { - params[@"address_zip"] = zip; - } - NSString *country = CFDictionaryGetValue(dict, kABPersonAddressCountryKey); - if (country) { - params[@"address_country"] = country; - } - CFRelease(dict); - } - CFRelease(addressValues); - } - return params; - } - else { - return nil; - } - -} -#pragma clang diagnostic pop - + (NSDictionary *)addressParamsFromPKContact:(PKContact *)billingContact { if (billingContact) { NSMutableDictionary *params = [NSMutableDictionary dictionary]; @@ -127,21 +75,14 @@ + (NSDictionary *)parametersForPayment:(PKPayment *)payment { [[NSString alloc] initWithData:payment.token.paymentData encoding:NSUTF8StringEncoding]; NSMutableDictionary *payload = [NSMutableDictionary new]; payload[@"pk_token"] = paymentString; + payload[@"card"] = [self addressParamsFromPKContact:payment.billingContact]; - if ([PKContact class] - && [payment respondsToSelector:@selector(billingContact)]) { - payload[@"card"] = [self addressParamsFromPKContact:payment.billingContact]; - } - else { - payload[@"card"] = [self addressParamsFromABRecord:payment.billingAddress]; - } - - NSString *paymentInstrumentName = payment.token.paymentInstrumentName; + NSString *paymentInstrumentName = payment.token.paymentMethod.displayName; if (paymentInstrumentName) { payload[@"pk_token_instrument_name"] = paymentInstrumentName; } - NSString *paymentNetwork = payment.token.paymentNetwork; + NSString *paymentNetwork = payment.token.paymentMethod.network; if (paymentNetwork) { payload[@"pk_token_payment_network"] = paymentNetwork; } diff --git a/Stripe/STPAPIClient.m b/Stripe/STPAPIClient.m index 6fe75070786..e85052f7e47 100644 --- a/Stripe/STPAPIClient.m +++ b/Stripe/STPAPIClient.m @@ -43,9 +43,6 @@ #import "STPCategoryLoader.h" #endif -#define FAUXPAS_IGNORED_IN_METHOD(...) -FAUXPAS_IGNORED_IN_FILE(APIAvailability) - static NSString * const APIVersion = @"2015-10-12"; static NSString * const APIBaseURL = @"https://api.stripe.com/v1"; static NSString * const APIEndpointToken = @"tokens"; @@ -222,11 +219,10 @@ + (NSString *)stripeUserAgentDetails { if (model) { details[@"model"] = model; } - if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { - NSString *vendorIdentifier = [[[UIDevice currentDevice] performSelector:@selector(identifierForVendor)] performSelector:@selector(UUIDString)]; - if (vendorIdentifier) { - details[@"vendor_identifier"] = vendorIdentifier; - } + + NSString *vendorIdentifier = [UIDevice currentDevice].identifierForVendor.UUIDString; + if (vendorIdentifier) { + details[@"vendor_identifier"] = vendorIdentifier; } return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:[details copy] options:(NSJSONWritingOptions)kNilOptions error:NULL] encoding:NSUTF8StringEncoding]; } diff --git a/Stripe/STPAddress.m b/Stripe/STPAddress.m index b8067716960..d7b10737de5 100644 --- a/Stripe/STPAddress.m +++ b/Stripe/STPAddress.m @@ -6,18 +6,16 @@ // Copyright © 2016 Stripe, Inc. All rights reserved. // -#import "NSDictionary+Stripe.h" #import "STPAddress.h" + +#import + +#import "NSDictionary+Stripe.h" #import "STPCardValidator.h" #import "STPEmailAddressValidator.h" #import "STPPhoneNumberValidator.h" #import "STPPostalCodeValidator.h" -#import - -#define FAUXPAS_IGNORED_IN_FILE(...) -FAUXPAS_IGNORED_IN_FILE(APIAvailability) - NSString *stringIfHasContentsElseNil(NSString *string); @interface STPAddress () @@ -49,108 +47,6 @@ + (NSDictionary *)shippingInfoForChargeWithAddress:(nullable STPAddress *)addres return [params copy]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - -- (instancetype)initWithABRecord:(ABRecordRef)record { - self = [super init]; - if (self) { - NSString *firstName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonFirstNameProperty); - NSString *lastName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonLastNameProperty); - NSString *first = firstName ?: @""; - NSString *last = lastName ?: @""; - NSString *name = [@[first, last] componentsJoinedByString:@" "]; - _name = [name stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - - ABMultiValueRef emailValues = ABRecordCopyValue(record, kABPersonEmailProperty); - _email = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(emailValues, 0)); - if (emailValues != NULL) { - CFRelease(emailValues); - } - - ABMultiValueRef phoneValues = ABRecordCopyValue(record, kABPersonPhoneProperty); - NSString *phone = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(phoneValues, 0)); - if (phoneValues != NULL) { - CFRelease(phoneValues); - } - phone = [STPCardValidator sanitizedNumericStringForString:phone]; - if ([phone length] > 0) { - _phone = phone; - } - - ABMultiValueRef addressValues = ABRecordCopyValue(record, kABPersonAddressProperty); - if (addressValues != NULL) { - if (ABMultiValueGetCount(addressValues) > 0) { - CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressValues, 0); - NSString *street = CFDictionaryGetValue(dict, kABPersonAddressStreetKey); - if (street.length > 0) { - _line1 = street; - } - NSString *city = CFDictionaryGetValue(dict, kABPersonAddressCityKey); - if (city.length > 0) { - _city = city; - } - NSString *state = CFDictionaryGetValue(dict, kABPersonAddressStateKey); - if (state.length > 0) { - _state = state; - } - NSString *zip = CFDictionaryGetValue(dict, kABPersonAddressZIPKey); - if (zip.length > 0) { - _postalCode = zip; - } - NSString *country = CFDictionaryGetValue(dict, kABPersonAddressCountryCodeKey); - if (country.length > 0) { - _country = [country uppercaseString]; - } - if (dict != NULL) { - CFRelease(dict); - } - } - CFRelease(addressValues); - } - } - return self; -} - -- (ABRecordRef)ABRecordValue { - ABRecordRef record = ABPersonCreate(); - if ([self firstName] != nil) { - CFStringRef firstNameRef = (__bridge CFStringRef)[self firstName]; - ABRecordSetValue(record, kABPersonFirstNameProperty, firstNameRef, nil); - } - if ([self lastName] != nil) { - CFStringRef lastNameRef = (__bridge CFStringRef)[self lastName]; - ABRecordSetValue(record, kABPersonLastNameProperty, lastNameRef, nil); - } - if (self.phone != nil) { - ABMutableMultiValueRef phonesRef = ABMultiValueCreateMutable(kABMultiStringPropertyType); - ABMultiValueAddValueAndLabel(phonesRef, (__bridge CFStringRef)self.phone, - kABPersonPhoneMainLabel, NULL); - ABRecordSetValue(record, kABPersonPhoneProperty, phonesRef, nil); - CFRelease(phonesRef); - } - if (self.email != nil) { - ABMutableMultiValueRef emailsRef = ABMultiValueCreateMutable(kABMultiStringPropertyType); - ABMultiValueAddValueAndLabel(emailsRef, (__bridge CFStringRef)self.email, - kABHomeLabel, NULL); - ABRecordSetValue(record, kABPersonEmailProperty, emailsRef, nil); - CFRelease(emailsRef); - } - ABMutableMultiValueRef addressRef = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType); - NSMutableDictionary *addressDict = [NSMutableDictionary dictionary]; - addressDict[(NSString *)kABPersonAddressStreetKey] = [self street]; - addressDict[(NSString *)kABPersonAddressCityKey] = self.city; - addressDict[(NSString *)kABPersonAddressStateKey] = self.state; - addressDict[(NSString *)kABPersonAddressZIPKey] = self.postalCode; - addressDict[(NSString *)kABPersonAddressCountryCodeKey] = self.country; - ABMultiValueAddValueAndLabel(addressRef, (__bridge CFTypeRef)[addressDict copy], kABWorkLabel, NULL); - ABRecordSetValue(record, kABPersonAddressProperty, addressRef, nil); - CFRelease(addressRef); - return CFAutorelease(record); -} - -#pragma clang diagnostic pop - - (NSString *)sanitizedPhoneStringFromCNPhoneNumber:(CNPhoneNumber *)phoneNumber { NSString *phone = phoneNumber.stringValue; if (phone) { @@ -337,7 +233,6 @@ - (BOOL)hasPartialPostalAddress { } + (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); switch (billingAddressFields) { case STPBillingAddressFieldsNone: return PKAddressFieldNone; diff --git a/Stripe/STPAddressViewModel.m b/Stripe/STPAddressViewModel.m index 6735d447702..c5bfd02a0c4 100644 --- a/Stripe/STPAddressViewModel.m +++ b/Stripe/STPAddressViewModel.m @@ -12,7 +12,6 @@ #import "STPDispatchFunctions.h" #import "STPPostalCodeValidator.h" -#import #import @interface STPAddressViewModel() @@ -207,31 +206,36 @@ - (void)updateCityAndStateFromZipCodeCell:(STPAddressFieldTableViewCell *)zipCel return; } else { - + self.geocodeInProgress = YES; CLGeocoder *geocoder = [CLGeocoder new]; - NSString *zipKey = (NSString *) kABPersonAddressZIPKey; - NSString *countryCodeKey = (NSString *) kABPersonAddressCountryCodeKey; - - if (zipKey && countryCodeKey) { - self.geocodeInProgress = YES; - [geocoder geocodeAddressDictionary:@{zipKey : zipCode, - countryCodeKey : _addressFieldTableViewCountryCode} - completionHandler:^(NSArray * _Nullable placemarks, NSError * _Nullable error) { - stpDispatchToMainThreadIfNecessary(^{ - if (placemarks.count > 0 && error == nil) { - CLPlacemark *placemark = placemarks.firstObject; - if (cityCell.contents.length == 0 - && stateCell.contents.length == 0 - && [zipCell.contents isEqualToString:zipCode]) { - // Check contents again to make sure they're still empty - // And that zipcode hasn't changed to something else - cityCell.contents = placemark.locality; - stateCell.contents = placemark.administrativeArea; - } - } - self.geocodeInProgress = NO; - }); - }]; + + CLGeocodeCompletionHandler onCompletion = ^(NSArray * _Nullable placemarks, NSError * _Nullable error) { + stpDispatchToMainThreadIfNecessary(^{ + if (placemarks.count > 0 && error == nil) { + CLPlacemark *placemark = placemarks.firstObject; + if (cityCell.contents.length == 0 + && stateCell.contents.length == 0 + && [zipCell.contents isEqualToString:zipCode]) { + // Check contents again to make sure they're still empty + // And that zipcode hasn't changed to something else + cityCell.contents = placemark.locality; + stateCell.contents = placemark.administrativeArea; + } + } + self.geocodeInProgress = NO; + }); + }; + + 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]; } } } @@ -270,7 +274,7 @@ - (void)setAddressFieldTableViewCountryCode:(NSString *)addressFieldTableViewCou - (void)setAddress:(STPAddress *)address { self.addressFieldTableViewCountryCode = address.country; - + for (STPAddressFieldTableViewCell *cell in self.addressCells) { switch (cell.type) { case STPAddressFieldTypeName: @@ -307,7 +311,7 @@ - (void)setAddress:(STPAddress *)address { - (STPAddress *)address { STPAddress *address = [STPAddress new]; for (STPAddressFieldTableViewCell *cell in self.addressCells) { - + switch (cell.type) { case STPAddressFieldTypeName: address.name = cell.contents; diff --git a/Stripe/STPBankAccountParams.m b/Stripe/STPBankAccountParams.m index 37dc40b9521..b85818b2b86 100644 --- a/Stripe/STPBankAccountParams.m +++ b/Stripe/STPBankAccountParams.m @@ -9,7 +9,7 @@ #import "STPBankAccountParams.h" #import "STPBankAccountParams+Private.h" -#define FAUXPAS_IGNORED_ON_LINE(...) +#import "FauxPasAnnotations.h" @interface STPBankAccountParams () diff --git a/Stripe/STPCardIOProxy.m b/Stripe/STPCardIOProxy.m index d095bdde456..9c327b619d1 100644 --- a/Stripe/STPCardIOProxy.m +++ b/Stripe/STPCardIOProxy.m @@ -7,6 +7,8 @@ // #import "STPCardIOProxy.h" + +#import "FauxPasAnnotations.h" #import "STPCardParams.h" #import "STPAnalyticsClient.h" diff --git a/Stripe/STPCoreScrollViewController.m b/Stripe/STPCoreScrollViewController.m index 52b21083c13..735b7caf0fb 100644 --- a/Stripe/STPCoreScrollViewController.m +++ b/Stripe/STPCoreScrollViewController.m @@ -28,6 +28,14 @@ - (void)createAndSetupViews { [self.view addSubview:self.scrollView]; } +- (void)viewDidLoad { + [super viewDidLoad]; + + if (@available(iOS 11, *)) { + self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; + } +} + - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; self.scrollView.frame = self.view.bounds; @@ -46,21 +54,4 @@ - (void)updateAppearance { } } -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - if (self.navigationController.navigationBar.translucent) { - CGFloat insetTop = CGRectGetMaxY(self.navigationController.navigationBar.frame); - self.scrollView.contentInset = UIEdgeInsetsMake(insetTop, 0, 0, 0); - self.scrollView.scrollIndicatorInsets = self.scrollView.contentInset; - } else { - self.scrollView.contentInset = UIEdgeInsetsZero; - self.scrollView.scrollIndicatorInsets = UIEdgeInsetsZero; - } - CGPoint offset = self.scrollView.contentOffset; - offset.y = -self.scrollView.contentInset.top; - self.scrollView.contentOffset = offset; - -} - @end diff --git a/Stripe/STPCoreTableViewController.m b/Stripe/STPCoreTableViewController.m index b7026ecefb6..08a002211eb 100644 --- a/Stripe/STPCoreTableViewController.m +++ b/Stripe/STPCoreTableViewController.m @@ -9,7 +9,7 @@ #import "STPCoreTableViewController.h" #import "STPCoreTableViewController+Private.h" -#define FAUXPAS_IGNORED_IN_METHOD(...) +#import "FauxPasAnnotations.h" // Note: // The private class extension for this class is in diff --git a/Stripe/STPCoreViewController+Private.h b/Stripe/STPCoreViewController+Private.h index b18a8f19bb7..9f0c6ee690a 100644 --- a/Stripe/STPCoreViewController+Private.h +++ b/Stripe/STPCoreViewController+Private.h @@ -8,6 +8,8 @@ #import "STPCoreViewController.h" +#import "FauxPasAnnotations.h" + NS_ASSUME_NONNULL_BEGIN /** @@ -66,7 +68,7 @@ NS_ASSUME_NONNULL_BEGIN // These methods have significant code done in the base class and super must // be called if they are overidden -- (void)viewDidLoad NS_REQUIRES_SUPER; +- (void)viewDidLoad NS_REQUIRES_SUPER; FAUXPAS_IGNORED_ON_LINE(UnusedMethod) - (void)viewWillAppear:(BOOL)animated NS_REQUIRES_SUPER; - (void)viewWillDisappear:(BOOL)animated NS_REQUIRES_SUPER; @end diff --git a/Stripe/STPCoreViewController.m b/Stripe/STPCoreViewController.m index 315c101d9ef..fae37e803a9 100644 --- a/Stripe/STPCoreViewController.m +++ b/Stripe/STPCoreViewController.m @@ -74,7 +74,9 @@ - (void)createAndSetupViews { - (void)viewDidLoad { [super viewDidLoad]; - self.automaticallyAdjustsScrollViewInsets = NO; + + self.automaticallyAdjustsScrollViewInsets = YES; + [self createAndSetupViews]; [self updateAppearance]; } diff --git a/Stripe/STPFormTextField.m b/Stripe/STPFormTextField.m index 23b61259ec3..ee950b2888e 100644 --- a/Stripe/STPFormTextField.m +++ b/Stripe/STPFormTextField.m @@ -14,9 +14,6 @@ #import "STPPhoneNumberValidator.h" #import "STPWeakStrongMacros.h" -#define FAUXPAS_IGNORED_IN_METHOD(...) -#define FAUXPAS_IGNORED_ON_LINE(...) - @interface STPTextFieldDelegateProxy : STPDelegateProxy @property (nonatomic, assign) STPFormTextFieldAutoFormattingBehavior autoformattingBehavior; @property (nonatomic, assign) BOOL selectionEnabled; @@ -110,11 +107,9 @@ - (void)setAutoFormattingBehavior:(STPFormTextFieldAutoFormattingBehavior)autoFo case STPFormTextFieldAutoFormattingBehaviorNone: case STPFormTextFieldAutoFormattingBehaviorExpiration: self.textFormattingBlock = nil; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - if ([self respondsToSelector:@selector(setTextContentType:)]) { - self.textContentType = nil; FAUXPAS_IGNORED_ON_LINE(APIAvailability); + if (@available(iOS 10, *)) { + self.textContentType = nil; } -#endif break; case STPFormTextFieldAutoFormattingBehaviorCardNumbers: self.textFormattingBlock = ^NSAttributedString *(NSAttributedString *inputString) { @@ -140,11 +135,9 @@ - (void)setAutoFormattingBehavior:(STPFormTextFieldAutoFormattingBehavior)autoFo } return [attributedString copy]; }; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - if ([self respondsToSelector:@selector(setTextContentType:)]) { - self.textContentType = UITextContentTypeCreditCardNumber; FAUXPAS_IGNORED_ON_LINE(APIAvailability); + if (@available(iOS 10, *)) { + self.textContentType = UITextContentTypeCreditCardNumber; } -#endif break; case STPFormTextFieldAutoFormattingBehaviorPhoneNumbers: { WEAK(self); @@ -157,11 +150,9 @@ - (void)setAutoFormattingBehavior:(STPFormTextFieldAutoFormattingBehavior)autoFo NSDictionary *attributes = [[self class] attributesForAttributedString:inputString]; return [[NSAttributedString alloc] initWithString:phoneNumber attributes:attributes]; }; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - if ([self respondsToSelector:@selector(setTextContentType:)]) { - self.textContentType = UITextContentTypeTelephoneNumber; FAUXPAS_IGNORED_ON_LINE(APIAvailability); + if (@available(iOS 10, *)) { + self.textContentType = UITextContentTypeTelephoneNumber; } -#endif break; } } @@ -269,7 +260,6 @@ - (CGRect)editingRectForBounds:(CGRect)bounds { // Fixes a weird issue related to our custom override of deleteBackwards. This only affects the simulator and iPads with custom keyboards. - (NSArray *)keyCommands { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); return @[[UIKeyCommand keyCommandWithInput:@"\b" modifierFlags:UIKeyModifierCommand action:@selector(commandDeleteBackwards)]]; } diff --git a/Stripe/STPImageLibrary.m b/Stripe/STPImageLibrary.m index 2929957f3db..13acd631469 100644 --- a/Stripe/STPImageLibrary.m +++ b/Stripe/STPImageLibrary.m @@ -11,11 +11,8 @@ #import "STPBundleLocator.h" #import "STPImageLibrary+Private.h" -#define FAUXPAS_IGNORED_IN_METHOD(...) - // Dummy class for locating the framework bundle - @implementation STPImageLibrary + (UIImage *)applePayCardImage { @@ -98,11 +95,9 @@ + (UIImage *)largeShippingImage { + (UIImage *)safeImageNamed:(NSString *)imageName templateIfAvailable:(BOOL)templateIfAvailable { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); - UIImage *image = nil; - if ([UIImage respondsToSelector:@selector(imageNamed:inBundle:compatibleWithTraitCollection:)]) { - image = [UIImage imageNamed:imageName inBundle:[STPBundleLocator stripeResourcesBundle] compatibleWithTraitCollection:nil]; - } + + UIImage *image = [UIImage imageNamed:imageName inBundle:[STPBundleLocator stripeResourcesBundle] compatibleWithTraitCollection:nil]; + if (image == nil) { image = [UIImage imageNamed:imageName]; } @@ -115,7 +110,6 @@ + (UIImage *)safeImageNamed:(NSString *)imageName + (UIImage *)brandImageForCardBrand:(STPCardBrand)brand template:(BOOL)isTemplate { BOOL shouldUseTemplate = isTemplate; - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); NSString *imageName; switch (brand) { case STPCardBrandAmex: diff --git a/Stripe/STPPaymentCardTextField.m b/Stripe/STPPaymentCardTextField.m index 74559c4cbf1..f65c4f2e8c5 100644 --- a/Stripe/STPPaymentCardTextField.m +++ b/Stripe/STPPaymentCardTextField.m @@ -19,8 +19,6 @@ #import "Stripe.h" #import "STPLocalizationUtils.h" -#define FAUXPAS_IGNORED_IN_METHOD(...) - @interface STPPaymentCardTextField() @property (nonatomic, readwrite, weak) UIImageView *brandImageView; @@ -141,9 +139,7 @@ - (void)commonInit { UIImageView *brandImageView = [[UIImageView alloc] initWithImage:self.brandImage]; brandImageView.contentMode = UIViewContentModeCenter; brandImageView.backgroundColor = [UIColor clearColor]; - if ([brandImageView respondsToSelector:@selector(setTintColor:)]) { - brandImageView.tintColor = self.placeholderColor; - } + brandImageView.tintColor = self.placeholderColor; self.brandImageView = brandImageView; STPFormTextField *numberField = [self buildTextField]; @@ -287,10 +283,7 @@ - (UIColor *)textErrorColor { - (void)setPlaceholderColor:(UIColor *)placeholderColor { _placeholderColor = [placeholderColor copy]; - - if ([self.brandImageView respondsToSelector:@selector(setTintColor:)]) { - self.brandImageView.tintColor = placeholderColor; - } + self.brandImageView.tintColor = placeholderColor; for (STPFormTextField *field in [self allFields]) { field.placeholderColor = _placeholderColor; diff --git a/Stripe/STPPaymentCardTextFieldViewModel.m b/Stripe/STPPaymentCardTextFieldViewModel.m index 61aa5bb9268..2e597540816 100644 --- a/Stripe/STPPaymentCardTextFieldViewModel.m +++ b/Stripe/STPPaymentCardTextFieldViewModel.m @@ -11,8 +11,6 @@ #import "NSString+Stripe.h" #import "STPPostalCodeValidator.h" -#define FAUXPAS_IGNORED_IN_METHOD(...) - @implementation STPPaymentCardTextFieldViewModel - (void)setCardNumber:(NSString *)cardNumber { diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index 89781acef79..e73c19402ba 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -25,9 +25,6 @@ #import "UIViewController+Stripe_ParentViewController.h" #import "UIViewController+Stripe_Promises.h" -#define FAUXPAS_IGNORED_IN_METHOD(...) - - /** The current state of the payment context @@ -239,12 +236,10 @@ - (NSInteger)paymentAmount { } - (void)setPaymentSummaryItems:(NSArray *)paymentSummaryItems { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability) self.paymentAmountModel = [[STPPaymentContextAmountModel alloc] initWithPaymentSummaryItems:paymentSummaryItems]; } - (NSArray *)paymentSummaryItems { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability) return [self.paymentAmountModel paymentSummaryItemsWithCurrency:self.paymentCurrency companyName:self.configuration.companyName shippingMethod:self.selectedShippingMethod]; @@ -516,7 +511,6 @@ - (BOOL)requestPaymentShouldPresentShippingViewController { } - (void)requestPayment { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); WEAK(self); [[[self.didAppearPromise voidFlatMap:^STPPromise * _Nonnull{ STRONG(self); @@ -572,7 +566,7 @@ - (void)requestPayment { }; STPPaymentAuthorizationBlock paymentHandler = ^(PKPayment *payment) { self.selectedShippingMethod = payment.shippingMethod; - self.shippingAddress = [[STPAddress alloc] initWithABRecord:payment.shippingAddress]; + self.shippingAddress = [[STPAddress alloc] initWithPKContact:payment.shippingContact]; self.shippingAddressNeedsVerification = NO; [self.delegate paymentContextDidChange:self]; if ([self.apiAdapter isKindOfClass:[STPCustomerContext class]]) { @@ -632,7 +626,6 @@ - (void)didFinishWithStatus:(STPPaymentStatus)status } - (PKPaymentRequest *)buildPaymentRequest { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); if (!self.configuration.appleMerchantIdentifier || !self.paymentAmount) { return nil; } @@ -652,27 +645,16 @@ - (PKPaymentRequest *)buildPaymentRequest { else { paymentRequest.shippingMethods = self.shippingMethods; } - if ([paymentRequest respondsToSelector:@selector(shippingType)]) { - paymentRequest.shippingType = [[self class] pkShippingType:self.configuration.shippingType];; - } + + paymentRequest.shippingType = [[self class] pkShippingType:self.configuration.shippingType];; + if (self.shippingAddress != nil) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - // Using shippingContact if available to work around an iOS10 bug: - // https://openradar.appspot.com/radar?id=5518219632705536 - if ([paymentRequest respondsToSelector:@selector(shippingContact)]) { - paymentRequest.shippingContact = [self.shippingAddress PKContactValue]; - } - else { - paymentRequest.shippingAddress = [self.shippingAddress ABRecordValue]; - } -#pragma clang diagnostic pop + paymentRequest.shippingContact = [self.shippingAddress PKContactValue]; } return paymentRequest; } + (PKShippingType)pkShippingType:(STPShippingType)shippingType { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability); switch (shippingType) { case STPShippingTypeShipping: return PKShippingTypeShipping; diff --git a/Stripe/STPPaymentContextAmountModel.h b/Stripe/STPPaymentContextAmountModel.h index e1635c6fe56..2161802ed93 100644 --- a/Stripe/STPPaymentContextAmountModel.h +++ b/Stripe/STPPaymentContextAmountModel.h @@ -9,14 +9,11 @@ #import #import -#define FAUXPAS_IGNORED_IN_CLASS(...) - /** Internal model for STPPaymentContext's `paymentAmount` and `paymentSummaryItems` properties. */ @interface STPPaymentContextAmountModel : NSObject -FAUXPAS_IGNORED_IN_CLASS(APIAvailability) - (instancetype)initWithAmount:(NSInteger)paymentAmount; - (instancetype)initWithPaymentSummaryItems:(NSArray *)paymentSummaryItems; diff --git a/Stripe/STPPaymentContextAmountModel.m b/Stripe/STPPaymentContextAmountModel.m index 1d78354d45b..5dfd19ffec7 100644 --- a/Stripe/STPPaymentContextAmountModel.m +++ b/Stripe/STPPaymentContextAmountModel.m @@ -15,8 +15,6 @@ @implementation STPPaymentContextAmountModel { NSArray *_paymentSummaryItems; } -FAUXPAS_IGNORED_IN_CLASS(APIAvailability) - - (instancetype)initWithAmount:(NSInteger)paymentAmount { self = [super init]; if (self) { diff --git a/Stripe/STPRedirectContext.m b/Stripe/STPRedirectContext.m index a1e13bcb503..f18f39edb80 100644 --- a/Stripe/STPRedirectContext.m +++ b/Stripe/STPRedirectContext.m @@ -16,8 +16,6 @@ #import -#define FAUXPAS_IGNORED_IN_METHOD(...) - NS_ASSUME_NONNULL_BEGIN typedef void (^STPBoolCompletionBlock)(BOOL success); @@ -60,7 +58,6 @@ - (void)dealloc { } - (void)performAppRedirectIfPossibleWithCompletion:(STPBoolCompletionBlock)onCompletion { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability) if (self.state == STPRedirectContextStateNotStarted) { NSURL *nativeUrl = [self nativeRedirectURLForSource:self.source]; @@ -75,7 +72,7 @@ - (void)performAppRedirectIfPossibleWithCompletion:(STPBoolCompletionBlock)onCom [self subscribeToUrlAndForegroundNotifications]; UIApplication *application = [UIApplication sharedApplication]; - if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) { + if (@available(iOS 10, *)) { WEAK(self); [application openURL:nativeUrl options:@{} completionHandler:^(BOOL success) { @@ -103,7 +100,6 @@ - (void)performAppRedirectIfPossibleWithCompletion:(STPBoolCompletionBlock)onCom } - (void)startRedirectFlowFromViewController:(UIViewController *)presentingViewController { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability) WEAK(self) [self performAppRedirectIfPossibleWithCompletion:^(BOOL success) { @@ -120,7 +116,7 @@ - (void)startRedirectFlowFromViewController:(UIViewController *)presentingViewCo } - (void)startSafariViewControllerRedirectFlowFromViewController:(UIViewController *)presentingViewController { - FAUXPAS_IGNORED_IN_METHOD(APIAvailability) + if (self.state == STPRedirectContextStateNotStarted) { _state = STPRedirectContextStateInProgress; [self subscribeToUrlNotifications]; @@ -149,14 +145,14 @@ - (void)cancel { #pragma mark - SFSafariViewControllerDelegate - -- (void)safariViewControllerDidFinish:(__unused SFSafariViewController *)controller { FAUXPAS_IGNORED_ON_LINE(APIAvailability) +- (void)safariViewControllerDidFinish:(__unused SFSafariViewController *)controller { stpDispatchToMainThreadIfNecessary(^{ [self handleRedirectCompletionWithError:nil shouldDismissViewController:NO]; }); } -- (void)safariViewController:(__unused SFSafariViewController *)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully { FAUXPAS_IGNORED_ON_LINE(APIAvailability) +- (void)safariViewController:(__unused SFSafariViewController *)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully { if (didLoadSuccessfully == NO) { stpDispatchToMainThreadIfNecessary(^{ [self handleRedirectCompletionWithError:[NSError stp_genericConnectionError] diff --git a/Stripe/STPTheme.m b/Stripe/STPTheme.m index c3fe007455c..a5ddf0c1641 100644 --- a/Stripe/STPTheme.m +++ b/Stripe/STPTheme.m @@ -22,8 +22,6 @@ @interface STPTheme() static UIFont *STPThemeDefaultFont; static UIFont *STPThemeDefaultMediumFont; -#define FAUXPAS_IGNORED_ON_LINE(...) - @implementation STPTheme + (void)initialize { @@ -34,12 +32,8 @@ + (void)initialize { STPThemeDefaultAccentColor = [UIColor colorWithRed:0 green:122.0f/255.0f blue:1 alpha:1]; STPThemeDefaultErrorColor = [UIColor colorWithRed:1 green:72.0f/255.0f blue:68.0f/255.0f alpha:1]; STPThemeDefaultFont = [UIFont systemFontOfSize:17]; - - if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { - STPThemeDefaultMediumFont = [UIFont systemFontOfSize:17.0f weight:0.2f] ?: [UIFont boldSystemFontOfSize:17]; FAUXPAS_IGNORED_ON_LINE(APIAvailability); - } else { - STPThemeDefaultMediumFont = [UIFont boldSystemFontOfSize:17]; - } + + STPThemeDefaultMediumFont = [UIFont systemFontOfSize:17.0f weight:0.2f] ?: [UIFont boldSystemFontOfSize:17]; } + (STPTheme *)defaultTheme { diff --git a/Stripe/STPURLCallbackHandler.m b/Stripe/STPURLCallbackHandler.m index 43c7158c598..0062b4f34be 100644 --- a/Stripe/STPURLCallbackHandler.m +++ b/Stripe/STPURLCallbackHandler.m @@ -8,12 +8,10 @@ #import "STPURLCallbackHandler.h" -#import "STPAPIClient.h" - +#import "FauxPasAnnotations.h" #import "NSURLComponents+Stripe.h" +#import "STPAPIClient.h" - -#define FAUXPAS_IGNORED_ON_LINE(...) NS_ASSUME_NONNULL_BEGIN @implementation Stripe (STPURLCallbackHandlerAdditions) diff --git a/Stripe/UIViewController+Stripe_KeyboardAvoiding.m b/Stripe/UIViewController+Stripe_KeyboardAvoiding.m index da582644e32..83797df7563 100644 --- a/Stripe/UIViewController+Stripe_KeyboardAvoiding.m +++ b/Stripe/UIViewController+Stripe_KeyboardAvoiding.m @@ -67,17 +67,9 @@ - (void)keyboardWillChangeFrame:(NSNotification *)notification { if (self.keyboardFrameBlock || self.managedScrollView) { if (!CGRectEqualToRect(self.lastKeyboardFrame, keyboardFrame)) { - // we're iOS 8 or later UIView *responder = [self.parentViewController.view stp_findFirstResponder]; self.lastResponder = responder; - if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) { - [self doKeyboardChangeAnimationWithNewFrame:keyboardFrame]; - } else { - NSTimeInterval duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; - [UIView animateWithDuration:duration animations:^{ - [self doKeyboardChangeAnimationWithNewFrame:keyboardFrame]; - }]; - } + [self doKeyboardChangeAnimationWithNewFrame:keyboardFrame]; } } } diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_CA@2x.png index cae76923743..564852ccf17 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_GB@2x.png index b549cf83857..dcc1c95f28a 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_MX@2x.png index 1d394baee2c..959a04b688a 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_US@2x.png index c80736ec889..03a60866ff6 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_delivery@2x.png index ec010abe514..928fed2453c 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_no_country@2x.png index 3a70657b6d0..cb7e0f4bb0d 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testChinese_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_CA@2x.png index fe3296247ff..510c8cd26eb 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_GB@2x.png index 3b18035a1fd..643d4c473ad 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_MX@2x.png index 121e0d3dbc6..d761d22f218 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_US@2x.png index 9aea2e02565..43b49574818 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_delivery@2x.png index ededc3dda7c..86480952695 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_no_country@2x.png index 38e05fe386a..d3fa2d61d22 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testDutch_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_CA@2x.png index 70a43992a5a..a75014573ba 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_GB@2x.png index 7fd00eb8844..76b8b5d740c 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_MX@2x.png index e8b0c8b572f..e305705ff8c 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_US@2x.png index ea88c21ce16..def86b0e570 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_delivery@2x.png index 50859e1eb1e..43f2b0ac47b 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_no_country@2x.png index 90912c6e84f..271c684e17a 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testEnglish_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_CA@2x.png index 308983aa69c..89eef9d93bf 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_GB@2x.png index 0b5ed48e97c..2a17a225c9c 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_MX@2x.png index dd96fc9ff92..96f31802c5f 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_US@2x.png index 9e18aec13d3..771c8a657d0 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_delivery@2x.png index c12ea343ad4..8c8d955c4af 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_no_country@2x.png index a1549146b17..a72bc7d2eec 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testFrench_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_CA@2x.png index 95fbd8574c0..232c107ad80 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_GB@2x.png index 0ce81a25f07..57afcd7323a 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_MX@2x.png index 5c6ef2c12b5..491977906cb 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_US@2x.png index 13fdcd23bac..baf8f893f56 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_delivery@2x.png index 9083545601c..bc59fc0f44e 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_no_country@2x.png index 841de17140a..6e8bb377263 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testGerman_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_CA@2x.png index d1e2f75a07f..d6ecdec6983 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_GB@2x.png index f85d09389aa..3e09b899948 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_MX@2x.png index 19305043452..465985396b7 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_US@2x.png index 5783c9510d4..c50b1a6190f 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_delivery@2x.png index 074130d354e..5ba2ad92779 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_no_country@2x.png index 188468532f0..c1113854f72 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testItalian_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_CA@2x.png index 71becb07ce7..a1807bd45e0 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_GB@2x.png index 98601b0dafd..093b169873e 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_MX@2x.png index ea2234057b4..1b8cb7c8477 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_US@2x.png index 0e941f3226a..cd039a1cb5c 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_delivery@2x.png index c3588c4bfbd..008684f9489 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_no_country@2x.png index 78ba99708eb..23fad5cfa9e 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testJapanese_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_CA@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_CA@2x.png index a7c58d3a907..63f5ba1d8c2 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_CA@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_CA@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_GB@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_GB@2x.png index 0e008703b76..23831ca7673 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_GB@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_GB@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_MX@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_MX@2x.png index 7872323f6b4..d8fa9ceb693 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_MX@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_MX@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_US@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_US@2x.png index 4e2a139bafd..b7fb46f6a38 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_US@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_US@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_delivery@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_delivery@2x.png index 40c14d8f9c4..2667ef389be 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_delivery@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_no_country@2x.png b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_no_country@2x.png index 2ebee6d874e..4a255814eb6 100644 Binary files a/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_no_country@2x.png and b/Tests/ReferenceImages_64/STPAddCardViewControllerLocalizationTests/testSpanish_no_country@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testChinese@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testChinese@2x.png index ce3069768ed..a9adeca8949 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testChinese@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testChinese@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testDutch@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testDutch@2x.png index 7c1ed765c91..4e746fd56d8 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testDutch@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testDutch@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testEnglish@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testEnglish@2x.png index 7c01452319f..10f8cda7fda 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testEnglish@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testEnglish@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testFrench@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testFrench@2x.png index 369bc9bf3e4..dd87f22248c 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testFrench@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testFrench@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testGerman@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testGerman@2x.png index 5d8b632782c..f0843feb014 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testGerman@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testGerman@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testItalian@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testItalian@2x.png index 5d969357f96..009740fc944 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testItalian@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testItalian@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testJapanese@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testJapanese@2x.png index 26ae89da075..eef1c0bb10d 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testJapanese@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testJapanese@2x.png differ diff --git a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testSpanish@2x.png b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testSpanish@2x.png index e455383c3cf..380121a5a0b 100644 Binary files a/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testSpanish@2x.png and b/Tests/ReferenceImages_64/STPPaymentMethodsViewControllerLocalizationTests/testSpanish@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_contact@2x.png index 64b28e766c8..21787f861bd 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_delivery@2x.png index 5e37044874d..59b64dbd860 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_shipping@2x.png index 35eed86f739..51ffa4d5e71 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testChinese_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_contact@2x.png index f1b970ae888..626f42f5fbe 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_delivery@2x.png index f7a0e076203..a72cc9fd932 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_shipping@2x.png index 2b8cda7b59f..a16d93353cc 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testDutch_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_contact@2x.png index 0ae51da5b2a..3df5584deb5 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_delivery@2x.png index 550b56e240f..de6ebf3c595 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_shipping@2x.png index 28bc3092a6a..7a8a2671653 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testEnglish_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_contact@2x.png index 7e99e9f81bc..6effd37c0bf 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_delivery@2x.png index ee0c8427c9f..4edc868db72 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_shipping@2x.png index 1ab48f43a49..8f9d625c490 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testFrench_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_contact@2x.png index c992fb15677..07a7f96bbda 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_delivery@2x.png index cf4f9ae6528..40e6247e6cb 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_shipping@2x.png index 4a0b53c7add..241dc1cb9e9 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testGerman_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_contact@2x.png index cba4a9aad13..e61e017ca4f 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_delivery@2x.png index fc61ed1f193..6d17092fe25 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_shipping@2x.png index fcf2e0c101f..f2eb092e9ad 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testItalian_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_contact@2x.png index 6ae49e22b26..19ed7d4d9f4 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_delivery@2x.png index 8379714f4c4..041cd64611a 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_shipping@2x.png index b7cbc5504c5..d5e5c8f0220 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testJapanese_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_contact@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_contact@2x.png index 699ecc6bd31..25a37ba8808 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_contact@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_contact@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_delivery@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_delivery@2x.png index 01dbcdbb418..62af7a8e0ea 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_delivery@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_delivery@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_shipping@2x.png b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_shipping@2x.png index 47a1cf0f89f..aae6ab1ca5e 100644 Binary files a/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_shipping@2x.png and b/Tests/ReferenceImages_64/STPShippingAddressViewControllerLocalizationTests/testSpanish_shipping@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testChinese@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testChinese@2x.png index 6819146bcc1..2ca3fc283f4 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testChinese@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testChinese@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testDutch@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testDutch@2x.png index af3ce4b1a09..81635cc9be7 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testDutch@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testDutch@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testEnglish@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testEnglish@2x.png index c9d9f201099..40d3196883f 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testEnglish@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testEnglish@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testFrench@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testFrench@2x.png index 17f89db1202..ee7878fc71a 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testFrench@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testFrench@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testGerman@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testGerman@2x.png index d92c77b5147..f21d593d92c 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testGerman@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testGerman@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testItalian@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testItalian@2x.png index 17de6543d00..0228eae5cd5 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testItalian@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testItalian@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testJapanese@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testJapanese@2x.png index 1f95c772b2d..c04eec099c9 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testJapanese@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testJapanese@2x.png differ diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testSpanish@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testSpanish@2x.png index e9993e51367..458bdab23f1 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testSpanish@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testSpanish@2x.png differ diff --git a/Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.h b/Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.h new file mode 100644 index 00000000000..08bc35bdf84 --- /dev/null +++ b/Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.h @@ -0,0 +1,13 @@ +// +// FBSnapshotTestCase+STPViewControllerLoading.h +// StripeiOS Tests +// +// Created by Brian Dorfman on 12/11/17. +// Copyright © 2017 Stripe, Inc. All rights reserved. +// + +#import + +@interface FBSnapshotTestCase (STPViewControllerLoading) +- (UIView *)stp_preparedAndSizedViewForSnapshotTestFromViewController:(UIViewController *)viewController; +@end diff --git a/Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.m b/Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.m new file mode 100644 index 00000000000..fb5606158b1 --- /dev/null +++ b/Tests/Tests/FBSnapshotTestCase+STPViewControllerLoading.m @@ -0,0 +1,33 @@ +// +// FBSnapshotTestCase+STPViewControllerLoading.m +// StripeiOS Tests +// +// Created by Brian Dorfman on 12/11/17. +// Copyright © 2017 Stripe, Inc. All rights reserved. +// + +#import "FBSnapshotTestCase+STPViewControllerLoading.h" +#import "STPCoreScrollViewController+Private.h" + +@implementation FBSnapshotTestCase (STPViewControllerLoading) +- (UIView *)stp_preparedAndSizedViewForSnapshotTestFromViewController:(UIViewController *)viewController { + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; + UIWindow *testWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; + testWindow.rootViewController = navController; + testWindow.hidden = NO; + + // Test that loaded properly + loads them on first call + XCTAssertNotNil(navController.view); + XCTAssertNotNil(viewController.view); + + if ([viewController isKindOfClass:[STPCoreScrollViewController class]]) { + UIScrollView *scrollView = ((STPCoreScrollViewController *)viewController).scrollView; + [navController.view layoutIfNeeded]; + + CGFloat topOffset = [scrollView convertPoint:scrollView.frame.origin toCoordinateSpace:navController.view].y; + navController.view.frame = CGRectMake(0, 0, 320, topOffset + scrollView.contentSize.height + scrollView.contentInset.top + scrollView.contentInset.bottom); + } + + return navController.view; +} +@end diff --git a/Tests/Tests/STPAddCardViewControllerLocalizationTests.m b/Tests/Tests/STPAddCardViewControllerLocalizationTests.m index 9839a28b62f..19ce816c129 100644 --- a/Tests/Tests/STPAddCardViewControllerLocalizationTests.m +++ b/Tests/Tests/STPAddCardViewControllerLocalizationTests.m @@ -9,6 +9,8 @@ #import #import #import + +#import "FBSnapshotTestCase+STPViewControllerLoading.h" #import "STPSwitchTableViewCell.h" #import "STPAddCardViewController+Private.h" #import "STPAddressViewModel.h" @@ -20,7 +22,6 @@ #import "STPLocalizationUtils+STPTestAdditions.h" @interface STPAddCardViewControllerLocalizationTests : FBSnapshotTestCase - @end @interface STPAddCardViewController (TestsPrivate) @@ -52,16 +53,12 @@ - (void)performSnapshotTestForLanguage:(NSString *)language delivery:(BOOL)deliv theme:[STPTheme defaultTheme]]; addCardVC.shippingAddress = [STPAddress new]; addCardVC.shippingAddress.line1 = @"1"; // trigger "use shipping address" button - - UINavigationController *navController = [UINavigationController new]; - navController.view.frame = CGRectMake(0, 0, 320, 750); - [navController pushViewController:addCardVC animated:NO]; - [navController.view layoutIfNeeded]; - navController.view.frame = CGRectMake(0, 0, 320, addCardVC.tableView.contentSize.height); + + UIView *viewToTest = [self stp_preparedAndSizedViewForSnapshotTestFromViewController:addCardVC]; if (delivery) { addCardVC.addressViewModel.addressFieldTableViewCountryCode = @"INVALID"; - FBSnapshotVerifyView(navController.view, @"delivery"); + FBSnapshotVerifyView(viewToTest, @"delivery"); } else { /** This method rejects nil or empty country codes to stop strange looking behavior @@ -69,19 +66,19 @@ - (void)performSnapshotTestForLanguage:(NSString *)language delivery:(BOOL)deliv an invalid country code instead to test seeing the "Country" placeholder */ addCardVC.addressViewModel.addressFieldTableViewCountryCode = @"INVALID"; - FBSnapshotVerifyView(navController.view, @"no_country"); + FBSnapshotVerifyView(viewToTest, @"no_country"); addCardVC.addressViewModel.addressFieldTableViewCountryCode = @"US"; - FBSnapshotVerifyView(navController.view, @"US"); + FBSnapshotVerifyView(viewToTest, @"US"); addCardVC.addressViewModel.addressFieldTableViewCountryCode = @"GB"; - FBSnapshotVerifyView(navController.view, @"GB"); + FBSnapshotVerifyView(viewToTest, @"GB"); addCardVC.addressViewModel.addressFieldTableViewCountryCode = @"CA"; - FBSnapshotVerifyView(navController.view, @"CA"); + FBSnapshotVerifyView(viewToTest, @"CA"); addCardVC.addressViewModel.addressFieldTableViewCountryCode = @"MX"; - FBSnapshotVerifyView(navController.view, @"MX"); + FBSnapshotVerifyView(viewToTest, @"MX"); } [STPLocalizationUtils overrideLanguageTo:nil]; diff --git a/Tests/Tests/STPAddressTests.m b/Tests/Tests/STPAddressTests.m index 85b9c459681..3c4da2b164e 100644 --- a/Tests/Tests/STPAddressTests.m +++ b/Tests/Tests/STPAddressTests.m @@ -7,7 +7,6 @@ // #import -#import #import #import #import "STPAddress.h" @@ -20,10 +19,6 @@ @interface STPAddressTests : XCTestCase @implementation STPAddressTests - (void)testInitWithPKContact_complete { - if ([PKContact class] == nil) { - // Method not supported by iOS version - return; - } PKContact *contact = [PKContact new]; { @@ -57,11 +52,6 @@ - (void)testInitWithPKContact_complete { } - (void)testInitWithPKContact_partial { - if ([PKContact class] == nil) { - // Method not supported by iOS version - return; - } - PKContact *contact = [PKContact new]; { NSPersonNameComponents *name = [NSPersonNameComponents new]; @@ -166,157 +156,7 @@ - (void)testInitWithCNContact_partial { XCTAssertNil(address.country); } -- (void)testInitWithABRecord_complete { - ABRecordRef record = ABPersonCreate(); - ABRecordSetValue(record, kABPersonFirstNameProperty, CFSTR("John"), nil); - ABRecordSetValue(record, kABPersonLastNameProperty, CFSTR("Doe"), nil); - ABMutableMultiValueRef phonesRef = ABMultiValueCreateMutable(kABMultiStringPropertyType); - ABMultiValueAddValueAndLabel(phonesRef, @"888-555-1212", kABPersonPhoneMainLabel, NULL); - ABMultiValueAddValueAndLabel(phonesRef, @"555-555-5555", kABPersonPhoneMobileLabel, NULL); - ABRecordSetValue(record, kABPersonPhoneProperty, phonesRef, nil); - ABMutableMultiValueRef emailsRef = ABMultiValueCreateMutable(kABMultiStringPropertyType); - ABMultiValueAddValueAndLabel(emailsRef, @"foo@example.com", kABHomeLabel, NULL); - ABMultiValueAddValueAndLabel(emailsRef, @"bar@example.com", kABWorkLabel, NULL); - ABRecordSetValue(record, kABPersonEmailProperty, emailsRef, nil); - ABMutableMultiValueRef addressRef = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType); - NSDictionary *addressDict = @{ - (NSString *)kABPersonAddressStreetKey: @"55 John St", - (NSString *)kABPersonAddressCityKey: @"New York", - (NSString *)kABPersonAddressStateKey: @"NY", - (NSString *)kABPersonAddressZIPKey: @"10002", - (NSString *)kABPersonAddressCountryCodeKey: @"us", - }; - ABMultiValueAddValueAndLabel(addressRef, (__bridge CFTypeRef)(addressDict), kABWorkLabel, NULL); - ABRecordSetValue(record, kABPersonAddressProperty, addressRef, nil); - - STPAddress *address = [[STPAddress alloc] initWithABRecord:record]; - XCTAssertEqualObjects(@"John Doe", address.name); - XCTAssertEqualObjects(@"8885551212", address.phone); - XCTAssertEqualObjects(@"foo@example.com", address.email); - XCTAssertEqualObjects(@"55 John St", address.line1); - XCTAssertEqualObjects(@"New York", address.city); - XCTAssertEqualObjects(@"NY", address.state); - XCTAssertEqualObjects(@"10002", address.postalCode); - XCTAssertEqualObjects(@"US", address.country); -} - -- (void)testInitWithABRecord_partial { - ABRecordRef record = ABPersonCreate(); - ABRecordSetValue(record, kABPersonFirstNameProperty, CFSTR("John"), nil); - ABMutableMultiValueRef addressRef = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType); - NSDictionary *addressDict = @{ - (NSString *)kABPersonAddressStateKey: @"VA", - }; - ABMultiValueAddValueAndLabel(addressRef, (__bridge CFTypeRef)(addressDict), kABWorkLabel, NULL); - ABRecordSetValue(record, kABPersonAddressProperty, addressRef, nil); - - STPAddress *address = [[STPAddress alloc] initWithABRecord:record]; - XCTAssertEqualObjects(@"John", address.name); - XCTAssertNil(address.phone); - XCTAssertNil(address.email); - XCTAssertNil(address.line1); - XCTAssertNil(address.city); - XCTAssertEqualObjects(@"VA", address.state); - XCTAssertNil(address.postalCode); - XCTAssertNil(address.country); -} - -- (void)testABRecordValue_complete { - STPAddress *address = [STPAddress new]; - address.name = @"John Smith Doe"; - address.phone = @"8885551212"; - address.email = @"foo@example.com"; - address.line1 = @"55 John St"; - address.city = @"New York"; - address.state = @"NY"; - address.postalCode = @"10002"; - address.country = @"US"; - - ABRecordRef record = [address ABRecordValue]; - NSString *firstName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonFirstNameProperty); - NSString *lastName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonLastNameProperty); - ABMultiValueRef emailValues = ABRecordCopyValue(record, kABPersonEmailProperty); - NSString *email = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(emailValues, 0)); - CFRelease(emailValues); - ABMultiValueRef phoneValues = ABRecordCopyValue(record, kABPersonPhoneProperty); - NSString *phone = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(phoneValues, 0)); - CFRelease(phoneValues); - NSString *line1, *city, *state, *postalCode, *country; - ABMultiValueRef addressValues = ABRecordCopyValue(record, kABPersonAddressProperty); - if (addressValues != NULL) { - if (ABMultiValueGetCount(addressValues) > 0) { - CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressValues, 0); - line1 = CFDictionaryGetValue(dict, kABPersonAddressStreetKey); - city = CFDictionaryGetValue(dict, kABPersonAddressCityKey); - state = CFDictionaryGetValue(dict, kABPersonAddressStateKey); - postalCode = CFDictionaryGetValue(dict, kABPersonAddressZIPKey); - country = CFDictionaryGetValue(dict, kABPersonAddressCountryCodeKey); - CFRelease(dict); - } - CFRelease(addressValues); - } - XCTAssertEqualObjects(firstName, @"John"); - XCTAssertEqualObjects(lastName, @"Smith Doe"); - XCTAssertEqualObjects(email, @"foo@example.com"); - XCTAssertEqualObjects(phone, @"8885551212"); - XCTAssertEqualObjects(line1, @"55 John St"); - XCTAssertEqualObjects(city, @"New York"); - XCTAssertEqualObjects(state, @"NY"); - XCTAssertEqualObjects(country, @"US"); - XCTAssertEqualObjects(postalCode, @"10002"); -} - -- (void)testABRecordValue_partial { - STPAddress *address = [STPAddress new]; - address.name = @"John"; - address.state = @"VA"; - - ABRecordRef record = [address ABRecordValue]; - NSString *firstName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonFirstNameProperty); - NSString *lastName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonLastNameProperty); - ABMultiValueRef emailValues = ABRecordCopyValue(record, kABPersonEmailProperty); - NSString *email = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(emailValues, 0)); - if (emailValues != NULL) { - CFRelease(emailValues); - } - ABMultiValueRef phoneValues = ABRecordCopyValue(record, kABPersonPhoneProperty); - NSString *phone = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(phoneValues, 0)); - if (phoneValues != NULL) { - CFRelease(phoneValues); - } - NSString *line1, *city, *state, *postalCode, *country; - ABMultiValueRef addressValues = ABRecordCopyValue(record, kABPersonAddressProperty); - if (addressValues != NULL) { - if (ABMultiValueGetCount(addressValues) > 0) { - CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressValues, 0); - line1 = CFDictionaryGetValue(dict, kABPersonAddressStreetKey); - city = CFDictionaryGetValue(dict, kABPersonAddressCityKey); - state = CFDictionaryGetValue(dict, kABPersonAddressStateKey); - postalCode = CFDictionaryGetValue(dict, kABPersonAddressZIPKey); - country = CFDictionaryGetValue(dict, kABPersonAddressCountryCodeKey); - if (dict != NULL) { - CFRelease(dict); - } - } - CFRelease(addressValues); - } - XCTAssertEqualObjects(firstName, @"John"); - XCTAssertNil(lastName); - XCTAssertNil(email); - XCTAssertNil(phone); - XCTAssertTrue((line1.length == 0)); - XCTAssertTrue((city.length == 0)); - XCTAssertEqualObjects(state, @"VA"); - XCTAssertTrue((country.length == 0)); - XCTAssertTrue((postalCode.length == 0)); -} - - (void)testPKContactValue { - if ([PKContact class] == nil || [CNPostalAddress class] == nil) { - // Method not supported by iOS version - return; - } - STPAddress *address = [STPAddress new]; address.name = @"John Smith Doe"; address.phone = @"8885551212"; diff --git a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m b/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m index 9a2bc00aa9e..3e681b286f9 100644 --- a/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m +++ b/Tests/Tests/STPPaymentMethodsViewControllerLocalizationTests.m @@ -9,19 +9,19 @@ #import #import +#import "FBSnapshotTestCase+STPViewControllerLoading.h" #import "STPFixtures.h" #import "STPMocks.h" #import "STPLocalizationUtils+STPTestAdditions.h" @interface STPPaymentMethodsViewControllerLocalizationTests : FBSnapshotTestCase - @end @implementation STPPaymentMethodsViewControllerLocalizationTests //- (void)setUp { // [super setUp]; -// +// // self.recordMode = YES; //} @@ -39,18 +39,11 @@ - (void)performSnapshotTestForLanguage:(NSString *)language { customerContext:customerContext delegate:delegate]; - UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:paymentMethodsVC]; - UIWindow *testWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; - testWindow.rootViewController = navController; - testWindow.hidden = NO; - // Test that loaded properly + loads them on first call - XCTAssertNotNil(navController.view); - XCTAssertNotNil(paymentMethodsVC.view); + UIView *viewToTest = [self stp_preparedAndSizedViewForSnapshotTestFromViewController:paymentMethodsVC]; - FBSnapshotVerifyView(testWindow, nil); + FBSnapshotVerifyView(viewToTest, nil); [STPLocalizationUtils overrideLanguageTo:nil]; - } - (void)testGerman { diff --git a/Tests/Tests/STPShippingAddressViewControllerLocalizationTests.m b/Tests/Tests/STPShippingAddressViewControllerLocalizationTests.m index 01cd0058cca..eed7737cfce 100644 --- a/Tests/Tests/STPShippingAddressViewControllerLocalizationTests.m +++ b/Tests/Tests/STPShippingAddressViewControllerLocalizationTests.m @@ -9,6 +9,8 @@ #import #import #import + +#import "FBSnapshotTestCase+STPViewControllerLoading.h" #import "STPAddressViewModel.h" #import "STPAddressFieldTableViewCell.h" #import "STPBundleLocator.h" @@ -56,19 +58,16 @@ - (void)performSnapshotTestForLanguage:(NSString *)language shippingType:(STPShi selectedShippingMethod:nil prefilledInformation:info]; - UINavigationController *navController = [UINavigationController new]; - navController.view.frame = CGRectMake(0, 0, 320, 750); - [navController pushViewController:shippingVC animated:NO]; - [navController.view layoutIfNeeded]; - navController.view.frame = CGRectMake(0, 0, 320, shippingVC.tableView.contentSize.height); - /** This method rejects nil or empty country codes to stop strange looking behavior when scrolling to the top "unset" position in the picker, so put in an invalid country code instead to test seeing the "Country" placeholder */ shippingVC.addressViewModel.addressFieldTableViewCountryCode = @"INVALID"; - FBSnapshotVerifyView(navController.view, identifier); + + UIView *viewToTest = [self stp_preparedAndSizedViewForSnapshotTestFromViewController:shippingVC]; + + FBSnapshotVerifyView(viewToTest, identifier); [STPLocalizationUtils overrideLanguageTo:nil]; } diff --git a/Tests/Tests/STPShippingMethodsViewControllerLocalizationTests.m b/Tests/Tests/STPShippingMethodsViewControllerLocalizationTests.m index f97fc3a4496..79ad912a456 100644 --- a/Tests/Tests/STPShippingMethodsViewControllerLocalizationTests.m +++ b/Tests/Tests/STPShippingMethodsViewControllerLocalizationTests.m @@ -9,6 +9,8 @@ #import #import #import + +#import "FBSnapshotTestCase+STPViewControllerLoading.h" #import "STPAddressViewModel.h" #import "STPAddressFieldTableViewCell.h" #import "STPLocalizationUtils.h" @@ -45,16 +47,10 @@ - (void)performSnapshotTestForLanguage:(NSString *)language { method2.detail = @"Arrives tomorrow"; method2.amount = [NSDecimalNumber decimalNumberWithString:@"5.99"]; method2.identifier = @"fedex"; - STPShippingMethodsViewController *shippingVC = [[STPShippingMethodsViewController alloc] initWithShippingMethods:@[method1, method2] selectedShippingMethod:method1 currency:@"usd" theme:[STPTheme defaultTheme]]; - - UINavigationController *navController = [UINavigationController new]; - navController.view.frame = CGRectMake(0, 0, 320, 750); - [navController pushViewController:shippingVC animated:NO]; - [navController.view layoutIfNeeded]; - navController.view.frame = CGRectMake(0, 0, 320, shippingVC.tableView.contentSize.height); - - FBSnapshotVerifyView(navController.view, nil); + STPShippingMethodsViewController *shippingVC = [[STPShippingMethodsViewController alloc] initWithShippingMethods:@[method1, method2] selectedShippingMethod:method1 currency:@"usd" theme:[STPTheme defaultTheme]]; + UIView *viewToTest = [self stp_preparedAndSizedViewForSnapshotTestFromViewController:shippingVC]; + FBSnapshotVerifyView(viewToTest, nil); [STPLocalizationUtils overrideLanguageTo:nil]; } diff --git a/Tests/installation_tests/cocoapods/with_frameworks/Podfile b/Tests/installation_tests/cocoapods/with_frameworks/Podfile index 718fc45ef16..cf5db8d78bc 100644 --- a/Tests/installation_tests/cocoapods/with_frameworks/Podfile +++ b/Tests/installation_tests/cocoapods/with_frameworks/Podfile @@ -1,7 +1,7 @@ use_frameworks! target 'CocoapodsTest' do - platform :ios, '8.0' + platform :ios, '9.0' use_frameworks! pod 'Stripe', path: '../../../..' end diff --git a/Tests/installation_tests/cocoapods/with_frameworks/test.sh b/Tests/installation_tests/cocoapods/with_frameworks/test.sh index 3a1036998f7..79c69519c86 100755 --- a/Tests/installation_tests/cocoapods/with_frameworks/test.sh +++ b/Tests/installation_tests/cocoapods/with_frameworks/test.sh @@ -65,7 +65,7 @@ xcodebuild clean build \ -workspace "CocoapodsTest.xcworkspace" \ -scheme "CocoapodsTest" \ -sdk "iphonesimulator" \ - -destination "platform=iOS Simulator,name=iPhone 6,OS=10.3.1" \ + -destination "platform=iOS Simulator,name=iPhone 6,OS=11.2" \ | xcpretty xcodebuild_exit_code="${PIPESTATUS[0]}" diff --git a/Tests/installation_tests/cocoapods/without_frameworks/test.sh b/Tests/installation_tests/cocoapods/without_frameworks/test.sh index 3a1036998f7..79c69519c86 100755 --- a/Tests/installation_tests/cocoapods/without_frameworks/test.sh +++ b/Tests/installation_tests/cocoapods/without_frameworks/test.sh @@ -65,7 +65,7 @@ xcodebuild clean build \ -workspace "CocoapodsTest.xcworkspace" \ -scheme "CocoapodsTest" \ -sdk "iphonesimulator" \ - -destination "platform=iOS Simulator,name=iPhone 6,OS=10.3.1" \ + -destination "platform=iOS Simulator,name=iPhone 6,OS=11.2" \ | xcpretty xcodebuild_exit_code="${PIPESTATUS[0]}" diff --git a/Tests/installation_tests/manual_installation/test.sh b/Tests/installation_tests/manual_installation/test.sh index d66af6cb166..7ca929c4636 100755 --- a/Tests/installation_tests/manual_installation/test.sh +++ b/Tests/installation_tests/manual_installation/test.sh @@ -49,7 +49,7 @@ xcodebuild clean build-for-testing \ -project "${script_dir}/ManualInstallationTest.xcodeproj" \ -scheme "ManualInstallationTest" \ -sdk "iphonesimulator" \ - -destination "platform=iOS Simulator,name=iPhone 6,OS=10.3.1" \ + -destination "platform=iOS Simulator,name=iPhone 6,OS=11.2" \ | xcpretty xcodebuild_build_exit_code="${PIPESTATUS[0]}" @@ -62,7 +62,7 @@ xcodebuild test-without-building \ -project "${script_dir}/ManualInstallationTest.xcodeproj" \ -scheme "ManualInstallationTest" \ -sdk "iphonesimulator" \ - -destination "platform=iOS Simulator,name=iPhone 6,OS=10.3.1" \ + -destination "platform=iOS Simulator,name=iPhone 6,OS=11.2" \ | xcpretty xcodebuild_test_exit_code="${PIPESTATUS[0]}" diff --git a/ci_scripts/check_fauxpas.sh b/ci_scripts/check_fauxpas.sh index f0406c05a4a..04dc180d50c 100755 --- a/ci_scripts/check_fauxpas.sh +++ b/ci_scripts/check_fauxpas.sh @@ -55,10 +55,11 @@ min_severity="Concern" set -ex -fauxpas check "${xcodeproj_path}" \ - --target "StripeiOS" \ - --configFile "${config_path}" \ - --minErrorStatusSeverity "${min_severity}" +# Fauxpas 1.7.2 does not build our framework target correctly https://bitbucket.org/ali_rantakari/faux-pas/issues/117/unrecoverable-compiler-error-translation +# fauxpas check "${xcodeproj_path}" \ +# --target "StripeiOS" \ +# --configFile "${config_path}" \ +# --minErrorStatusSeverity "${min_severity}" fauxpas check "${xcodeproj_path}" \ --target "StripeiOSStatic" \ diff --git a/ci_scripts/run_tests.sh b/ci_scripts/run_tests.sh index 954fa4c0812..1062cfe4a78 100755 --- a/ci_scripts/run_tests.sh +++ b/ci_scripts/run_tests.sh @@ -4,7 +4,7 @@ carthage bootstrap --platform ios --configuration Release --no-use-binaries cd Example; carthage bootstrap --platform ios; cd .. gem install xcpretty --no-ri --no-rdoc -xcodebuild clean build build-for-testing -workspace Stripe.xcworkspace -scheme "StripeiOS" -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1' | xcpretty -c -xcodebuild test-without-building -workspace Stripe.xcworkspace -scheme "StripeiOS" -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1' | xcpretty -c -xcodebuild build -workspace Stripe.xcworkspace -scheme "Standard Integration (Swift)" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1' | xcpretty -c -xcodebuild build -workspace Stripe.xcworkspace -scheme "Custom Integration (ObjC)" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1' | xcpretty -c +xcodebuild clean build build-for-testing -workspace Stripe.xcworkspace -scheme "StripeiOS" -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.2' | xcpretty -c +xcodebuild test-without-building -workspace Stripe.xcworkspace -scheme "StripeiOS" -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.2' | xcpretty -c +xcodebuild build -workspace Stripe.xcworkspace -scheme "Standard Integration (Swift)" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.2' | xcpretty -c +xcodebuild build -workspace Stripe.xcworkspace -scheme "Custom Integration (ObjC)" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.2' | xcpretty -c