Skip to content

BundleSandboxEnvironmentDetector: fixed logic for macOS#2176

Merged
NachoSoto merged 1 commit into
mainfrom
catalyst-sandbox-url
Dec 20, 2022
Merged

BundleSandboxEnvironmentDetector: fixed logic for macOS#2176
NachoSoto merged 1 commit into
mainfrom
catalyst-sandbox-url

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

I found out today that when running PurchaseTester on macOS (either native or with Catalyst), the SDK was sending X-Is-Sandbox = true.
The new examples in MockBundle illustrate this.

I found out today that when running `PurchaseTester` on `macOS` (either native or with Catalyst), the SDK was sending `X-Is-Sandbox` = `true`.
The new examples in `MockBundle` illustrate this.
@NachoSoto NachoSoto added the pr:fix A bug fix label Dec 20, 2022
@NachoSoto NachoSoto requested a review from a team December 20, 2022 17:51
Comment on lines +37 to +40
// `true` for either `macOS` or `Catalyst`
let isMASReceipt = path.contains("MASReceipt/receipt")
if isMASReceipt {
return path.contains("Xcode/DerivedData")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OOOHHHH right, great catch!

could this just be simplified to "if contains sandbox or Xcode/DerivedData"? Feels like we wouldn't get a false positive, right?

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.

That would be a false positive for iOS as well. This is an example receipt URL for the iOS simulator:

/Users/nachosoto/Library/Developer/Xcode/DerivedData/RevenueCat-areulmnbtfydolgoennnwogndmkr/Build/Products/Debug-iphonesimulator/UnitTests.xctest/base64encodedreceiptsample1.txt

So we need to only do that for macOS. I think we should hardcode the least amount of strings though, in case this changes in the future, but I believe we can't simplify it more than this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ohhhh simulator, right. I'm so used to testing on device that I forgot 😅

@NachoSoto NachoSoto merged commit 6e7066b into main Dec 20, 2022
@NachoSoto NachoSoto deleted the catalyst-sandbox-url branch December 20, 2022 22:33
NachoSoto pushed a commit that referenced this pull request Dec 21, 2022
**This is an automatic release.**

### Bugfixes
* `ErrorUtils.purchasesError(withUntypedError:)`: handle `PublicError`s
(#2165) via NachoSoto (@NachoSoto)
* Fixed race condition finishing `SK1` transactions (#2148) via
NachoSoto (@NachoSoto)
* `IntroEligibilityStatus`: added `CustomStringConvertible`
implementation (#2182) via NachoSoto (@NachoSoto)
* `BundleSandboxEnvironmentDetector`: fixed logic for `macOS` (#2176)
via NachoSoto (@NachoSoto)
* Fixed `AttributionFetcher.adServicesToken` hanging when called in
simulator (#2157) via NachoSoto (@NachoSoto)
### Other Changes
* `Purchase Tester`: added ability to purchase products directly with
`StoreKit` (#2172) via NachoSoto (@NachoSoto)
* `DNSChecker`: simplified `NetworkError` initialization (#2166) via
NachoSoto (@NachoSoto)
* `Purchases` initialization: refactor to avoid multiple concurrent
instances in memory (#2180) via NachoSoto (@NachoSoto)
* `Purchase Tester`: added button to clear messages on logger view
(#2179) via NachoSoto (@NachoSoto)
* `NetworkOperation`: added assertion to ensure that subclasses call
completion (#2138) via NachoSoto (@NachoSoto)
* `CacheableNetworkOperation`: avoid unnecessarily creating operations
for cache hits (#2135) via NachoSoto (@NachoSoto)
* `PurchaseTester`: fixed `macOS` support (#2175) via NachoSoto
(@NachoSoto)
* `IntroEligibilityCalculator`: added log including `AppleReceipt`
(#2181) via NachoSoto (@NachoSoto)
* `Purchase Tester`: fixed scene manifest (#2170) via NachoSoto
(@NachoSoto)
* `HTTPClientTests`: refactored to use `waitUntil` (#2168) via NachoSoto
(@NachoSoto)
* `Integration Tests`: split up tests in smaller files (#2158) via
NachoSoto (@NachoSoto)
* `StoreKitRequestFetcher`: removed unnecessary dispatch (#2152) via
NachoSoto (@NachoSoto)
* `Purchase Tester`: added companion `watchOS` app (#2140) via NachoSoto
(@NachoSoto)
* `StoreKit1Wrapper`: added warning if receiving too many updated
transactions (#2117) via NachoSoto (@NachoSoto)
* `StoreKitTestHelpers`: cleaned up unnecessary log (#2177) via
NachoSoto (@NachoSoto)
* `TrialOrIntroPriceEligibilityCheckerSK1Tests`: use `waitUntilValue`
(#2173) via NachoSoto (@NachoSoto)
* `DNSChecker`: added log with resolved host (#2167) via NachoSoto
(@NachoSoto)
* `MagicWeatherSwiftUI`: updated `README` to point to workspace (#2142)
via NachoSoto (@NachoSoto)
* `Purchase Tester`: fixed `.storekit` config file reference (#2171) via
NachoSoto (@NachoSoto)
* `Purchase Tester`: fixed error alerts (#2169) via NachoSoto
(@NachoSoto)
* `CI`: don't make releases until `release-checks` pass (#2162) via
NachoSoto (@NachoSoto)
* `Fastfile`: changed `match` to `readonly` (#2161) via NachoSoto
(@NachoSoto)
NachoSoto added a commit that referenced this pull request Nov 9, 2023
NachoSoto added a commit that referenced this pull request Nov 9, 2023
NachoSoto added a commit that referenced this pull request Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants