Browse Source

Merge pull request #35 from LN-Zap/feature/notifications

Feature/notifications
renovate/lint-staged-8.x
jackmallers 7 years ago
committed by GitHub
parent
commit
d62051c5c3
  1. 8
      app/notifications/index.js
  2. 7
      app/reducers/transaction.js

8
app/notifications/index.js

@ -0,0 +1,8 @@
export default {
showNotification: (title, body, onClick) => {
new Notification(title, {
body,
onClick
})
}
}

7
app/reducers/transaction.js

@ -1,4 +1,5 @@
import { ipcRenderer } from 'electron'
import { showNotification } from '../notifications'
import { btc, usd } from '../utils'
import { setForm, resetForm } from './form'
import { showModal } from './modal'
@ -69,6 +70,12 @@ export const transactionError = () => (dispatch) => {
// Listener for when a new transaction is pushed from the subscriber
export const newTransaction = (event, { transaction }) => (dispatch) => {
dispatch({ type: ADD_TRANSACTION, transaction })
// HTML 5 desktop notification for the new transaction
const notifTitle = transaction.amount > 0 ? `On-chain Transaction Received!` : `On-chain Transaction Sent!`
const notifBody = transaction.amount > 0 ? `Lucky you, you just received a new on-chain transaction. I'm jealous.` : `Hate to see 'em go but love to watch 'em leave. Your on-chain transaction successfully sent.`
showNotification(notifTitle, notifBody)
}

Loading…
Cancel
Save