Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable feature Flag Values with Scope Based on "threshold" #12627

Merged
merged 25 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a76dd4c
metro bundler: use local module
joaoloureirop Dec 10, 2024
d25ef6e
dev env: ignore ts errors
joaoloureirop Dec 11, 2024
877699c
engine: fetch metametrics id before engine init
joaoloureirop Dec 11, 2024
7ffa266
feature flag controller: use metaMetricsId
joaoloureirop Dec 11, 2024
8769485
use promise to get metametrics id
joaoloureirop Dec 12, 2024
d0e7eb9
remove dev code
joaoloureirop Dec 12, 2024
6406624
getMetaMetricsId as a sync function
joaoloureirop Jan 8, 2025
9f285b5
Merge branch 'main' into feat/feature-flag-threshold
joaoloureirop Jan 8, 2025
e93b201
add metametricsid to redux
joaoloureirop Jan 13, 2025
9aa427d
bump @metamask/remote-feature-flag-controller
joaoloureirop Jan 15, 2025
edc0a1e
Merge branch 'main' into feat/feature-flag-threshold
joaoloureirop Jan 15, 2025
d44068e
revert indents
joaoloureirop Jan 15, 2025
3b9aecf
Merge branch 'main' into feat/feature-flag-threshold
joaoloureirop Jan 15, 2025
dee7b47
dedupe
joaoloureirop Jan 15, 2025
a77adcf
fix feature flag controller unit tests
joaoloureirop Jan 15, 2025
a81f019
fix linter & sagas tests
joaoloureirop Jan 15, 2025
e6324fd
fix typo
joaoloureirop Jan 15, 2025
00af125
snapshot
joaoloureirop Jan 15, 2025
b75a525
handle metametrics init failure
joaoloureirop Jan 16, 2025
b7f31b2
revert metro transform changes
joaoloureirop Jan 16, 2025
2b9f807
revert nav app changes
joaoloureirop Jan 16, 2025
dc631d1
fix unit tests
joaoloureirop Jan 16, 2025
3d4cdbd
revert redux metametricsId setup
joaoloureirop Jan 17, 2025
4d7c9b7
pass metaMetricsId into Engine contructor
joaoloureirop Jan 17, 2025
8afed80
Merge branch 'main' into feat/feature-flag-threshold
joaoloureirop Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/core/Engine/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ export class Engine {
allowedEvents: [],
}),
disabled: !isBasicFunctionalityToggleEnabled(),
getMetaMetricsId: MetaMetrics.getInstance().getMetaMetricsId(),
NicolasMassart marked this conversation as resolved.
Show resolved Hide resolved
});

console.log('controller', remoteFeatureFlagController);
NicolasMassart marked this conversation as resolved.
Show resolved Hide resolved
const phishingController = new PhishingController({
messenger: this.controllerMessenger.getRestricted({
name: 'PhishingController',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { RemoteFeatureFlagControllerMessenger, RemoteFeatureFlagControllerState

export interface RemoteFeatureFlagInitParamTypes {
state?: RemoteFeatureFlagControllerState;
messenger: RemoteFeatureFlagControllerMessenger,
disabled: boolean
messenger: RemoteFeatureFlagControllerMessenger;
disabled: boolean;
getMetaMetricsId: Promise<string | undefined>;
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import Logger from '../../../../util/Logger';

import { RemoteFeatureFlagInitParamTypes } from './types';
import { uuidv4 } from '@walletconnect/utils';

const getFeatureFlagAppEnvironment = () => {
const env = process.env.METAMASK_ENVIRONMENT;
Expand All @@ -33,12 +34,14 @@ export const createRemoteFeatureFlagController = ({
state,
messenger,
disabled,
getMetaMetricsId,
}: RemoteFeatureFlagInitParamTypes) => {

const remoteFeatureFlagController = new RemoteFeatureFlagController({
messenger,
state,
disabled,
getMetaMetricsId,
NicolasMassart marked this conversation as resolved.
Show resolved Hide resolved
clientConfigApiService: new ClientConfigApiService({
fetch,
config: {
Expand Down
18 changes: 18 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,35 @@
const { getDefaultConfig } = require('expo/metro-config');
const { mergeConfig } = require('@react-native/metro-config');

const path = require("path");

const featureFlagModuleDir = path.resolve(__dirname, "../../core/feature-flags/packages/remote-feature-flag-controller");

const extraNodeModules = {
"@metamask/remote-feature-flag-controller": featureFlagModuleDir,
};

const watchFolders = [
featureFlagModuleDir,
];

module.exports = function (baseConfig) {
const defaultConfig = mergeConfig(baseConfig, getDefaultConfig(__dirname));
const {
resolver: { assetExts, sourceExts },
} = defaultConfig;

return mergeConfig(defaultConfig, {
watchFolders,
resolver: {
assetExts: assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg', 'cjs', 'mjs'],
resolverMainFields: ['sbmodern', 'react-native', 'browser', 'main'],
extraNodeModules: new Proxy (extraNodeModules, {
get: (target, name) =>
name in target ? target[name] : path.join(process.cwd(), `node_modules/${name}`),
}),
unstable_enableSymlinks: true,
joaoloureirop marked this conversation as resolved.
Show resolved Hide resolved
},
transformer: {
babelTransformerPath: require.resolve('./metro.transform.js'),
Expand Down
3 changes: 0 additions & 3 deletions metro.transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ module.exports.transform = async ({ src, filename, options }) => {
active: getBuildTypeFeatures(),
});

if (didModify) {
await lintTransformedFile(getESLintInstance(), filename, processedSource);
}
joaoloureirop marked this conversation as resolved.
Show resolved Hide resolved
return defaultTransformer.transform({
src: processedSource,
filename,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"@metamask/react-native-payments": "^2.0.0",
"@metamask/react-native-search-api": "1.0.1",
"@metamask/react-native-webview": "^14.0.4",
"@metamask/remote-feature-flag-controller": "^1.0.0",
"@metamask/remote-feature-flag-controller": "link:../../core/feature-flags/packages/remote-feature-flag-controller",
joaoloureirop marked this conversation as resolved.
Show resolved Hide resolved
"@metamask/rpc-errors": "^7.0.1",
"@metamask/scure-bip39": "^2.1.0",
"@metamask/sdk-communication-layer": "0.29.0-wallet",
Expand Down
11 changes: 3 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5191,14 +5191,9 @@
escape-string-regexp "^4.0.0"
invariant "2.2.4"

"@metamask/remote-feature-flag-controller@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@metamask/remote-feature-flag-controller/-/remote-feature-flag-controller-1.0.0.tgz#048162eaa6fa34401cfbabfa0eb33f0255bb2945"
integrity sha512-jrjEQhW/RdHQ/GQbgXH97N6YqDUW7nGA40lEr0TUSIhJVVaHDX0gCiNmJZcQ89yLY4DZ0bisEwjrCu8LycYiQQ==
dependencies:
"@metamask/base-controller" "^7.0.2"
"@metamask/utils" "^10.0.0"
cockatiel "^3.1.2"
"@metamask/remote-feature-flag-controller@link:../../core/feature-flags/packages/remote-feature-flag-controller":
version "0.0.0"
uid ""

"@metamask/[email protected]", "@metamask/rpc-errors@^6.2.1", "@metamask/rpc-errors@^6.3.1", "@metamask/rpc-errors@^7.0.0", "@metamask/rpc-errors@^7.0.1":
version "7.0.1"
Expand Down
Loading