diff --git a/.gitignore b/.gitignore index f059326928..bc8242701d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,4 @@ DerivedData xcuserdata/ - +jazzy/* diff --git a/.jazzy.yaml b/.jazzy.yaml new file mode 100644 index 0000000000..72e3fd1c8e --- /dev/null +++ b/.jazzy.yaml @@ -0,0 +1,12 @@ +objc: true +clean: true +author: Stripe +author_url: https://stripe.com +github_url: https://github.com/stripe/stripe-ios +github_file_prefix: https://github.com/stripe/stripe-ios/tree/master +umbrella_header: Stripe/PublicHeaders/Stripe.h +framework_root: . +module: Stripe +skip_undocumented: true +hide_documentation_coverage: true +theme: fullwidth diff --git a/README.md b/README.md index 796a8bdb1f..d7c1a4497a 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Our SDK is compatible with iOS apps supporting iOS 7.0 and above. It requires Xc We've written a [guide](https://stripe.com/docs/mobile/ios) that explains everything from installation, to creating payment tokens, to Apple Pay integration and more. +For more fine-grained information on all of the classes and methods in our SDK, consult our [full SDK reference](http://stripe.github.io/stripe-ios/docs/index.html). + ## Example apps There are 2 example apps included in the repository: diff --git a/Stripe.xcodeproj/project.pbxproj b/Stripe.xcodeproj/project.pbxproj index 4ef5fe09c2..0e54ad0c3c 100644 --- a/Stripe.xcodeproj/project.pbxproj +++ b/Stripe.xcodeproj/project.pbxproj @@ -162,6 +162,7 @@ 04633B151CD4521F009D4FB5 /* STPAPIClient+ApplePay.m in Sources */ = {isa = PBXBuildFile; fileRef = 04633B041CD44F1C009D4FB5 /* STPAPIClient+ApplePay.m */; }; 04633B161CD45222009D4FB5 /* STPAPIClient+ApplePay.h in Headers */ = {isa = PBXBuildFile; fileRef = 04633B061CD44F47009D4FB5 /* STPAPIClient+ApplePay.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04633B171CD45437009D4FB5 /* STPCategoryLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 04633B0A1CD44F6C009D4FB5 /* STPCategoryLoader.m */; }; + 04633B1A1CD7BF29009D4FB5 /* strip-frameworks.sh in Resources */ = {isa = PBXBuildFile; fileRef = 04633B191CD7BF29009D4FB5 /* strip-frameworks.sh */; }; 04695AD31C77F9DB00E08063 /* NSString+Stripe.h in Headers */ = {isa = PBXBuildFile; fileRef = 04695AD11C77F9DB00E08063 /* NSString+Stripe.h */; }; 04695AD41C77F9DB00E08063 /* NSString+Stripe.m in Sources */ = {isa = PBXBuildFile; fileRef = 04695AD21C77F9DB00E08063 /* NSString+Stripe.m */; }; 04695AD91C77F9EF00E08063 /* STPDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04695AD51C77F9EF00E08063 /* STPDelegateProxy.h */; }; @@ -455,6 +456,7 @@ 04633B0A1CD44F6C009D4FB5 /* STPCategoryLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STPCategoryLoader.m; sourceTree = ""; }; 04633B0B1CD44F6C009D4FB5 /* Stripe+ApplePay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Stripe+ApplePay.m"; sourceTree = ""; }; 04633B101CD44F78009D4FB5 /* Stripe+ApplePay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Stripe+ApplePay.h"; path = "PublicHeaders/Stripe+ApplePay.h"; sourceTree = ""; }; + 04633B191CD7BF29009D4FB5 /* strip-frameworks.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "strip-frameworks.sh"; sourceTree = ""; }; 04695AD11C77F9DB00E08063 /* NSString+Stripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Stripe.h"; sourceTree = ""; }; 04695AD21C77F9DB00E08063 /* NSString+Stripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Stripe.m"; sourceTree = ""; }; 04695AD51C77F9EF00E08063 /* STPDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STPDelegateProxy.h; sourceTree = ""; }; @@ -780,6 +782,7 @@ 04B33F2F1BC7414C00DD8120 /* Supporting Files */ = { isa = PBXGroup; children = ( + 04633B191CD7BF29009D4FB5 /* strip-frameworks.sh */, 04B33F301BC7417B00DD8120 /* Info.plist */, ); name = "Supporting Files"; @@ -807,8 +810,8 @@ 04CDB4C31A5F30A700B854EE /* STPAPIClient.m */, 04633B081CD44F6C009D4FB5 /* PKPayment+Stripe.h */, 04633B091CD44F6C009D4FB5 /* PKPayment+Stripe.m */, - 04633B0B1CD44F6C009D4FB5 /* Stripe+ApplePay.m */, 04633B101CD44F78009D4FB5 /* Stripe+ApplePay.h */, + 04633B0B1CD44F6C009D4FB5 /* Stripe+ApplePay.m */, 04633B061CD44F47009D4FB5 /* STPAPIClient+ApplePay.h */, 04633B041CD44F1C009D4FB5 /* STPAPIClient+ApplePay.m */, C124A16E1CCA968B007D42EE /* STPAnalyticsClient.h */, @@ -1293,6 +1296,7 @@ 0438EFB81B741C2800D506CC /* stp_card_diners@2x.png in Resources */, C11810C31CC7DA290022FB55 /* stp_card_form_front@3x.png in Resources */, 0438EFAA1B741C2800D506CC /* stp_card_cvc.png in Resources */, + 04633B1A1CD7BF29009D4FB5 /* strip-frameworks.sh in Resources */, C11810C11CC7DA290022FB55 /* stp_card_form_front.png in Resources */, 0438EFAC1B741C2800D506CC /* stp_card_cvc@2x.png in Resources */, 0438EFCC1B741C2800D506CC /* stp_card_mastercard@3x.png in Resources */, diff --git a/Stripe/PublicHeaders/STPAPIClient+ApplePay.h b/Stripe/PublicHeaders/STPAPIClient+ApplePay.h index b95bb9a53b..6eb09ce5da 100644 --- a/Stripe/PublicHeaders/STPAPIClient+ApplePay.h +++ b/Stripe/PublicHeaders/STPAPIClient+ApplePay.h @@ -13,6 +13,9 @@ #define FAUXPAS_IGNORED_IN_FILE(...) FAUXPAS_IGNORED_IN_FILE(APIAvailability) +/** + * STPAPIClient extensions to create Stripe tokens from Apple Pay PKPayment objects. + */ @interface STPAPIClient (ApplePay) /** diff --git a/Stripe/PublicHeaders/STPAPIClient.h b/Stripe/PublicHeaders/STPAPIClient.h index 838b1f643d..a4b4102198 100644 --- a/Stripe/PublicHeaders/STPAPIClient.h +++ b/Stripe/PublicHeaders/STPAPIClient.h @@ -70,6 +70,9 @@ typedef void (^STPTokenCompletionBlock)(STPToken * __nullable token, NSError * _ #pragma mark Bank Accounts +/** + * STPAPIClient extensions to create Stripe tokens from bank accounts. + */ @interface STPAPIClient (BankAccounts) /** @@ -84,6 +87,9 @@ typedef void (^STPTokenCompletionBlock)(STPToken * __nullable token, NSError * _ #pragma mark Credit Cards +/** + * STPAPIClient extensions to create Stripe tokens from credit or debit cards. + */ @interface STPAPIClient (CreditCards) /** diff --git a/Stripe/PublicHeaders/Stripe+ApplePay.h b/Stripe/PublicHeaders/Stripe+ApplePay.h index 7056eb73f3..5fd79aff14 100644 --- a/Stripe/PublicHeaders/Stripe+ApplePay.h +++ b/Stripe/PublicHeaders/Stripe+ApplePay.h @@ -16,6 +16,9 @@ FAUXPAS_IGNORED_IN_FILE(APIAvailability) @class Stripe; +/** + * Convenience methods for working with Apple Pay. + */ @interface Stripe (ApplePay) /** diff --git a/Stripe/strip-frameworks.sh b/Stripe/strip-frameworks.sh new file mode 100755 index 0000000000..80814abba5 --- /dev/null +++ b/Stripe/strip-frameworks.sh @@ -0,0 +1,72 @@ +################################################################################ +# +# Copyright 2015 Realm Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# This script strips all non-valid architectures from dynamic libraries in +# the application's `Frameworks` directory. +# +# The following environment variables are required: +# +# BUILT_PRODUCTS_DIR +# FRAMEWORKS_FOLDER_PATH +# VALID_ARCHS +# EXPANDED_CODE_SIGN_IDENTITY + + +# Signs a framework with the provided identity +code_sign() { + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1" + /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" +} + +# Set working directory to product’s embedded frameworks +cd "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +if [ "$ACTION" = "install" ]; then + echo "Copy .bcsymbolmap files to .xcarchive" + find . -name '*.bcsymbolmap' -type f -exec mv {} "${CONFIGURATION_BUILD_DIR}" \; +else + # Delete *.bcsymbolmap files from framework bundle unless archiving + find . -name '*.bcsymbolmap' -type f -exec rm -rf "{}" +\; +fi + +echo "Stripping frameworks" + +for file in $(find . -type f -perm +111); do + # Skip non-dynamic libraries + if ! [[ "$(file "$file")" == *"dynamically linked shared library"* ]]; then + continue + fi + # Get architectures for current file + archs="$(lipo -info "${file}" | rev | cut -d ':' -f1 | rev)" + stripped="" + for arch in $archs; do + if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$file" "$file" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" != "" ]]; then + echo "Stripped $file of architectures:$stripped" + if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then + code_sign "${file}" + fi + fi +done diff --git a/ci_scripts/build_documentation.sh b/ci_scripts/build_documentation.sh new file mode 100755 index 0000000000..8f716efe9d --- /dev/null +++ b/ci_scripts/build_documentation.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +rm -rf docs + +./jazzy/bin/jazzy \ + --config .jazzy.yaml \ + --output "docs" diff --git a/ci_scripts/install_jazzy.sh b/ci_scripts/install_jazzy.sh new file mode 100755 index 0000000000..f61c542725 --- /dev/null +++ b/ci_scripts/install_jazzy.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Install jazzy + +rm -rf jazzy +git clone --depth 1 --branch master https://github.com/realm/jazzy/ +cd jazzy +bundle install +cd ..