This commit is contained in:
Dan Finlay 2016-07-11 20:53:26 -07:00
parent 539fe3e940
commit e21a48da83
4 changed files with 10 additions and 17 deletions

View File

@ -43,7 +43,6 @@ function showUnconfirmedMessage (msgParams, msgId) {
onConfirm: idStore.approveMessage.bind(idStore, msgId, noop), onConfirm: idStore.approveMessage.bind(idStore, msgId, noop),
onCancel: idStore.cancelMessage.bind(idStore, msgId), onCancel: idStore.cancelMessage.bind(idStore, msgId),
}) })
} }
function showUnconfirmedTx (txParams, txData, onTxDoneCb) { function showUnconfirmedTx (txParams, txData, onTxDoneCb) {
@ -60,7 +59,6 @@ function showUnconfirmedTx (txParams, txData, onTxDoneCb) {
onConfirm: idStore.approveTransaction.bind(idStore, txData.id, noop), onConfirm: idStore.approveTransaction.bind(idStore, txData.id, noop),
onCancel: idStore.cancelTransaction.bind(idStore, txData.id), onCancel: idStore.cancelTransaction.bind(idStore, txData.id),
}) })
} }
// //

View File

@ -9,7 +9,7 @@ const PendingMsgDetails = require('../../../ui/app/components/pending-msg-detail
const MetaMaskUiCss = require('../../../ui/css') const MetaMaskUiCss = require('../../../ui/css')
var notificationHandlers = {} var notificationHandlers = {}
const notifications = { const notifications = {
createUnlockRequestNotification: createUnlockRequestNotification, createUnlockRequestNotification: createUnlockRequestNotification,
createTxNotification: createTxNotification, createTxNotification: createTxNotification,
createMsgNotification: createMsgNotification, createMsgNotification: createMsgNotification,
@ -59,14 +59,13 @@ function createTxNotification (state) {
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
if (!chrome.notifications) return console.error('Chrome notifications API missing...') if (!chrome.notifications) return console.error('Chrome notifications API missing...')
renderTxNotificationSVG(state, function(err, notificationSvgSource){ renderTxNotificationSVG(state, function (err, notificationSvgSource) {
if (err) throw err if (err) throw err
showNotification(extend(state, { showNotification(extend(state, {
title: 'New Unsigned Transaction', title: 'New Unsigned Transaction',
imageUrl: toSvgUri(notificationSvgSource), imageUrl: toSvgUri(notificationSvgSource),
})) }))
}) })
} }
@ -74,14 +73,13 @@ function createMsgNotification (state) {
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
if (!chrome.notifications) return console.error('Chrome notifications API missing...') if (!chrome.notifications) return console.error('Chrome notifications API missing...')
renderMsgNotificationSVG(state, function(err, notificationSvgSource){ renderMsgNotificationSVG(state, function (err, notificationSvgSource) {
if (err) throw err if (err) throw err
showNotification(extend(state, { showNotification(extend(state, {
title: 'New Unsigned Message', title: 'New Unsigned Message',
imageUrl: toSvgUri(notificationSvgSource), imageUrl: toSvgUri(notificationSvgSource),
})) }))
}) })
} }
@ -107,20 +105,19 @@ function showNotification (state) {
confirm: state.onConfirm, confirm: state.onConfirm,
cancel: state.onCancel, cancel: state.onCancel,
} }
} }
function renderTxNotificationSVG(state, cb){ function renderTxNotificationSVG (state, cb) {
var content = h(PendingTxDetails, state) var content = h(PendingTxDetails, state)
renderNotificationSVG(content, cb) renderNotificationSVG(content, cb)
} }
function renderMsgNotificationSVG(state, cb){ function renderMsgNotificationSVG (state, cb) {
var content = h(PendingMsgDetails, state) var content = h(PendingMsgDetails, state)
renderNotificationSVG(content, cb) renderNotificationSVG(content, cb)
} }
function renderNotificationSVG(content, cb){ function renderNotificationSVG (content, cb) {
var container = document.createElement('div') var container = document.createElement('div')
var confirmView = h('div.app-primary', { var confirmView = h('div.app-primary', {
style: { style: {
@ -135,7 +132,7 @@ function renderNotificationSVG(content, cb){
content, content,
]) ])
render(confirmView, container, function ready(){ render(confirmView, container, function ready() {
var rootElement = findDOMNode(this) var rootElement = findDOMNode(this)
var viewSource = rootElement.outerHTML var viewSource = rootElement.outerHTML
unmountComponentAtNode(container) unmountComponentAtNode(container)
@ -145,7 +142,7 @@ function renderNotificationSVG(content, cb){
}) })
} }
function svgWrapper(content){ function svgWrapper (content) {
var wrapperSource = ` var wrapperSource = `
<svg xmlns="http://www.w3.org/2000/svg" width="360" height="240"> <svg xmlns="http://www.w3.org/2000/svg" width="360" height="240">
<foreignObject x="0" y="0" width="100%" height="100%"> <foreignObject x="0" y="0" width="100%" height="100%">
@ -156,6 +153,6 @@ function svgWrapper(content){
return wrapperSource.split('{{content}}').join(content) return wrapperSource.split('{{content}}').join(content)
} }
function toSvgUri(content){ function toSvgUri (content) {
return 'data:image/svg+xml;utf8,' + encodeURIComponent(content) return 'data:image/svg+xml;utf8,' + encodeURIComponent(content)
} }

View File

@ -185,7 +185,6 @@ PTXP.miniAccountPanelForRecipient = function () {
}, },
}, addressSummary(txParams.to, 6, 4, false)), }, addressSummary(txParams.to, 6, 4, false)),
]) ])
} else { } else {
return h(MiniAccountPanel, { return h(MiniAccountPanel, {
imageifyIdenticons: imageify, imageifyIdenticons: imageify,
@ -225,7 +224,7 @@ PTXP.warnIfNeeded = function () {
} }
function forwardCarrat(imageify){ function forwardCarrat (imageify) {
if (imageify) { if (imageify) {
return ( return (

View File

@ -13,7 +13,6 @@ module.exports = function(addr, identities = {}) {
const address = addr.toLowerCase() const address = addr.toLowerCase()
const ids = hashFromIdentities(identities) const ids = hashFromIdentities(identities)
console.dir({ addr, ids })
return addrFromHash(address, ids) || addrFromHash(address, nicknames) return addrFromHash(address, ids) || addrFromHash(address, nicknames)
} }