Skip to content
Closed
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: 4 additions & 1 deletion platforms/android/scripts/check_license_headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
files = []

Find.find('.') do |path|
next if path.include?('build/generated')
if File.directory?(path) && ['.gradle', 'build'].include?(File.basename(path))
Find.prune
end

next unless File.file?(path) && path.end_with?('.kt')

lines = File.readlines(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
hostingController?.view.frame = bounds
}

// Deprecated in iOS 17 — superseded by registerForTraitChanges in setupView().
// Remove this override when dropping iOS 16 support.
/// Deprecated in iOS 17 — superseded by registerForTraitChanges in setupView().
/// Remove this override when dropping iOS 16 support.
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if #unavailable(iOS 17.0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@ class RCTShopifyCheckoutKit: RCTEventEmitter {
hasListeners = false
}

// TODO: re-enable when iOS CheckoutDelegate (or equivalent) lands upstream
// TODO: re-enable when iOS CheckoutDelegate (or equivalent) lands upstream -
// parallels Android's DefaultCheckoutListener.onCheckoutCanceled / onCheckoutFailed.
// Until then, the JS "error" and "close" events stay declared in supportedEvents()
// but native never emits them.
/*

func shouldRecoverFromError(error: CheckoutError) -> Bool {
return error.isRecoverable
}
func shouldRecoverFromError(error: CheckoutError) -> Bool {
return error.isRecoverable
}

func checkoutDidFail(error: CheckoutError) {
guard hasListeners else { return }
func checkoutDidFail(error: CheckoutError) {
guard hasListeners else { return }

sendEvent(withName: "error", body: ShopifyEventSerialization.serialize(checkoutError: error))
}
sendEvent(withName: "error", body: ShopifyEventSerialization.serialize(checkoutError: error))
}

func checkoutDidCancel() {
DispatchQueue.main.async {
if self.hasListeners {
self.sendEvent(withName: "close", body: nil)
}
func checkoutDidCancel() {
DispatchQueue.main.async {
if self.hasListeners {
self.sendEvent(withName: "close", body: nil)
}

self.checkoutSheet?.dismiss(animated: true)
}
}
self.checkoutSheet?.dismiss(animated: true)
}
}

func checkoutDidEmitWebPixelEvent(event _: PixelEvent) {}
*/
func checkoutDidEmitWebPixelEvent(event _: PixelEvent) {}
*/

@objc override func constantsToExport() -> [AnyHashable: Any]! {
return [
Expand Down Expand Up @@ -150,7 +150,7 @@ class RCTShopifyCheckoutKit: RCTEventEmitter {
}
}

@objc func preload(_ checkoutURL: String) {
@objc func preload(_: String) {
// Public native preload support is not exposed by the local iOS SDK.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function BuyerIdentityDetails({
if (authenticated) {
return (
<View style={styles.sectionFooter}>
<Text style={[styles.sectionFooterText, {color: '#f5a623'}]}>
<Text style={[styles.sectionFooterText, styles.warningText]}>
Changing Buyer Identity will log you out.
</Text>
<View style={styles.detailRow}>
Expand Down Expand Up @@ -538,6 +538,9 @@ function createStyles(colors: Colors) {
fontSize: 12,
color: '#007AFF',
},
warningText: {
color: '#f5a623',
},
});
}

Expand Down
38 changes: 27 additions & 11 deletions platforms/react-native/scripts/lint_swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

DIR=modules/@shopify/checkout-kit-react-native
MODE="${1:-check}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)"
SWIFT_TOOLS_DIR="$REPO_ROOT/platforms/swift"

# Validate the mode
if [[ "$MODE" != "check" && "$MODE" != "fix" ]]; then
Expand All @@ -16,20 +19,33 @@ fi
print_install_instructions() {
echo "🔧 FIX:"
echo " Shopify employee? Run 'dev up'"
echo " Not a Shopify employee? Install via homebrew:"
echo " - SwiftLint: 'brew install swiftlint' / https://github.com/realm/SwiftLint"
echo " - SwiftFormat: 'brew install swiftformat' / https://github.com/nicklockwood/SwiftFormat"
echo " Not a Shopify employee? Install Mint and run 'mint bootstrap' from platforms/swift"
echo " Homebrew also works: 'brew install swiftlint swiftformat'"
}

# Check for SwiftLint
if ! which swiftlint >/dev/null; then
resolve_tool() {
local command_name=$1

if which "$command_name" >/dev/null; then
which "$command_name"
return 0
fi

if command -v mint >/dev/null; then
(cd "$SWIFT_TOOLS_DIR" && mint which "$command_name")
return $?
fi

return 1
}

if ! SWIFTLINT="$(resolve_tool swiftlint)"; then
echo "⚠️ WARN: SwiftLint not installed"
print_install_instructions
exit 1
fi

# Check for SwiftFormat
if ! which swiftformat >/dev/null; then
if ! SWIFTFORMAT="$(resolve_tool swiftformat)"; then
echo "⚠️ WARN: SwiftFormat not installed"
print_install_instructions
exit 1
Expand All @@ -38,23 +54,23 @@ fi
# Run SwiftLint
if [[ "$MODE" == "check" ]]; then
echo "🔄 Running SwiftLint in check mode..."
swiftlint lint --strict $DIR --config .swiftlint.yml
"$SWIFTLINT" lint --strict $DIR --config .swiftlint.yml
LINT_STATUS=$?
else
echo "🔄 Running SwiftLint in fix mode..."
swiftlint lint --fix $DIR --config .swiftlint.yml
"$SWIFTLINT" lint --fix $DIR --config .swiftlint.yml
LINT_STATUS=$?
fi
echo "SwiftLint exit status: $LINT_STATUS"

# Run SwiftFormat
if [[ "$MODE" == "check" ]]; then
echo "🔄 Running SwiftFormat in check mode..."
swiftformat $DIR --lint --config .swiftformat
"$SWIFTFORMAT" $DIR --lint --config .swiftformat
FORMAT_STATUS=$?
else
echo "🔄 Running SwiftFormat in fix mode..."
swiftformat $DIR --config .swiftformat
"$SWIFTFORMAT" $DIR --config .swiftformat
FORMAT_STATUS=$?
fi
echo "SwiftFormat exit status: $FORMAT_STATUS"
Expand Down
3 changes: 2 additions & 1 deletion platforms/swift/Scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ if [[ "$MODE" == "check" && "$SKIP_POD" == "false" ]]; then
# platforms/swift/ and protocol/languages/swift/. Run lint from the
# repo root.
REPO_ROOT="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
export BUNDLE_GEMFILE="${BUNDLE_GEMFILE:-$REPO_ROOT/platforms/swift/Gemfile}"
POD_LOG=""
if [[ "$VERBOSE" == "true" ]]; then
(cd "$REPO_ROOT" && bundle exec pod lib lint ShopifyCheckoutKit.podspec --allow-warnings)
Expand All @@ -188,7 +189,7 @@ if [[ "$MODE" == "check" && "$SKIP_POD" == "false" ]]; then

echo "❌ CocoaPods lint exit status: $POD_STATUS"
echo "❌ CocoaPods detected issues that need to be fixed."
echo "🔧 Run 'bundle exec pod lib lint ShopifyCheckoutKit.podspec --allow-warnings --verbose' from the repo root for details"
echo "🔧 Run 'BUNDLE_GEMFILE=platforms/swift/Gemfile bundle exec pod lib lint ShopifyCheckoutKit.podspec --allow-warnings --verbose' from the repo root for details"
exit 1
fi

Expand Down
Loading