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

initial check-in #5924

Merged
merged 2 commits into from
Nov 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ var backupKeys = (appState, action) => {

var recoverKeys = (appState, action) => {
client.recoverWallet(action.firstRecoveryKey, action.secondRecoveryKey, (err, body) => {
if (logError(err, 'recoveryWallet')) appActions.updateLedgerInfo(underscore.omit(ledgerInfo, [ '_internal' ]))
if (err) {
setImmediate(() => appActions.ledgerRecoveryFailed())
} else {
Expand All @@ -302,6 +303,15 @@ var recoverKeys = (appState, action) => {
*/

if (ipc) {
ipc.on(messages.LEDGER_PAYMENTS_PRESENT, (event, presentP) => {
if (presentP) {
if (!balanceTimeoutId) getBalance()
} else if (balanceTimeoutId) {
clearTimeout(balanceTimeoutId)
balanceTimeoutId = false
}
})

ipc.on(messages.CHECK_BITCOIN_HANDLER, (event, partition) => {
const protocolHandler = session.fromPartition(partition).protocol
// TODO: https://github.com/brave/browser-laptop/issues/3625
Expand Down
20 changes: 20 additions & 0 deletions js/components/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ const ImmutableComponent = require('./immutableComponent')

const windowActions = require('../actions/windowActions')
const dragTypes = require('../constants/dragTypes')
const messages = require('../constants/messages')
const cx = require('../lib/classSet')
const {getTextColorForBackground} = require('../lib/color')
const {isIntermediateAboutPage} = require('../lib/appUrlUtil')

const contextMenus = require('../contextMenus')
const dnd = require('../dnd')
const windowStore = require('../stores/windowStore')
const ipc = global.require('electron').ipcRenderer

class Tab extends ImmutableComponent {
constructor () {
Expand Down Expand Up @@ -254,4 +256,22 @@ class Tab extends ImmutableComponent {
}
}

const paymentsEnabled = () => {
const getSetting = require('../settings').getSetting
const settings = require('../constants/settings')
return getSetting(settings.PAYMENTS_ENABLED)
}

windowStore.addChangeListener(() => {
if (paymentsEnabled()) {
const windowState = windowStore.getState()
const tabs = windowState && windowState.get('tabs')
if (tabs) {
const presentP = tabs.some((tab) => {
return tab.get('location') === 'about:preferences#payments'
})
ipc.send(messages.LEDGER_PAYMENTS_PRESENT, presentP)
}
}
})
module.exports = Tab
2 changes: 2 additions & 0 deletions js/constants/coinbaseCountries.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const coinbaseCountries = [
/* although coibnase operates in all these countries, the debit/credit payment service is, at present, only in the US
'AT',
'AU',
'BE',
Expand Down Expand Up @@ -35,6 +36,7 @@ const coinbaseCountries = [
'SI',
'SK',
'SM',
*/
'US'
]

Expand Down
1 change: 1 addition & 0 deletions js/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const messages = {
// Debugging
DEBUG_REACT_PROFILE: _,
// Ledger
LEDGER_PAYMENTS_PRESENT: _,
LEDGER_PUBLISHER: _,
LEDGER_UPDATED: _,
LEDGER_CREATE_WALLET: _,
Expand Down