diff --git a/app/filtering.js b/app/filtering.js index a09918b14b7..0a581c20bae 100644 --- a/app/filtering.js +++ b/app/filtering.js @@ -571,13 +571,13 @@ function initForPartition (partition) { fn(ses, partition, module.exports.isPrivate(partition)) }) ses.on('register-navigator-handler', (e, protocol, location) => { - appActions.navigatorHandler(ses.partition, protocol, location, true) + appActions.navigatorHandlerRegistered(ses.partition, protocol, location) }) ses.on('unregister-navigator-handler', (e, protocol, location) => { - appActions.navigatorHandler(ses.partition, protocol, location, false) + appActions.navigatorHandlerUnregistered(ses.partition, protocol, location) }) ses.protocol.getNavigatorHandlers().forEach((handler) => { - appActions.navigatorHandler(ses.partition, handler.protocol, handler.location, true) + appActions.navigatorHandlerRegistered(ses.partition, handler.protocol, handler.location) }) } diff --git a/app/ledger.js b/app/ledger.js index efcd19779b5..e2bab38d3c7 100644 --- a/app/ledger.js +++ b/app/ledger.js @@ -232,8 +232,13 @@ const doAction = (action) => { setTimeout(networkConnected, 1 * msecs.second) break - case appConstants.APP_NAVIGATOR_HANDLER_UPDATE: - ledgerInfo.hasBitcoinHandler = (action.register && action.protocol === 'bitcoin') + case appConstants.APP_NAVIGATOR_HANDLER_REGISTERED: + ledgerInfo.hasBitcoinHandler = (action.protocol === 'bitcoin') + appActions.updateLedgerInfo(underscore.omit(ledgerInfo, [ '_internal' ])) + break + + case appConstants.APP_NAVIGATOR_HANDLER_UNREGISTERED: + ledgerInfo.hasBitcoinHandler = false appActions.updateLedgerInfo(underscore.omit(ledgerInfo, [ '_internal' ])) break diff --git a/docs/appActions.md b/docs/appActions.md index dc7b8e34739..1db6bd31460 100644 --- a/docs/appActions.md +++ b/docs/appActions.md @@ -764,9 +764,9 @@ Update the detail object for the open alert/confirm/prompt (triggers re-render) -### navigatorHandler(partition, protocol, location, register) +### navigatorHandlerRegistered(partition, protocol, location) -Action triggered by navigation handler +Action triggered by registering navigation handler **Parameters** @@ -776,7 +776,19 @@ Action triggered by navigation handler **location**: `string`, location where handler was triggered -**register**: `boolean`, true if event was registered or false if unregistered + + +### navigatorHandlerUnregistered(partition, protocol, location) + +Action triggered by un-registering navigation handler + +**Parameters** + +**partition**: `string`, session partition + +**protocol**: `string`, navigator protocol + +**location**: `string`, location where handler was triggered diff --git a/js/actions/appActions.js b/js/actions/appActions.js index 299ab5a660d..2a442bc5edf 100644 --- a/js/actions/appActions.js +++ b/js/actions/appActions.js @@ -943,19 +943,32 @@ const appActions = { }, /** - * Action triggered by navigation handler + * Action triggered by registering navigation handler * @param partition {string} session partition * @param protocol {string} navigator protocol * @param location {string} location where handler was triggered - * @param register {boolean} true if event was registered or false if unregistered */ - navigatorHandler: function (partition, protocol, location, register) { + navigatorHandlerRegistered: function (partition, protocol, location) { AppDispatcher.dispatch({ - actionType: appConstants.APP_NAVIGATOR_HANDLER_UPDATE, + actionType: appConstants.APP_NAVIGATOR_HANDLER_REGISTERED, partition, protocol, - location, - register + location + }) + }, + + /** + * Action triggered by un-registering navigation handler + * @param partition {string} session partition + * @param protocol {string} navigator protocol + * @param location {string} location where handler was triggered + */ + navigatorHandlerUnregistered: function (partition, protocol, location) { + AppDispatcher.dispatch({ + actionType: appConstants.APP_NAVIGATOR_HANDLER_UNREGISTERED, + partition, + protocol, + location }) } } diff --git a/js/constants/appConstants.js b/js/constants/appConstants.js index 6f1b3a90174..05f99bdc4de 100644 --- a/js/constants/appConstants.js +++ b/js/constants/appConstants.js @@ -96,7 +96,8 @@ const appConstants = { APP_TAB_MESSAGE_BOX_SHOWN: _, APP_TAB_MESSAGE_BOX_DISMISSED: _, APP_TAB_MESSAGE_BOX_UPDATED: _, - APP_NAVIGATOR_HANDLER_UPDATE: _ + APP_NAVIGATOR_HANDLER_REGISTERED: _, + APP_NAVIGATOR_HANDLER_UNREGISTERED: _ } module.exports = mapValuesByKeys(appConstants) diff --git a/js/constants/messages.js b/js/constants/messages.js index 9132acde777..3ea7bf2f5fd 100644 --- a/js/constants/messages.js +++ b/js/constants/messages.js @@ -145,7 +145,6 @@ const messages = { LEDGER_PUBLISHER: _, LEDGER_UPDATED: _, LEDGER_CREATE_WALLET: _, - CHECK_BITCOIN_HANDLER: _, ADD_FUNDS_CLOSED: _, RENDER_URL_TO_PDF: _, // Sync