Skip to content

Commit

Permalink
more fencing adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
hmalik88 committed Sep 18, 2023
1 parent ebfa26a commit 63cbe75
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createEngineStream } from 'json-rpc-middleware-stream';
import { providerAsMiddleware } from '@metamask/eth-json-rpc-middleware';
import {
debounce,
///: BEGIN:ONLY_INCLUDE_IN(build-main)
///: BEGIN:ONLY_INCLUDE_IN(snaps)
throttle,
///: END:ONLY_INCLUDE_IN
} from 'lodash';
Expand Down Expand Up @@ -228,6 +228,7 @@ import { securityProviderCheck } from './lib/security-provider-helpers';
import { IndexedDBPPOMStorage } from './lib/ppom/indexed-db-backend';
///: END:ONLY_INCLUDE_IN
import { updateCurrentLocale } from './translate';
import { HandlerType } from '@metamask/snaps-utils';

export const METAMASK_CONTROLLER_EVENTS = {
// Fired after state changes that impact the extension badge (unapproved msg count)
Expand Down Expand Up @@ -1879,7 +1880,7 @@ export default class MetamaskController extends EventEmitter {
}
///: END:ONLY_INCLUDE_IN

///: BEGIN:ONLY_INCLUDE_IN(build-main)
///: BEGIN:ONLY_INCLUDE_IN(snaps)
/**
* Tracks snaps export usage. Note: This function is throttled to 1 call per 60 seconds.
*
Expand Down Expand Up @@ -1912,8 +1913,12 @@ export default class MetamaskController extends EventEmitter {
*/
handleSnapRequest(args) {
// we're not tracking at this point in flask because we eagerly fetch insights in v2
///: BEGIN:ONLY_INCLUDE_IN(build-main)
this._trackSnapExportUsage(args.snapId, args.handler);
///: BEGIN:ONLY_INCLUDE_IN(build-flask)
if (args.handler !== HandlerType.OnTransaction) {
///: END:ONLY_INCLUDE_IN
this._trackSnapExportUsage(args.snapId, args.handler);
///: BEGIN:ONLY_INCLUDE_IN(build-flask)
}
///: END:ONLY_INCLUDE_IN

return this.controllerMessenger.call('SnapController:handleRequest', args);
Expand Down

0 comments on commit 63cbe75

Please sign in to comment.