mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #348 from MetaMask/i341
Clear notifications on extension open + guard against negative sends
This commit is contained in:
commit
7026eca222
@ -176,7 +176,7 @@ function renderNotificationSVG(content, cb){
|
||||
}
|
||||
|
||||
function svgWrapper(content){
|
||||
var wrapperSource = `
|
||||
var wrapperSource = `
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="450" height="300">
|
||||
<foreignObject x="0" y="0" width="100%" height="100%">
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" height="100%">{{content}}</body>
|
||||
@ -188,4 +188,4 @@ function svgWrapper(content){
|
||||
|
||||
function toSvgUri(content){
|
||||
return 'data:image/svg+xml;utf8,' + encodeURIComponent(content)
|
||||
}
|
||||
}
|
||||
|
@ -65,11 +65,21 @@ function getCurrentDomain (cb) {
|
||||
})
|
||||
}
|
||||
|
||||
function clearNotifications(){
|
||||
chrome.notifications.getAll(function (object) {
|
||||
for (let notification in object){
|
||||
chrome.notifications.clear(notification)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function setupApp (err, opts) {
|
||||
if (err) {
|
||||
alert(err.stack)
|
||||
throw err
|
||||
}
|
||||
|
||||
clearNotifications()
|
||||
|
||||
var container = document.getElementById('app-content')
|
||||
|
||||
|
@ -355,4 +355,3 @@ App.prototype.toggleMetamaskActive = function () {
|
||||
this.props.dispatch(actions.lockMetamask(false))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,11 @@ SendTransactionScreen.prototype.onSubmit = function () {
|
||||
return this.props.dispatch(actions.displayWarning(message))
|
||||
}
|
||||
|
||||
if (input < 0) {
|
||||
message = 'Can not send negative amounts of ETH.'
|
||||
return this.props.dispatch(actions.displayWarning(message))
|
||||
}
|
||||
|
||||
if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) {
|
||||
message = 'Recipient address is invalid.'
|
||||
return this.props.dispatch(actions.displayWarning(message))
|
||||
@ -234,4 +239,3 @@ SendTransactionScreen.prototype.onSubmit = function () {
|
||||
|
||||
this.props.dispatch(actions.signTx(txParams))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user