Skip to content

Commit

Permalink
feat: Remove 'Improved transactions requests' toggle (#29695)
Browse files Browse the repository at this point in the history
<!--
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**

We [recently enabled the transaction redesign for all users by
default](#28321). We
also [migrated some existing e2e tests to corresponding e2e tests for
redesigned
flows](#28780).

This PR removes the toggle that allowed users to opt out of the
redesigned confirmations. It also removes the e2e tests for old
confirmation flows that are no longer visible in any scenario.

<!--
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?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29695?quickstart=1)

## **Related issues**

Fixes: MetaMask/MetaMask-planning#3030

## **Manual testing steps**

1. Open experimental settings.
2. The option toggle shouldn't be there.
3. Create a new transaction confirmation
4. It should be redesigned.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/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.
  • Loading branch information
pedronfigueiredo authored Jan 16, 2025
1 parent 5786e7a commit 66c994a
Show file tree
Hide file tree
Showing 81 changed files with 4,901 additions and 12,872 deletions.
6 changes: 0 additions & 6 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/scripts/constants/sentry-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export const SENTRY_BACKGROUND_STATE = {
autoLockTimeLimit: true,
hideZeroBalanceTokens: true,
redesignedConfirmationsEnabled: true,
redesignedTransactionsEnabled: false,
isRedesignedConfirmationsDeveloperEnabled: false,
showExtensionInFullSizeView: true,
showFiatInTestnets: true,
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/controllers/preferences-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,6 @@ describe('preferences controller', () => {
hideZeroBalanceTokens: false,
petnamesEnabled: true,
redesignedConfirmationsEnabled: true,
redesignedTransactionsEnabled: true,
shouldShowAggregatedBalancePopover: true,
featureNotificationsEnabled: false,
isRedesignedConfirmationsDeveloperEnabled: false,
Expand Down Expand Up @@ -757,7 +756,6 @@ describe('preferences controller', () => {
petnamesEnabled: true,
privacyMode: false,
redesignedConfirmationsEnabled: true,
redesignedTransactionsEnabled: true,
shouldShowAggregatedBalancePopover: true,
featureNotificationsEnabled: false,
isRedesignedConfirmationsDeveloperEnabled: false,
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/controllers/preferences-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export type Preferences = {
hideZeroBalanceTokens: boolean;
petnamesEnabled: boolean;
redesignedConfirmationsEnabled: boolean;
redesignedTransactionsEnabled: boolean;
featureNotificationsEnabled: boolean;
showMultiRpcModal: boolean;
privacyMode: boolean;
Expand Down Expand Up @@ -223,7 +222,6 @@ export const getDefaultPreferencesControllerState =
hideZeroBalanceTokens: false,
petnamesEnabled: true,
redesignedConfirmationsEnabled: true,
redesignedTransactionsEnabled: true,
featureNotificationsEnabled: false,
isRedesignedConfirmationsDeveloperEnabled: false,
showConfirmationAdvancedDetails: false,
Expand Down
1 change: 0 additions & 1 deletion app/scripts/lib/transaction/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const mockTransactionMetricsRequest = {
trackEvent: jest.fn(),
getIsSmartTransaction: jest.fn(),
getSmartTransactionByMinedTxHash: jest.fn(),
getRedesignedTransactionsEnabled: jest.fn(),
getMethodData: jest.fn(),
getIsRedesignedConfirmationsDeveloperEnabled: jest.fn(),
getIsConfirmationAdvancedDetailsOpen: jest.fn(),
Expand Down
3 changes: 0 additions & 3 deletions app/scripts/lib/transaction/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export type TransactionMetricsRequest = {
getSmartTransactionByMinedTxHash: (
txhash: string | undefined,
) => SmartTransaction;
getRedesignedTransactionsEnabled: () => boolean;
getMethodData: (data: string) => Promise<{ name: string }>;
getIsRedesignedConfirmationsDeveloperEnabled: () => boolean;
getIsConfirmationAdvancedDetailsOpen: () => boolean;
Expand Down Expand Up @@ -1024,8 +1023,6 @@ async function buildEventFragmentProperties({

const isRedesignedForTransaction = shouldUseRedesignForTransactions({
transactionMetadataType: transactionMeta.type as TransactionType,
isRedesignedTransactionsUserSettingEnabled:
transactionMetricsRequest.getRedesignedTransactionsEnabled(),
isRedesignedConfirmationsDeveloperEnabled:
transactionMetricsRequest.getIsRedesignedConfirmationsDeveloperEnabled(),
});
Expand Down
7 changes: 0 additions & 7 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6665,11 +6665,6 @@ export default class MetamaskController extends EventEmitter {
.redesignedConfirmationsEnabled;
}

isTransactionsRedesignEnabled() {
return this.preferencesController.state.preferences
.redesignedTransactionsEnabled;
}

isConfirmationRedesignDeveloperEnabled() {
return this.preferencesController.state.preferences
.isRedesignedConfirmationsDeveloperEnabled;
Expand Down Expand Up @@ -6861,8 +6856,6 @@ export default class MetamaskController extends EventEmitter {
},
getRedesignedConfirmationsEnabled:
this.isConfirmationRedesignEnabled.bind(this),
getRedesignedTransactionsEnabled:
this.isTransactionsRedesignEnabled.bind(this),
getMethodData: (data) => {
if (!data) {
return null;
Expand Down
79 changes: 79 additions & 0 deletions app/scripts/migrations/138.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { migrate, version } from './138';

const oldVersion = 137;

describe(`migration #${version}`, () => {
it('updates the version metadata', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {},
};
const newStorage = await migrate(oldStorage);
expect(newStorage.meta).toStrictEqual({ version });
});

describe(`migration #${version}`, () => {
it('removes the redesignedTransactionsEnabled preference if it is set to true', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
PreferencesController: {
preferences: {
redesignedTransactionsEnabled: true,
},
},
},
};
const expectedData = {
PreferencesController: {
preferences: {},
},
};
const newStorage = await migrate(oldStorage);

expect(newStorage.data).toStrictEqual(expectedData);
});

it('removes the redesignedTransactionsEnabled preference if it is set to false', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
PreferencesController: {
preferences: {
redesignedTransactionsEnabled: false,
},
},
},
};
const expectedData = {
PreferencesController: {
preferences: {},
},
};
const newStorage = await migrate(oldStorage);

expect(newStorage.data).toStrictEqual(expectedData);
});

it('does nothing to other PreferencesController state if there is not a redesignedTransactionsEnabled preference', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
PreferencesController: {
existingPreference: true,
},
},
};

const expectedData = {
PreferencesController: {
existingPreference: true,
},
};

const newStorage = await migrate(oldStorage);

expect(newStorage.data).toStrictEqual(expectedData);
});
});
});
Loading

0 comments on commit 66c994a

Please sign in to comment.