<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict'

const appConstants = require('../../../js/constants/appConstants')
const {makeImmutable} = require('../../common/state/immutableUtil')
const locale = require('../../locale')
const appActions = require('../../../js/actions/appActions')
const {ipcMain} = require('electron')
const messages = require('../../../js/constants/messages')
const settings = require('../../../js/constants/settings')
const getSetting = require('../../../js/settings').getSetting
const tabActions = require('../../common/actions/tabActions')
const tabState = require('../../common/state/tabState')
const config = require('../../../js/constants/config')
const {getOrigin} = require('../../../js/state/siteUtil')

let notificationCallbacks = []

const dappReducer = (state, action, immutableAction) => {
  action = immutableAction || makeImmutable(action)
  switch (action.get('actionType')) {
    case appConstants.APP_DAPP_AVAILABLE:
      if (!getSetting(settings.METAMASK_ENABLED)) {
        showDappNotification(action.get('location'))
      }
      break
  }
  return state
}

const notifications = {
  text: {
    greeting: locale.translation('updateHello'),
    enable: locale.translation('dappEnableExtension'),
    dismiss: locale.translation('dappDismiss')
  }
}

process.on('extension-ready', (installInfo) => {
  if (installInfo.id === config.metamaskExtensionId) {
    tabActions.reload(tabState.TAB_ID_ACTIVE, true)
  }
})

const showDappNotification = (location) => {
  const origin = getOrigin(location)<commit_msg>fix wrong path for method in dappReducer.js Auditors: @bbondy, @kjozwiak see b3f61ee Fix #11541<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict'

const appConstants = require('../../../js/constants/appConstants')
const {makeImmutable} = require('../../common/state/immutableUtil')
const locale = require('../../locale')
const appActions = require('../../../js/actions/appActions')
const {ipcMain} = require('electron')
const messages = require('../../../js/constants/messages')
const settings = require('../../../js/constants/settings')
const getSetting = require('../../../js/settings').getSetting
const tabActions = require('../../common/actions/tabActions')
const tabState = require('../../common/state/tabState')
const config = require('../../../js/constants/config')
const {getOrigin} = require('../../../js/lib/urlutil')

let notificationCallbacks = []

const dappReducer = (state, action, immutableAction) => {
  action = immutableAction || makeImmutable(action)
  switch (action.get('actionType')) {
    case appConstants.APP_DAPP_AVAILABLE:
      if (!getSetting(settings.METAMASK_ENABLED)) {
        showDappNotification(action.get('location'))
      }
      break
  }
  return state
}

const notifications = {
  text: {
    greeting: locale.translation('updateHello'),
    enable: locale.translation('dappEnableExtension'),
    dismiss: locale.translation('dappDismiss')
  }
}

process.on('extension-ready', (installInfo) => {
  if (installInfo.id === config.metamaskExtensionId) {
    tabActions.reload(tabState.TAB_ID_ACTIVE, true)
  }
})

const showDappNotification = (location) => {
  const origin = getOrigin(location)
{'fraction_non_alphanumeric': 0.17215189873417722, 'fraction_numerical': 0.00450070323488045, 'mean_word_length': 3.81190798376184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1865590', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1044, 'n_words': 242}