1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge branch 'master' into pr/351

# Conflicts:
#	CHANGELOG.md
#	app/scripts/lib/notifications.js
This commit is contained in:
kumavis 2016-06-28 13:14:38 -07:00
commit 19f9d6566b
6 changed files with 39 additions and 87 deletions

View File

@ -7,7 +7,8 @@
- Changed status shapes to be a yellow warning sign for failure and ellipsis for pending transactions. - Changed status shapes to be a yellow warning sign for failure and ellipsis for pending transactions.
- Now enforce 20 character limit on wallet names. - Now enforce 20 character limit on wallet names.
- Wallet titles are now properly truncated in transaction confirmation. - Wallet titles are now properly truncated in transaction confirmation.
- Fix formatting on terms & conditions page.
- Now enforce 30 character limit on wallet names.
## 2.4.4 2016-06-23 ## 2.4.4 2016-06-23

View File

@ -30,21 +30,37 @@ function unlockAccountMessage () {
} }
function showUnconfirmedMessage (msgParams, msgId) { function showUnconfirmedMessage (msgParams, msgId) {
var controllerState = controller.getState()
createMsgNotification({ createMsgNotification({
title: 'New Unsigned Message', imageifyIdenticons: false,
msgParams: msgParams, txData: {
confirm: idStore.approveMessage.bind(idStore, msgId, noop), msgParams: msgParams,
cancel: idStore.cancelMessage.bind(idStore, msgId), time: (new Date()).getTime(),
},
identities: controllerState.identities,
accounts: controllerState.accounts,
onConfirm: idStore.approveMessage.bind(idStore, msgId, noop),
onCancel: idStore.cancelMessage.bind(idStore, msgId),
}) })
} }
function showUnconfirmedTx (txParams, txData, onTxDoneCb) { function showUnconfirmedTx (txParams, txData, onTxDoneCb) {
var controllerState = controller.getState()
createTxNotification({ createTxNotification({
title: 'New Unsigned Transaction', imageifyIdenticons: false,
txParams: txParams, txData: {
confirm: idStore.approveTransaction.bind(idStore, txData.id, noop), txParams: txParams,
cancel: idStore.cancelTransaction.bind(idStore, txData.id), time: (new Date()).getTime(),
},
identities: controllerState.identities,
accounts: controllerState.accounts,
onConfirm: idStore.approveTransaction.bind(idStore, txData.id, noop),
onCancel: idStore.cancelTransaction.bind(idStore, txData.id),
}) })
} }
// //

View File

@ -53,62 +53,30 @@ function createUnlockRequestNotification (opts) {
}) })
} }
function createTxNotification (opts) { 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...')
var state = {
title: 'New Unsigned Transaction',
imageifyIdenticons: false,
txData: {
txParams: opts.txParams,
time: (new Date()).getTime(),
},
identities: {
},
accounts: {
},
onConfirm: opts.confirm,
onCancel: opts.cancel,
}
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',
imageUrl: toSvgUri(notificationSvgSource), imageUrl: toSvgUri(notificationSvgSource),
})) }))
}) })
} }
function createMsgNotification (opts) { 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...')
var state = {
title: 'New Unsigned Message',
imageifyIdenticons: false,
txData: {
msgParams: opts.msgParams,
time: (new Date()).getTime(),
},
identities: {
},
accounts: {
},
onConfirm: opts.confirm,
onCancel: opts.cancel,
}
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',
imageUrl: toSvgUri(notificationSvgSource), imageUrl: toSvgUri(notificationSvgSource),
})) }))
@ -154,8 +122,8 @@ 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: {
width: '450px', width: '360px',
height: '300px', height: '240px',
padding: '16px', padding: '16px',
// background: '#F7F7F7', // background: '#F7F7F7',
background: 'white', background: 'white',
@ -176,8 +144,13 @@ function renderNotificationSVG(content, cb){
} }
function svgWrapper(content){ function svgWrapper(content){
<<<<<<< HEAD
var wrapperSource = `
<svg xmlns="http://www.w3.org/2000/svg" width="360" height="240">
=======
var wrapperSource = ` var wrapperSource = `
<svg xmlns="http://www.w3.org/2000/svg" width="450" height="300"> <svg xmlns="http://www.w3.org/2000/svg" width="450" height="300">
>>>>>>> master
<foreignObject x="0" y="0" width="100%" height="100%"> <foreignObject x="0" y="0" width="100%" height="100%">
<body xmlns="http://www.w3.org/1999/xhtml" height="100%">{{content}}</body> <body xmlns="http://www.w3.org/1999/xhtml" height="100%">{{content}}</body>
</foreignObject> </foreignObject>

View File

@ -1,38 +0,0 @@
Chrome notifications allow you to show an SVG image via a data-uri
Taking advantage of this might allow us to show nicely formatted notifications
build a template using pure svg:
```svg
<svg xmlns='http://www.w3.org/2000/svg'
width='1000px' height='500px' viewBox='0 0 200 100'>
<rect x='0' y='0' width='100%' height='100%' fill='white' />
<text x='0' y='20' font-family='monospace' font-size='6' fill='black'>
<tspan x='0' dy='1.2em'>Domain: https://boardroom.to</tspan>
<tspan x='0' dy='1.2em'>From: 0xabcdef</tspan>
<tspan x='0' dy='1.2em'>To: 0xfedcba</tspan>
<tspan x='0' dy='1.2em'>Value: 1.025 Ether</tspan>
<tspan x='0' dy='1.2em'>Gas: 0.025 Ether</tspan>
</text>
</svg>
```
generate uri
`'data:image/svg+xml;charset=utf-8,'+encodeURIComponent(svgSrc)`
or svg-embedded html:
```svg
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="500">
<rect x='0' y='0' width='100%' height='100%' fill='white' />
<foreignObject class="node" x="46" y="22" width="200" height="300">
<body xmlns="http://www.w3.org/1999/xhtml">
<div style="font-size: 120px">
The quick brown fox jumps over the lazy dog.
Pack my box with five dozen liquor jugs
</div>
</body>
</foreignObject>
</svg>
```

View File

@ -145,7 +145,7 @@ AccountDetailScreen.prototype.render = function () {
style: { style: {
margin: 10, margin: 10,
}, },
}, 'SEND ETH'), }, 'SEND'),
]), ]),

View File

@ -38,7 +38,7 @@ DisclaimerScreen.prototype.render = function () {
style: { style: {
whiteSpace: 'pre-line', whiteSpace: 'pre-line',
background: 'rgb(235, 235, 235)', background: 'rgb(235, 235, 235)',
height: '336px', height: '310px',
padding: '6px', padding: '6px',
width: '80%', width: '80%',
overflowY: 'scroll', overflowY: 'scroll',