diff --git a/Example/Custom Integration (ObjC).xcodeproj/project.pbxproj b/Example/Custom Integration (ObjC).xcodeproj/project.pbxproj index 0c49cbcc394..1fc7593fa28 100644 --- a/Example/Custom Integration (ObjC).xcodeproj/project.pbxproj +++ b/Example/Custom Integration (ObjC).xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ ); INFOPLIST_FILE = "Custom Integration (ObjC)/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.stripe.customexample; + PRODUCT_BUNDLE_IDENTIFIER = com.stripe.CustomSDKExample; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -378,7 +378,7 @@ ); INFOPLIST_FILE = "Custom Integration (ObjC)/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.stripe.customexample; + PRODUCT_BUNDLE_IDENTIFIER = com.stripe.CustomSDKExample; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/Example/Standard Integration (Swift).xcodeproj/project.pbxproj b/Example/Standard Integration (Swift).xcodeproj/project.pbxproj index 833bc3aa913..e5afc6b1a5a 100644 --- a/Example/Standard Integration (Swift).xcodeproj/project.pbxproj +++ b/Example/Standard Integration (Swift).xcodeproj/project.pbxproj @@ -409,7 +409,7 @@ INFOPLIST_FILE = "Standard Integration (Swift)/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.stripe.standardexample; + PRODUCT_BUNDLE_IDENTIFIER = com.stripe.SimpleSDKExample; PRODUCT_NAME = "Standard Integration (Swift)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -439,7 +439,7 @@ INFOPLIST_FILE = "Standard Integration (Swift)/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.stripe.standardexample; + PRODUCT_BUNDLE_IDENTIFIER = com.stripe.SimpleSDKExample; PRODUCT_NAME = "Standard Integration (Swift)"; PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = ""; diff --git a/Example/UI Examples/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/UI Examples/Assets.xcassets/AppIcon.appiconset/Contents.json index 1d060ed2882..d8db8d65fd7 100644 --- a/Example/UI Examples/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/UI Examples/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -84,6 +84,11 @@ "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index c67db2c5089..547d421645e 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -277,9 +277,6 @@ 04E39F5C1CECFAFD00AF3B96 /* STPPaymentContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */; }; 04E39F6A1CED48D500AF3B96 /* UIBarButtonItem+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */; }; 04E39F6B1CED48D500AF3B96 /* UIBarButtonItem+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E39F691CED48D500AF3B96 /* UIBarButtonItem+Stripe.m */; }; - 04E39F6F1CED4C7700AF3B96 /* stp_icon_chevron_left.png in Resources */ = {isa = PBXBuildFile; fileRef = 04E39F6C1CED4C7700AF3B96 /* stp_icon_chevron_left.png */; }; - 04E39F701CED4C7700AF3B96 /* stp_icon_chevron_left@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 04E39F6D1CED4C7700AF3B96 /* stp_icon_chevron_left@2x.png */; }; - 04E39F711CED4C7700AF3B96 /* stp_icon_chevron_left@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 04E39F6E1CED4C7700AF3B96 /* stp_icon_chevron_left@3x.png */; }; 04EBC7531B7533C300A0E6AE /* STPCardValidationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 04EBC7511B7533C300A0E6AE /* STPCardValidationState.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04EBC7561B7533C300A0E6AE /* STPCardValidationState.h in Headers */ = {isa = PBXBuildFile; fileRef = 04EBC7511B7533C300A0E6AE /* STPCardValidationState.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04EBC7571B7533C300A0E6AE /* STPCardValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = 04EBC7521B7533C300A0E6AE /* STPCardValidator.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -617,9 +614,6 @@ F1510B591D5A4CC4000731AD /* stp_card_applepay@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3FA41CC8071100F57DE7 /* stp_card_applepay@3x.png */; }; F1510B5B1D5A4CC4000731AD /* stp_icon_add@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3F9D1CC8006800F57DE7 /* stp_icon_add@2x.png */; }; F1510B5C1D5A4CC4000731AD /* stp_icon_add@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 049A3F9E1CC8006800F57DE7 /* stp_icon_add@3x.png */; }; - F1510B5D1D5A4CC4000731AD /* stp_icon_chevron_left.png in Resources */ = {isa = PBXBuildFile; fileRef = 04E39F6C1CED4C7700AF3B96 /* stp_icon_chevron_left.png */; }; - F1510B5E1D5A4CC4000731AD /* stp_icon_chevron_left@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 04E39F6D1CED4C7700AF3B96 /* stp_icon_chevron_left@2x.png */; }; - F1510B5F1D5A4CC4000731AD /* stp_icon_chevron_left@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 04E39F6E1CED4C7700AF3B96 /* stp_icon_chevron_left@3x.png */; }; F1510BA71D5A77F6000731AD /* stp_card_diners_template.png in Resources */ = {isa = PBXBuildFile; fileRef = F1510BA41D5A77F6000731AD /* stp_card_diners_template.png */; }; F1510BAA1D5A77F6000731AD /* stp_card_diners_template@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F1510BA51D5A77F6000731AD /* stp_card_diners_template@2x.png */; }; F1510BAD1D5A77F6000731AD /* stp_card_diners_template@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F1510BA61D5A77F6000731AD /* stp_card_diners_template@3x.png */; }; @@ -954,9 +948,6 @@ 04E39F5A1CECFAFD00AF3B96 /* STPPaymentContext+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "STPPaymentContext+Private.h"; sourceTree = ""; }; 04E39F681CED48D500AF3B96 /* UIBarButtonItem+Stripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Stripe.h"; sourceTree = ""; }; 04E39F691CED48D500AF3B96 /* UIBarButtonItem+Stripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBarButtonItem+Stripe.m"; sourceTree = ""; }; - 04E39F6C1CED4C7700AF3B96 /* stp_icon_chevron_left.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = stp_icon_chevron_left.png; sourceTree = ""; }; - 04E39F6D1CED4C7700AF3B96 /* stp_icon_chevron_left@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stp_icon_chevron_left@2x.png"; sourceTree = ""; }; - 04E39F6E1CED4C7700AF3B96 /* stp_icon_chevron_left@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stp_icon_chevron_left@3x.png"; sourceTree = ""; }; 04EBC7511B7533C300A0E6AE /* STPCardValidationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPCardValidationState.h; path = PublicHeaders/STPCardValidationState.h; sourceTree = ""; }; 04EBC7521B7533C300A0E6AE /* STPCardValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPCardValidator.h; path = PublicHeaders/STPCardValidator.h; sourceTree = ""; }; 04F213301BCEAB61001D6F22 /* STPFormEncodable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STPFormEncodable.h; path = PublicHeaders/STPFormEncodable.h; sourceTree = ""; }; @@ -1122,7 +1113,7 @@ F132DFE21D51372A002FF5B7 /* STPWeakStrongMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPWeakStrongMacros.h; sourceTree = ""; }; F148ABC31D5D334B0014FD92 /* STPLocalizationUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPLocalizationUtils.m; sourceTree = ""; }; F148ABE71D5E805A0014FD92 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = Localizations/en.lproj/Localizable.strings; sourceTree = ""; }; - F148ABEA1D5E80790014FD92 /* zh-Hans */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "Localizations/zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; + F148ABEA1D5E80790014FD92 /* zh-Hans */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "Localizations/zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; F148ABEC1D5E80860014FD92 /* de */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = de; path = Localizations/de.lproj/Localizable.strings; sourceTree = ""; }; F148ABED1D5E808B0014FD92 /* es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = es; path = Localizations/es.lproj/Localizable.strings; sourceTree = ""; }; F148ABEE1D5E80990014FD92 /* it */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = it; path = Localizations/it.lproj/Localizable.strings; sourceTree = ""; }; @@ -1330,9 +1321,6 @@ 049A3F9C1CC8006800F57DE7 /* stp_icon_add.png */, 049A3F9D1CC8006800F57DE7 /* stp_icon_add@2x.png */, 049A3F9E1CC8006800F57DE7 /* stp_icon_add@3x.png */, - 04E39F6C1CED4C7700AF3B96 /* stp_icon_chevron_left.png */, - 04E39F6D1CED4C7700AF3B96 /* stp_icon_chevron_left@2x.png */, - 04E39F6E1CED4C7700AF3B96 /* stp_icon_chevron_left@3x.png */, C15993201D8807930047950D /* stp_shipping_form.png */, C15993211D8807930047950D /* stp_shipping_form@2x.png */, C15993221D8807930047950D /* stp_shipping_form@3x.png */, @@ -2419,13 +2407,11 @@ 0438EFC61B741C2800D506CC /* stp_card_jcb@3x.png in Resources */, 0438EFC21B741C2800D506CC /* stp_card_jcb.png in Resources */, F1C578F11D651AB200912EAE /* stp_card_applepay.png in Resources */, - 04E39F6F1CED4C7700AF3B96 /* stp_icon_chevron_left.png in Resources */, C1300D211EB8D38A0080AF7B /* stp_card_unknown@2x.png in Resources */, C1300D2D1EB8D3AB0080AF7B /* stp_card_error@2x.png in Resources */, F1510BC21D5A8146000731AD /* stp_card_jcb_template@2x.png in Resources */, F1510B1B1D5A4C93000731AD /* stp_card_discover_template@3x.png in Resources */, 0438EFD61B741C2800D506CC /* stp_card_visa@2x.png in Resources */, - 04E39F701CED4C7700AF3B96 /* stp_icon_chevron_left@2x.png in Resources */, F148ABFD1D5E8DF20014FD92 /* stp_card_form_back.png in Resources */, C11810C21CC7DA290022FB55 /* stp_card_form_front@2x.png in Resources */, C11810C01CC7DA290022FB55 /* stp_card_form_back@3x.png in Resources */, @@ -2462,7 +2448,6 @@ C1300D2E1EB8D3AB0080AF7B /* stp_card_error@3x.png in Resources */, F148ABE81D5E805A0014FD92 /* Localizable.strings in Resources */, 0438EFB41B741C2800D506CC /* stp_card_cvc_amex@3x.png in Resources */, - 04E39F711CED4C7700AF3B96 /* stp_icon_chevron_left@3x.png in Resources */, C1300D2C1EB8D3AB0080AF7B /* stp_card_error.png in Resources */, 0438EFB81B741C2800D506CC /* stp_card_diners@2x.png in Resources */, C11810C31CC7DA290022FB55 /* stp_card_form_front@3x.png in Resources */, @@ -2500,7 +2485,6 @@ C15993471D8829C00047950D /* stp_shipping_form@3x.png in Resources */, C1363BB31D76337900EB82B4 /* stp_icon_checkmark@2x.png in Resources */, F148AC031D5E8DF30014FD92 /* stp_card_form_front@3x.png in Resources */, - F1510B5E1D5A4CC4000731AD /* stp_icon_chevron_left@2x.png in Resources */, C1B630BD1D1D860100A05285 /* stp_card_amex@3x.png in Resources */, F1510B101D5A4C93000731AD /* stp_card_amex_template@3x.png in Resources */, C1B630BE1D1D860100A05285 /* stp_card_cvc.png in Resources */, @@ -2518,7 +2502,6 @@ C1B630C31D1D860100A05285 /* stp_card_cvc_amex@3x.png in Resources */, C1300D311EB8F16B0080AF7B /* stp_card_error_amex@3x.png in Resources */, C1B630C41D1D860100A05285 /* stp_card_diners.png in Resources */, - F1510B5D1D5A4CC4000731AD /* stp_icon_chevron_left.png in Resources */, C1B630C51D1D860100A05285 /* stp_card_diners@2x.png in Resources */, C12057521D676DD400CFBCB8 /* stp_card_jcb_template@3x.png in Resources */, F1510B1A1D5A4C93000731AD /* stp_card_discover_template@2x.png in Resources */, @@ -2560,7 +2543,6 @@ C1300D361EB8F1780080AF7B /* stp_card_unknown@2x.png in Resources */, F1510B201D5A4C93000731AD /* stp_card_mastercard_template@2x.png in Resources */, C12057501D676DD400CFBCB8 /* stp_card_jcb_template.png in Resources */, - F1510B5F1D5A4CC4000731AD /* stp_icon_chevron_left@3x.png in Resources */, C1B630D61D1D860100A05285 /* stp_card_visa.png in Resources */, C12057511D676DD400CFBCB8 /* stp_card_jcb_template@2x.png in Resources */, C1B630D71D1D860100A05285 /* stp_card_visa@2x.png in Resources */, diff --git a/Stripe/Resources/Images/stp_icon_chevron_left.png b/Stripe/Resources/Images/stp_icon_chevron_left.png deleted file mode 100644 index 35b938a33d9..00000000000 Binary files a/Stripe/Resources/Images/stp_icon_chevron_left.png and /dev/null differ diff --git a/Stripe/Resources/Images/stp_icon_chevron_left@2x.png b/Stripe/Resources/Images/stp_icon_chevron_left@2x.png deleted file mode 100644 index d05a9e03471..00000000000 Binary files a/Stripe/Resources/Images/stp_icon_chevron_left@2x.png and /dev/null differ diff --git a/Stripe/Resources/Images/stp_icon_chevron_left@3x.png b/Stripe/Resources/Images/stp_icon_chevron_left@3x.png deleted file mode 100644 index 946236a4179..00000000000 Binary files a/Stripe/Resources/Images/stp_icon_chevron_left@3x.png and /dev/null differ diff --git a/Stripe/Resources/Localizations/de.lproj/Localizable.strings b/Stripe/Resources/Localizations/de.lproj/Localizable.strings index dc2d062a11f..381198752f6 100644 --- a/Stripe/Resources/Localizations/de.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/de.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "Adresszeile 2"; -/* Text for back button */ -"Back" = "Zurück"; - /* Title for billing address entry section */ "Billing Address" = "Rechnungsadresse"; diff --git a/Stripe/Resources/Localizations/en.lproj/Localizable.strings b/Stripe/Resources/Localizations/en.lproj/Localizable.strings index 271be2d52ba..c5b51f931a8 100644 --- a/Stripe/Resources/Localizations/en.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/en.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "Apt."; -/* Text for back button */ -"Back" = "Back"; - /* Title for billing address entry section */ "Billing Address" = "Billing Address"; diff --git a/Stripe/Resources/Localizations/es.lproj/Localizable.strings b/Stripe/Resources/Localizations/es.lproj/Localizable.strings index 0767d3c9ef0..eec4145d7ff 100644 --- a/Stripe/Resources/Localizations/es.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/es.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "Piso"; -/* Text for back button */ -"Back" = "Atrás"; - /* Title for billing address entry section */ "Billing Address" = "Dirección de facturación"; diff --git a/Stripe/Resources/Localizations/fr.lproj/Localizable.strings b/Stripe/Resources/Localizations/fr.lproj/Localizable.strings index 9c0fb881fa5..dc207e8a4e8 100644 --- a/Stripe/Resources/Localizations/fr.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/fr.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "Numéro d'appartement"; -/* Text for back button */ -"Back" = "Retour"; - /* Title for billing address entry section */ "Billing Address" = "Adresse de facturation"; diff --git a/Stripe/Resources/Localizations/it.lproj/Localizable.strings b/Stripe/Resources/Localizations/it.lproj/Localizable.strings index 72ada244e70..40caff1779f 100644 --- a/Stripe/Resources/Localizations/it.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/it.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "Int."; -/* Text for back button */ -"Back" = "Indietro"; - /* Title for billing address entry section */ "Billing Address" = "Indirizzo di fatturazione"; diff --git a/Stripe/Resources/Localizations/ja.lproj/Localizable.strings b/Stripe/Resources/Localizations/ja.lproj/Localizable.strings index 2963d92534f..80fbf88056f 100644 --- a/Stripe/Resources/Localizations/ja.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/ja.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "建物名"; -/* Text for back button */ -"Back" = "戻る"; - /* Title for billing address entry section */ "Billing Address" = "請求先住所"; diff --git a/Stripe/Resources/Localizations/nl.lproj/Localizable.strings b/Stripe/Resources/Localizations/nl.lproj/Localizable.strings index 77a8cc32782..9cc35cd1f82 100644 --- a/Stripe/Resources/Localizations/nl.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/nl.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "Adresregel 2"; -/* Text for back button */ -"Back" = "Terug"; - /* Title for billing address entry section */ "Billing Address" = "Factuuradres"; diff --git a/Stripe/Resources/Localizations/zh-Hans.lproj/Localizable.strings b/Stripe/Resources/Localizations/zh-Hans.lproj/Localizable.strings index cb4ef626efe..b87eb05517e 100644 --- a/Stripe/Resources/Localizations/zh-Hans.lproj/Localizable.strings +++ b/Stripe/Resources/Localizations/zh-Hans.lproj/Localizable.strings @@ -16,9 +16,6 @@ /* Caption for Apartment/Address line 2 field on address form */ "Apt." = "第二行地址"; -/* Text for back button */ -"Back" = "返回"; - /* Title for billing address entry section */ "Billing Address" = "帐单地址"; @@ -141,4 +138,3 @@ /* Caption for Zip Code field on address form (only shown when country is United States only) */ "ZIP Code" = "邮政编码"; - diff --git a/Stripe/STPAddCardViewController.m b/Stripe/STPAddCardViewController.m index 946f6d66791..c7bd0d1fabe 100644 --- a/Stripe/STPAddCardViewController.m +++ b/Stripe/STPAddCardViewController.m @@ -250,7 +250,7 @@ - (UIResponder *)firstEmptyField { return nil; } -- (void)handleBackOrCancelTapped:(__unused id)sender { +- (void)handleCancelTapped:(__unused id)sender { [self.delegate addCardViewControllerDidCancel:self]; } diff --git a/Stripe/STPCoreViewController+Private.h b/Stripe/STPCoreViewController+Private.h index 82689122842..b18a8f19bb7 100644 --- a/Stripe/STPCoreViewController+Private.h +++ b/Stripe/STPCoreViewController+Private.h @@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic) STPTheme *theme; @property (nonatomic) UIBarButtonItem *cancelItem; -@property (nonatomic) UIBarButtonItem *backItem; /** All designated initializers funnel through this method to do their setup @@ -39,8 +38,18 @@ NS_ASSUME_NONNULL_BEGIN @param sender Sender of the target action, if applicable. */ -- (void)handleBackOrCancelTapped:(nullable id)sender; +- (void)handleCancelTapped:(nullable id)sender; +/** + If you override this and return YES, then your CoreVC implementation will not + create and set up a cancel and instead just use the default + UIViewController back button behavior. + + You won't receive calls to `handleCancelTapped` if this is YES. + + Defaults to NO. + */ +- (BOOL)useSystemBackButton; /** Called in viewDidLoad after doing base implementation, before diff --git a/Stripe/STPCoreViewController.m b/Stripe/STPCoreViewController.m index 27c99faa64e..315c101d9ef 100644 --- a/Stripe/STPCoreViewController.m +++ b/Stripe/STPCoreViewController.m @@ -53,15 +53,14 @@ - (instancetype)initWithTheme:(STPTheme *)theme { - (void)commonInitWithTheme:(STPTheme *)theme { _theme = theme; - self.backItem = [UIBarButtonItem stp_backButtonItemWithTitle:STPLocalizedString(@"Back", @"Text for back button") - style:UIBarButtonItemStylePlain - target:self - action:@selector(handleBackOrCancelTapped:)]; - self.cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target:self - action:@selector(handleBackOrCancelTapped:)]; - - self.stp_navigationItemProxy.leftBarButtonItem = self.cancelItem; + + if (![self useSystemBackButton]) { + self.cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel + target:self + action:@selector(handleCancelTapped:)]; + + self.stp_navigationItemProxy.leftBarButtonItem = self.cancelItem; + } } - (void)setTheme:(STPTheme *)theme { @@ -84,7 +83,6 @@ - (void)updateAppearance { STPTheme *navBarTheme = self.navigationController.navigationBar.stp_theme ?: self.theme; [self.navigationItem.leftBarButtonItem stp_setTheme:navBarTheme]; [self.navigationItem.rightBarButtonItem stp_setTheme:navBarTheme]; - [self.backItem stp_setTheme:navBarTheme]; [self.cancelItem stp_setTheme:navBarTheme]; self.view.backgroundColor = self.theme.primaryBackgroundColor; @@ -94,10 +92,6 @@ - (void)updateAppearance { - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - - if (![self stp_isAtRootOfNavigationController]) { - self.stp_navigationItemProxy.leftBarButtonItem = self.backItem; - } } - (void)viewWillDisappear:(BOOL)animated { @@ -112,7 +106,7 @@ - (UIStatusBarStyle)preferredStatusBarStyle { : UIStatusBarStyleLightContent); } -- (void)handleBackOrCancelTapped:(__unused id)sender { +- (void)handleCancelTapped:(__unused id)sender { if ([self stp_isAtRootOfNavigationController]) { // if we're the root of the navigation controller, we've been presented modally. [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; @@ -123,5 +117,8 @@ - (void)handleBackOrCancelTapped:(__unused id)sender { } } +- (BOOL)useSystemBackButton { + return NO; +} @end diff --git a/Stripe/STPImageLibrary+Private.h b/Stripe/STPImageLibrary+Private.h index 437582a7f2a..96b80e35781 100644 --- a/Stripe/STPImageLibrary+Private.h +++ b/Stripe/STPImageLibrary+Private.h @@ -14,7 +14,6 @@ NS_ASSUME_NONNULL_BEGIN @interface STPImageLibrary (Private) + (UIImage *)addIcon; -+ (UIImage *)leftChevronIcon; + (UIImage *)checkmarkIcon; + (UIImage *)largeCardFrontImage; + (UIImage *)largeCardBackImage; @@ -26,9 +25,6 @@ NS_ASSUME_NONNULL_BEGIN template:(BOOL)isTemplate; + (UIImage *)imageWithTintColor:(UIColor *)color forImage:(UIImage *)image; -+ (UIImage *)paddedImageWithInsets:(UIEdgeInsets)insets - forImage:(UIImage *)image; - @end NS_ASSUME_NONNULL_END diff --git a/Stripe/STPImageLibrary.m b/Stripe/STPImageLibrary.m index da02a648ede..2929957f3db 100644 --- a/Stripe/STPImageLibrary.m +++ b/Stripe/STPImageLibrary.m @@ -80,10 +80,6 @@ + (UIImage *)addIcon { return [self safeImageNamed:@"stp_icon_add" templateIfAvailable:YES]; } -+ (UIImage *)leftChevronIcon { - return [self safeImageNamed:@"stp_icon_chevron_left" templateIfAvailable:YES]; -} - + (UIImage *)checkmarkIcon { return [self safeImageNamed:@"stp_icon_checkmark" templateIfAvailable:YES]; } @@ -162,17 +158,4 @@ + (UIImage *)imageWithTintColor:(UIColor *)color return newImage; } -+ (UIImage *)paddedImageWithInsets:(UIEdgeInsets)insets - forImage:(UIImage *)image { - CGSize size = CGSizeMake(image.size.width + insets.left + insets.right, - image.size.height + insets.top + insets.bottom); - UIGraphicsBeginImageContextWithOptions(size, NO, image.scale); - CGPoint origin = CGPointMake(insets.left, insets.top); - [image drawAtPoint:origin]; - UIImage *imageWithInsets = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - imageWithInsets = [imageWithInsets imageWithRenderingMode:image.renderingMode]; - return imageWithInsets; -} - @end diff --git a/Stripe/STPPaymentMethodsInternalViewController.m b/Stripe/STPPaymentMethodsInternalViewController.m index 5c11df72517..ea48a1427f9 100644 --- a/Stripe/STPPaymentMethodsInternalViewController.m +++ b/Stripe/STPPaymentMethodsInternalViewController.m @@ -168,7 +168,7 @@ - (void)updateWithPaymentMethodTuple:(STPPaymentMethodTuple *)tuple { #pragma mark - Button Handlers -- (void)handleBackOrCancelTapped:(__unused id)sender { +- (void)handleCancelTapped:(__unused id)sender { [self.delegate internalViewControllerDidCancel]; } diff --git a/Stripe/STPShippingAddressViewController.m b/Stripe/STPShippingAddressViewController.m index 066201d9fc0..a6fe42f3b9b 100644 --- a/Stripe/STPShippingAddressViewController.m +++ b/Stripe/STPShippingAddressViewController.m @@ -204,7 +204,7 @@ - (void)setLoading:(BOOL)loading { } } -- (void)handleBackOrCancelTapped:(__unused id)sender { +- (void)handleCancelTapped:(__unused id)sender { [self.delegate shippingAddressViewControllerDidCancel:self]; } diff --git a/Stripe/STPShippingMethodsViewController.m b/Stripe/STPShippingMethodsViewController.m index e085ce23bfc..bff792a4995 100644 --- a/Stripe/STPShippingMethodsViewController.m +++ b/Stripe/STPShippingMethodsViewController.m @@ -88,6 +88,10 @@ - (void)done:(__unused id)sender { [self.delegate shippingMethodsViewController:self didFinishWithShippingMethod:self.selectedShippingMethod]; } +- (BOOL)useSystemBackButton { + return YES; +} + #pragma mark - UITableView - (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView { diff --git a/Stripe/UIBarButtonItem+Stripe.h b/Stripe/UIBarButtonItem+Stripe.h index 6698979c1e0..b411561225e 100644 --- a/Stripe/UIBarButtonItem+Stripe.h +++ b/Stripe/UIBarButtonItem+Stripe.h @@ -14,11 +14,6 @@ NS_ASSUME_NONNULL_BEGIN @interface UIBarButtonItem (Stripe) -+ (instancetype)stp_backButtonItemWithTitle:(NSString *)title - style:(UIBarButtonItemStyle)style - target:(id)target - action:(SEL)action; - - (void)stp_setTheme:(STPTheme *)theme; @end diff --git a/Stripe/UIBarButtonItem+Stripe.m b/Stripe/UIBarButtonItem+Stripe.m index 5913089c58f..89b72f47155 100644 --- a/Stripe/UIBarButtonItem+Stripe.m +++ b/Stripe/UIBarButtonItem+Stripe.m @@ -14,22 +14,6 @@ @implementation UIBarButtonItem (Stripe) -+ (instancetype)stp_backButtonItemWithTitle:(NSString *)title - style:(UIBarButtonItemStyle)style - target:(id)target - action:(SEL)action { - UIBarButtonItem *item = [[self alloc] initWithTitle:title - style:style - target:target - action:action]; - UIImage *chevron = [STPImageLibrary leftChevronIcon]; - CGFloat yPadding = (30 - chevron.size.height) / 2; - UIImage *paddedChevron = [STPImageLibrary paddedImageWithInsets:UIEdgeInsetsMake(yPadding, 0, yPadding, 30) - forImage:chevron]; - [item setBackgroundImage:paddedChevron forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - return item; -} - - (void)stp_setTheme:(STPTheme *)theme { UIImage *image = [self backgroundImageForState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; if (image) { diff --git a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testChinese@2x.png b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testChinese@2x.png index 5c5b38b72bc..6819146bcc1 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 0194275e133..af3ce4b1a09 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 1c904ce7934..c9d9f201099 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 507cc044a87..17f89db1202 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 69108bc6e59..d92c77b5147 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 2efa10395ec..17de6543d00 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 9b9dcca773b..1f95c772b2d 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 35aaab8b6bd..e9993e51367 100644 Binary files a/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testSpanish@2x.png and b/Tests/ReferenceImages_64/STPShippingMethodsViewControllerLocalizationTests/testSpanish@2x.png differ