Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/actions/install-cocoapods/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ runs:
with:
path: |
sample/ios/Pods
key: ${{ runner.os }}-cocoapods-ruby-${{ inputs.ruby-version }}-${{ hashFiles('sample/ios/Podfile.lock', 'sample/Gemfile.lock', 'package.json', 'sample/package.json', 'modules/@shopify/checkout-sheet-kit/package.json', 'yarn.lock') }}
key: ${{ runner.os }}-cocoapods-ruby-${{ inputs.ruby-version }}-${{ hashFiles('sample/ios/Podfile.lock', 'sample/Gemfile.lock', 'sample/Gemfile', 'package.json', 'sample/package.json', 'modules/@shopify/checkout-sheet-kit/package.json', 'yarn.lock') }}

- name: Install cocoapods
if: steps.cache-cocoapods.outputs.cache-hit != 'true'
shell: bash
env:
NO_FLIPPER: "1"
Expand All @@ -36,5 +35,5 @@ runs:
cd sample
bundle install
cd ios
NO_FLIPPER=1 bundle exec pod install --deployment --repo-update
bundle exec pod install --deployment --repo-update
cd $ROOT
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,5 @@ jobs:
ruby-version: ${{ env.RUBY_VERSION }}

- name: Run Swift tests
timeout-minutes: 15
# If turbo has already cached the build it will return instantly here
run: |
yarn turbo run test:ios --cache-dir=".turbo" --no-daemon
yarn sample test:ios
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ disabled_rules:
- opening_brace
- function_body_length
- trailing_comma
- function_parameter_count

opt_in_rules:
- array_init
Expand Down
3 changes: 2 additions & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ up:

packages:
- xcode
- swiftlint

check:
lint_swift: yarn module lint:swift
lint_swift: ./scripts/lint_swift
lint_module: yarn module lint
lint_sample: yarn sample lint

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Pod::Spec.new do |s|
s.source_files = "ios/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency "ShopifyCheckoutSheetKit", "~> 3.3.0"
s.dependency "ShopifyCheckoutSheetKit", "~> 3.4.0-rc.5"
s.dependency "ShopifyCheckoutSheetKit/AcceleratedCheckouts", "~> 3.4.0-rc.5"

if fabric_enabled
install_modules_dependencies(s)
Expand All @@ -38,5 +39,5 @@ Pod::Spec.new do |s|
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
end
end
end
29 changes: 29 additions & 0 deletions modules/@shopify/checkout-sheet-kit/ios/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BasedOnStyle: LLVM
Language: ObjC
UseTab: Never
IndentWidth: 2
ContinuationIndentWidth: 2
ColumnLimit: 120

# Keep long macro calls (e.g., RCT_EXTERN_METHOD) readable
AlignAfterOpenBracket: DontAlign
BinPackArguments: false
BinPackParameters: false
PenaltyBreakBeforeFirstCallParameter: 200
ReflowComments: false

# Objective-C specifics
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
ObjCBreakBeforeNestedBlockParam: true
PointerAlignment: Left
BreakBeforeBraces: Attach
SpaceBeforeParens: ControlStatements
SortIncludes: false

# Treat common React Native macros as statements for nicer wrapping
StatementMacros:
- RCT_EXTERN_METHOD
- RCT_EXTERN_MODULE
- RCT_EXPORT_VIEW_PROPERTY

Comment on lines +1 to +29

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helps with the formatting of the .mm files

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
MIT License

Copyright 2023 - Present, Shopify Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import _PassKit_SwiftUI
import Foundation
import PassKit
import SwiftUI

// MARK: - Apple Pay Button

@available(iOS 16.0, *)
extension PayWithApplePayButtonLabel {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The native PayWithApplePayButtonLabel export from PassKit is a struct with static properties. It is unfortunately not an enum which can be initialized from a rawValue

static func from(_ string: String?, fallback: PayWithApplePayButtonLabel = .plain) -> PayWithApplePayButtonLabel {
guard let string else {
return fallback
}
return map[string] ?? .plain
}

init?(fromString string: String?) {
guard let string,
let label = Self.map[string]
else {
return nil
}
self = label
}

private static let map: [String: PayWithApplePayButtonLabel] = [
"addMoney": .addMoney,
"book": .book,
"buy": .buy,
"checkout": .checkout,
"continue": .continue,
"contribute": .contribute,
"donate": .donate,
"inStore": .inStore,
"order": .order,
"plain": .plain,
"reload": .reload,
"rent": .rent,
"setUp": .setUp,
"subscribe": .subscribe,
"support": .support,
"tip": .tip,
"topUp": .topUp
]
}
Loading
Loading