Skip to content

Commit

Permalink
feat(27256): address better demonstration of featureFlag and error ha…
Browse files Browse the repository at this point in the history
…ndling
  • Loading branch information
DDDDDanica committed Nov 28, 2024
1 parent e1c605a commit a2b12b6
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 24 deletions.
11 changes: 10 additions & 1 deletion app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ export function setupController(
controller.setupTrustedCommunication(portStream, remotePort.sender);

// initialize the request to fetch remote feature flags
controller.remoteFeatureFlagController.updateRemoteFeatureFlags();
initializeRemoteFeatureFlags();

if (processName === ENVIRONMENT_TYPE_POPUP) {
openPopupCount += 1;
Expand Down Expand Up @@ -1096,6 +1096,15 @@ export function setupController(
}
}

function initializeRemoteFeatureFlags() {
try {
// initialize the request to fetch remote feature flags
controller.remoteFeatureFlagController.updateRemoteFeatureFlags();
} catch (error) {
log.error('Error initializing remote feature flags:', error);
}
}

function getPendingApprovalCount() {
try {
let pendingApprovalCount =
Expand Down
4 changes: 0 additions & 4 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2384,12 +2384,8 @@
}
},
"@metamask/remote-feature-flag-controller": {
"globals": {
"console.error": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/utils": true,
"cockatiel": true
}
},
Expand Down
4 changes: 0 additions & 4 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2384,12 +2384,8 @@
}
},
"@metamask/remote-feature-flag-controller": {
"globals": {
"console.error": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/utils": true,
"cockatiel": true
}
},
Expand Down
4 changes: 0 additions & 4 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2384,12 +2384,8 @@
}
},
"@metamask/remote-feature-flag-controller": {
"globals": {
"console.error": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/utils": true,
"cockatiel": true
}
},
Expand Down
4 changes: 0 additions & 4 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2476,12 +2476,8 @@
}
},
"@metamask/remote-feature-flag-controller": {
"globals": {
"console.error": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/utils": true,
"cockatiel": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
"@metamask/providers": "^18.2.0",
"@metamask/queued-request-controller": "^7.0.1",
"@metamask/rate-limit-controller": "^6.0.0",
"@metamask/remote-feature-flag-controller": "file:../core/packages/remote-feature-flag-controller",
"@metamask/remote-feature-flag-controller": "^1.0.0",
"@metamask/rpc-errors": "^7.0.0",
"@metamask/safe-event-emitter": "^3.1.1",
"@metamask/scure-bip39": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/settings/info-tab/info-tab.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class InfoTab extends PureComponent {
componentDidMount() {
const { t } = this.context;
handleSettingsRefs(t, t('about'), this.settingsRefs);
if (this.props.remoteFeatureFlags.length > 0) {
if (!this.props.remoteFeatureFlags.testBooleanFlag) {
// eslint-disable-next-line no-console
console.log(
'Feature flag fetched successfully',
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6299,14 +6299,14 @@ __metadata:
languageName: node
linkType: hard

"@metamask/remote-feature-flag-controller@file:../core/packages/remote-feature-flag-controller::locator=metamask-crx%40workspace%3A.":
version: 0.0.0
resolution: "@metamask/remote-feature-flag-controller@file:../core/packages/remote-feature-flag-controller#../core/packages/remote-feature-flag-controller::hash=b9c79c&locator=metamask-crx%40workspace%3A."
"@metamask/remote-feature-flag-controller@npm:^1.0.0":
version: 1.0.0
resolution: "@metamask/remote-feature-flag-controller@npm:1.0.0"
dependencies:
"@metamask/base-controller": "npm:^7.0.2"
"@metamask/utils": "npm:^10.0.0"
cockatiel: "npm:^3.1.2"
checksum: 10/ca6c43b375dcc1cc2a53a8d3bbbbfabed622b43ec85fe3958f0ffff60935f0f02cea9ed3f23c3f985cfd4515c9b4c8c5a4e1210ef2208ffda867bf8f1d9d3c08
checksum: 10/2e66724b6c0387210d106ede0128f934f6175b3656e1cc7734341dd443c3423c6a6cf9a4ca0d84ff5ea89897af6f3068b4f262a8ab9db647524f00f7d6bb4ed4
languageName: node
linkType: hard

Expand Down Expand Up @@ -26792,7 +26792,7 @@ __metadata:
"@metamask/providers": "npm:^18.2.0"
"@metamask/queued-request-controller": "npm:^7.0.1"
"@metamask/rate-limit-controller": "npm:^6.0.0"
"@metamask/remote-feature-flag-controller": "file:../core/packages/remote-feature-flag-controller"
"@metamask/remote-feature-flag-controller": "npm:^1.0.0"
"@metamask/rpc-errors": "npm:^7.0.0"
"@metamask/safe-event-emitter": "npm:^3.1.1"
"@metamask/scure-bip39": "npm:^2.0.3"
Expand Down

0 comments on commit a2b12b6

Please sign in to comment.