Skip to content

Conversation

@ajpallares
Copy link
Contributor

Description

  • Improves sandbox environment detection reliability by using AppTransaction.environment on iOS 16+ instead of relying solely on the receipt file path
  • The environment is fetched asynchronously at SDK initialization and cached for synchronous access
  • Falls back to legacy receipt path-based detection on older OS versions or if AppTransaction is unavailable

@emerge-tools
Copy link

emerge-tools bot commented Jan 29, 2026

📸 Snapshot Test

2 modified, 240 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester
0 0 2 0 240 0 ⏳ Needs approval

🛸 Powered by Emerge Tools

@ajpallares
Copy link
Contributor Author

@RCGitBot please test

Copy link
Contributor

@fire-at-will fire-at-will left a comment

Choose a reason for hiding this comment

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

Looking good! A few questions/comments, but I think this is on the right track :D

…(now it's only cached by `SandboxEnvironmentDetector`)
@ajpallares ajpallares marked this pull request as ready for review January 29, 2026 16:03
@ajpallares ajpallares requested a review from a team as a code owner January 29, 2026 16:03
@claude
Copy link

claude bot commented Jan 29, 2026


Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


@ajpallares
Copy link
Contributor Author

@RCGitBot please test

@ajpallares
Copy link
Contributor Author

@RCGitBot please test

Copy link
Member

@rickvdl rickvdl left a comment

Choose a reason for hiding this comment

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

Nice work! 🙌

///
/// On iOS 16+, this attempts to use `AppTransaction.environment` for more reliable detection.
/// On older OS versions (and in case of failure to retrieve), it falls back to checking the receipt file path.
final class SandboxEnvironmentDetector: SandboxEnvironmentDetectorType {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if it helps much but for simplification we could have one SandboxEnvironmentDetector hold on to two specific implementations that also conform to SandboxEnvironmentDetectorType, one for the legacy code path and one for SK2. We could test them easily in isolation as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. We could do that. Honestly, I though about doing it like that initially but thought it might be overcomplicating things... I don't have a strong opinion though

Copy link
Member

Choose a reason for hiding this comment

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

Can also understand that reasoning. If it's a clean cut behind the protocol it might be worth it, if you need to implement specifics it might indeed be overcomplicating it. Not a strong opinion either :)

let environment = await transactionFetcher.appTransactionEnvironment
self.cachedAppTransactionEnvironment.value = environment
}
// Task.detached {
Copy link
Member

Choose a reason for hiding this comment

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

Tracking

@fire-at-will
Copy link
Contributor

@RCGitBot please test

ajpallares and others added 2 commits January 30, 2026 18:32
* [TEMP]: only run the CI that we want to run

* only await when AppTransaction is available

* decrease timeout from 10s -> 3s

* dont run tests when on ios version that they shouldnt be run on

* swiftlint

* test fixes

* compilation fix

* test fix

* Revert "[TEMP]: only run the CI that we want to run"

This reverts commit 9aa0b2c.
fire-at-will and others added 2 commits January 30, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants