Conversation
Use AppTransaction.environment (iOS 16+) as the primary sandbox detection method, falling back to the receipt URL path check for older iOS versions. The previous approach only checked Bundle.main.appStoreReceiptURL for "sandboxReceipt", which could return false for apps using Stripe or other non-StoreKit payment methods, including during App Review. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AppTransaction.environment(iOS 16+) as the primary sandbox detection method inDeviceHelper.detectSandbox(), with the existing receipt URL path check as a fallback for older iOS versions.Bundle.main.appStoreReceiptURLfor"sandboxReceipt", which could incorrectly returnfalsefor apps using Stripe or other non-StoreKit payment methods — including during App Review.AppTransaction.sharedcall already made inReceiptManager.setAppTransactionId()to also capture the environment, avoiding any additional async work.Checklist
CHANGELOG.mdfor any breaking changes, enhancements, or bug fixes.swiftlintin the main directory and fixed any issues.🤖 Generated with Claude Code
Greptile Summary
This PR fixes incorrect sandbox detection for apps using Stripe or other non-StoreKit payment methods. The previous approach only checked the receipt URL path for
"sandboxReceipt", which would return false for apps without StoreKit receipts - even during App Review or TestFlight.The fix leverages
AppTransaction.environment(available on iOS 16+) as the primary detection method, with the receipt URL check as a fallback for older iOS versions or whenAppTransactiondata isn't available yet. This is captured in a new static propertyReceiptManager.isSandboxEnvironmentthat's set during initialization.Key changes:
ReceiptManager.isSandboxEnvironmentstatic property set fromAppTransaction.sharedDeviceHelper.detectSandbox()to check this property before falling back to receipt URLThe implementation is clean and follows the existing pattern used by
appTransactionIdandappIdstatic properties.Confidence Score: 5/5
AppTransaction.environment(iOS 16+) as the primary sandbox detection method while maintaining backward compatibility with the receipt URL fallback. The logic is sound, follows existing patterns in the codebase, and includes appropriate tests and documentation.Important Files Changed
Last reviewed commit: 77138ea