Skip to content

Commit 8021ab9

Browse files
committed
chore: update feature flag
1 parent 7701868 commit 8021ab9

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

ui/selectors/multichain-accounts/feature-flags.ts

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from '../remote-feature-flags';
55

66
/**
7-
*
7+
* Feature flag type for multichain accounts features
88
*/
99
export type MultichainAccountsFeatureFlag = {
1010
enabled: boolean;
@@ -24,7 +24,7 @@ const FEATURE_VERSION_2 = '2';
2424
* @param version2 - The second version string to compare.
2525
* @returns boolean - True if version1 is greater than or equal to version2, false otherwise.
2626
*/
27-
const compareVersions = (version1: string, version2: string) => {
27+
export const compareVersions = (version1: string, version2: string) => {
2828
const regex = /^\d+\.\d+\.\d+$/u;
2929
if (!regex.test(version1) || !regex.test(version2)) {
3030
return false; // Invalid version format
@@ -57,37 +57,44 @@ const compareVersions = (version1: string, version2: string) => {
5757
export const getIsMultichainAccountsState1Enabled = (
5858
state: RemoteFeatureFlagsState,
5959
) => {
60-
const { enableMultichainAccounts } = getRemoteFeatureFlags(state);
61-
const { enabled, featureVersion, minimumVersion } =
62-
enableMultichainAccounts as MultichainAccountsFeatureFlag;
63-
return (
64-
enabled &&
65-
featureVersion &&
66-
minimumVersion &&
67-
featureVersion === FEATURE_VERSION_1 &&
68-
// @ts-expect-error - we can ignore the error for passing MINIMUM_SUPPORTED_VERSION as null
69-
compareVersions(minimumVersion, MINIMUM_SUPPORTED_VERSION)
70-
);
60+
return false;
61+
62+
// TODO: Uncomment this section and update the value of MINIMUM_SUPPORTED_VERSION
63+
// to use the remote feature flags for multichain accounts state 1.
64+
65+
// const { enabled, featureVersion, minimumVersion } =
66+
// enableMultichainAccounts as MultichainAccountsFeatureFlag;
67+
// return (
68+
// enabled &&
69+
// featureVersion &&
70+
// minimumVersion &&
71+
// featureVersion === FEATURE_VERSION_1 &&
72+
// compareVersions(minimumVersion, MINIMUM_SUPPORTED_VERSION)
73+
// );
7174
};
7275

7376
/**
74-
* Checks if the multichain accounts feature is enabled for state 1.
77+
* Checks if the multichain accounts feature is enabled for state 2.
7578
*
7679
* @param state - The MetaMask state object
77-
* @returns boolean - True if the feature is enabled for state 1, false otherwise.
80+
* @returns boolean - True if the feature is enabled for state 2, false otherwise.
7881
*/
7982
export const getIsMultichainAccountsState2Enabled = (
8083
state: RemoteFeatureFlagsState,
8184
) => {
82-
const { enableMultichainAccounts } = getRemoteFeatureFlags(state);
83-
const { enabled, featureVersion, minimumVersion } =
84-
enableMultichainAccounts as MultichainAccountsFeatureFlag;
85-
return (
86-
enabled &&
87-
featureVersion &&
88-
minimumVersion &&
89-
featureVersion === FEATURE_VERSION_2 &&
90-
// @ts-expect-error - we can ignore the error for passing MINIMUM_SUPPORTED_VERSION as null
91-
compareVersions(minimumVersion, MINIMUM_SUPPORTED_VERSION)
92-
);
85+
return false;
86+
87+
// TODO: Uncomment this section and update the value of MINIMUM_SUPPORTED_VERSION
88+
// to use the remote feature flags for multichain accounts state 2.
89+
90+
// const { enableMultichainAccounts } = getRemoteFeatureFlags(state);
91+
// const { enabled, featureVersion, minimumVersion } =
92+
// enableMultichainAccounts as MultichainAccountsFeatureFlag;
93+
// return (
94+
// enabled &&
95+
// featureVersion &&
96+
// minimumVersion &&
97+
// featureVersion === FEATURE_VERSION_2 &&
98+
// compareVersions(minimumVersion, MINIMUM_SUPPORTED_VERSION)
99+
// );
93100
};

0 commit comments

Comments
 (0)