@ -17,8 +17,10 @@ import { getEnvironmentType } from '../../../app/scripts/lib/util'
import actionConstants from './actionConstants'
import actionConstants from './actionConstants'
let background = null
let background = null
let promisifiedBackground = null
export function _setBackgroundConnection ( backgroundConnection ) {
export function _setBackgroundConnection ( backgroundConnection ) {
background = backgroundConnection
background = backgroundConnection
promisifiedBackground = pify ( background )
}
}
export function goHome ( ) {
export function goHome ( ) {
@ -301,9 +303,9 @@ export function importNewAccount (strategy, args) {
dispatch ( showLoadingIndication ( 'This may take a while, please be patient.' ) )
dispatch ( showLoadingIndication ( 'This may take a while, please be patient.' ) )
try {
try {
log . debug ( ` background.importAccountWithStrategy ` )
log . debug ( ` background.importAccountWithStrategy ` )
await pify ( b ackground . importAccountWithStrategy ) . call ( background , strategy , args )
await promisifiedB ackground . importAccountWithStrategy ( strategy , args )
log . debug ( ` background.getState ` )
log . debug ( ` background.getState ` )
newState = await pify ( b ackground . getState ) . call ( background )
newState = await promisifiedB ackground . getState ( )
} catch ( err ) {
} catch ( err ) {
dispatch ( hideLoadingIndication ( ) )
dispatch ( hideLoadingIndication ( ) )
dispatch ( displayWarning ( err . message ) )
dispatch ( displayWarning ( err . message ) )
@ -1874,7 +1876,7 @@ export function setCompletedOnboarding () {
dispatch ( showLoadingIndication ( ) )
dispatch ( showLoadingIndication ( ) )
try {
try {
await pify ( b ackground . completeOnboarding ) . call ( background )
await promisifiedB ackground . completeOnboarding ( )
} catch ( err ) {
} catch ( err ) {
dispatch ( displayWarning ( err . message ) )
dispatch ( displayWarning ( err . message ) )
throw err
throw err
@ -2426,7 +2428,7 @@ export function setRequestAccountTabIds (requestAccountTabIds) {
export function getRequestAccountTabIds ( ) {
export function getRequestAccountTabIds ( ) {
return async ( dispatch ) => {
return async ( dispatch ) => {
const requestAccountTabIds = await pify ( b ackground . getRequestAccountTabIds ) . call ( background )
const requestAccountTabIds = await promisifiedB ackground . getRequestAccountTabIds ( )
dispatch ( setRequestAccountTabIds ( requestAccountTabIds ) )
dispatch ( setRequestAccountTabIds ( requestAccountTabIds ) )
}
}
}
}
@ -2440,7 +2442,7 @@ export function setOpenMetamaskTabsIDs (openMetaMaskTabIDs) {
export function getOpenMetamaskTabsIds ( ) {
export function getOpenMetamaskTabsIds ( ) {
return async ( dispatch ) => {
return async ( dispatch ) => {
const openMetaMaskTabIDs = await pify ( b ackground . getOpenMetamaskTabsIds ) . call ( background )
const openMetaMaskTabIDs = await promisifiedB ackground . getOpenMetamaskTabsIds ( )
dispatch ( setOpenMetamaskTabsIDs ( openMetaMaskTabIDs ) )
dispatch ( setOpenMetamaskTabsIDs ( openMetaMaskTabIDs ) )
}
}
}
}