|
|
@ -1,6 +1,7 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { ipcRenderer } from 'electron' |
|
|
|
import { btc } from 'utils' |
|
|
|
import { fetchDescribeNetwork } from './network' |
|
|
|
import { closeChannelForm } from './channelform' |
|
|
|
import { setError } from './error' |
|
|
|
import { showNotification } from 'notifications' |
|
|
@ -185,13 +186,13 @@ export const pushclosechannelstatus = () => (dispatch) => { |
|
|
|
// IPC event for channel graph data
|
|
|
|
export const channelGraphData = (event, data) => (dispatch, getState) => { |
|
|
|
const info = getState().info |
|
|
|
|
|
|
|
console.log('info: ', info) |
|
|
|
console.log('channelGraphData: ', data) |
|
|
|
const { channelGraphData: { channel_updates } } = data |
|
|
|
|
|
|
|
// if there are any new channel updates
|
|
|
|
if (channel_updates.length) { |
|
|
|
// The network has updated, so fetch a new result
|
|
|
|
dispatch(fetchDescribeNetwork()) |
|
|
|
|
|
|
|
// loop through the channel updates
|
|
|
|
for(let i = 0; i < channel_updates.length; i++) { |
|
|
|
let channel_update = channel_updates[i] |
|
|
@ -199,7 +200,11 @@ export const channelGraphData = (event, data) => (dispatch, getState) => { |
|
|
|
|
|
|
|
// if our node is involved in this update we wanna show a notification
|
|
|
|
if(info.data.identity_pubkey === advertising_node || info.data.identity_pubkey === connecting_node) { |
|
|
|
// this channel has to do with the user, lets fetch a new channel list for them
|
|
|
|
// TODO: full fetch is probably not necessary
|
|
|
|
dispatch(fetchChannels()) |
|
|
|
|
|
|
|
// Construct the notification
|
|
|
|
let otherParty = info.data.identity_pubkey === advertising_node ? connecting_node : advertising_node |
|
|
|
let notifBody = `No new friends, just new channels. Your channel with ${otherParty}` // eslint-disable-line
|
|
|
|
const notifTitle = 'New channel detected' |
|
|
|