Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Follow up of #7443
Browse files Browse the repository at this point in the history
Auditors: @bridiver @bsclifton

Test Plan:
  • Loading branch information
NejcZdovc committed Mar 3, 2017
1 parent 3631935 commit 2aeb514
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 16 deletions.
6 changes: 3 additions & 3 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down
9 changes: 7 additions & 2 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 15 additions & 3 deletions docs/appActions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand All @@ -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



Expand Down
25 changes: 19 additions & 6 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion js/constants/appConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion js/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ const messages = {
LEDGER_PUBLISHER: _,
LEDGER_UPDATED: _,
LEDGER_CREATE_WALLET: _,
CHECK_BITCOIN_HANDLER: _,
ADD_FUNDS_CLOSED: _,
RENDER_URL_TO_PDF: _,
// Sync
Expand Down

0 comments on commit 2aeb514

Please sign in to comment.