Commit 7c18fb0
authored
feat(ramp): add activation keys to all non-prod envs (#20781)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
This pull request updates the environment handling logic in the
`app/components/UI/Ramp/Aggregator/sdk/index.tsx` module to more
accurately distinguish between production and non-production builds. The
changes improve how the application determines wether Activation Keys
settings are displayed or not and which callback URL to use, refining
the conditions for development and internal builds.
**Environment detection improvements:**
* Added the `Environment` import from the SDK and introduced a new
`isProduction` flag based on the current SDK environment, making
production detection more robust.
* Refactored the logic for `isDevelopmentOrInternalBuild` to include
cases where the environment is not production, ensuring non-production
features are enabled more consistently.
**Callback URL selection:**
* Updated the `callbackBaseUrl` export to use the new `isProduction`
flag, ensuring that the correct callback URL is chosen based on the
refined environment detection.
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-2711
## **Manual testing steps**
```gherkin
Feature: Buy/Sell Activation Keys
Scenario: user sets activation keys
Given the app is a non-prod build
When user goes to Buy & Sell settings
Then activation keys UI is displayed
Scenario: user can't see activation keys
Given the app is a prod build
When user goes to Buy & Sell settings
Then activation keys UI is not displayed
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
N/A, this is reflected on production builds.
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refines prod/non-prod detection using SDK `Environment`, updates
`callbackBaseUrl` selection, and aligns activation keys gating with the
new logic.
>
> - **Ramp Aggregator SDK**:
> - Refine environment detection by importing `Environment`, deriving
`environment` via `getSdkEnvironment()`, adding `isProduction`, and
updating `isDevelopmentOrInternalBuild` to include non-production
environments.
> - Switch `callbackBaseUrl` selection to use `isProduction`, choosing
prod vs UAT endpoints accordingly.
> - Initialize SDK with derived `environment` and existing mobile
`context`; keep verbose tied to development.
> - Activation keys gating now follows updated
`isDevelopmentOrInternalBuild` logic.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8063a1e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent d3f922f commit 7c18fb0
1 file changed
+9
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| |||
0 commit comments