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: allow override remote feature flags #13156

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions app/components/hooks/MinimumVersions/useMinimumVersions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
import { InteractionManager } from 'react-native';
import { SecurityState } from '../../../reducers/security';
import { RootState } from '../../../reducers';
import { selectAppMinimumBuild } from '../../../selectors/featureFlagController/minimumAppVersion';

Check failure on line 9 in app/components/hooks/MinimumVersions/useMinimumVersions.tsx

View workflow job for this annotation

GitHub Actions / scripts (lint)

'/home/runner/work/metamask-mobile/metamask-mobile/app/selectors/featureFlagController/minimumAppVersion/index.ts' imported multiple times
import { selectMobileMinimumVersions } from '../../../selectors/featureFlagController/minimumAppVersion';

Check failure on line 10 in app/components/hooks/MinimumVersions/useMinimumVersions.tsx

View workflow job for this annotation

GitHub Actions / scripts (lint)

'../../../selectors/featureFlagController/minimumAppVersion' import is duplicated

Check failure on line 10 in app/components/hooks/MinimumVersions/useMinimumVersions.tsx

View workflow job for this annotation

GitHub Actions / scripts (lint)

'/home/runner/work/metamask-mobile/metamask-mobile/app/selectors/featureFlagController/minimumAppVersion/index.ts' imported multiple times

const useMinimumVersions = () => {
const { automaticSecurityChecksEnabled }: SecurityState = useSelector(
(state: RootState) => state.security,
);

const appMinimumBuild = useSelector((state: RootState) => selectAppMinimumBuild(state));
const ffValues = useSelector((state: RootState) => selectMobileMinimumVersions(state));
console.log('feature flag values', ffValues);

Check failure on line 19 in app/components/hooks/MinimumVersions/useMinimumVersions.tsx

View workflow job for this annotation

GitHub Actions / scripts (lint)

Unexpected console statement
const currentBuildNumber = Number(getBuildNumber());
const navigation = useNavigation();
const shouldTriggerUpdateFlow =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@
messenger,
disabled,
}: RemoteFeatureFlagInitParamTypes) => {
const overrideMode = process.env.OVERRIDE_FEATURE_FLAGS;
const controllerState = overrideMode ? {} : state;

console.log('override value', overrideMode);

Check failure on line 40 in app/core/Engine/controllers/RemoteFeatureFlagController/utils.ts

View workflow job for this annotation

GitHub Actions / scripts (lint)

Unexpected console statement
console.log('controllerState', controllerState);

Check failure on line 41 in app/core/Engine/controllers/RemoteFeatureFlagController/utils.ts

View workflow job for this annotation

GitHub Actions / scripts (lint)

Unexpected console statement

const remoteFeatureFlagController = new RemoteFeatureFlagController({
messenger,
state,
state: controllerState,
disabled,
clientConfigApiService: new ClientConfigApiService({
fetch,
Expand All @@ -48,8 +54,12 @@
}),
});

//

if (disabled) {
Logger.log('Feature flag controller disabled');
} else if (overrideMode) {
Logger.log('Remote feature flags override activated');
} else {
remoteFeatureFlagController.updateRemoteFeatureFlags().then(() => {
Logger.log('Feature flags updated');
Expand Down
Loading