Browse Source

Merge pull request #107 from Empact/fix/flow

Fix flow to run green
renovate/lint-staged-8.x
JimmyMow 7 years ago
committed by GitHub
parent
commit
d94eccd4a8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .flowconfig
  2. 38
      app/main.dev.js

1
.flowconfig

@ -1,5 +1,6 @@
[ignore] [ignore]
<PROJECT_ROOT>/node_modules/* <PROJECT_ROOT>/node_modules/*
<PROJECT_ROOT>/app/node_modules/*
<PROJECT_ROOT>/app/main.prod.js <PROJECT_ROOT>/app/main.prod.js
<PROJECT_ROOT>/app/main.prod.js.map <PROJECT_ROOT>/app/main.prod.js.map
<PROJECT_ROOT>/app/dist/.* <PROJECT_ROOT>/app/dist/.*

38
app/main.dev.js

@ -96,7 +96,7 @@ app.on('ready', async () => {
if (!mainWindow) { if (!mainWindow) {
throw new Error('"mainWindow" is not defined') throw new Error('"mainWindow" is not defined')
} }
mainWindow.show() mainWindow.show()
mainWindow.focus() mainWindow.focus()
@ -150,7 +150,11 @@ app.setAsDefaultProtocolClient('lightning')
app.on('open-url', function (event, url) { app.on('open-url', function (event, url) {
event.preventDefault() event.preventDefault()
if (!mainWindow) {
throw new Error('"mainWindow" is not defined')
}
const payreq = url.split(':')[1] const payreq = url.split(':')[1]
mainWindow.webContents.send('lightningPaymentUri', { payreq }) mainWindow.webContents.send('lightningPaymentUri', { payreq })
mainWindow.show() mainWindow.show()
@ -183,12 +187,12 @@ export const startLnd = () => {
if (process.env.NODE_ENV === 'development') { console.log(line) } if (process.env.NODE_ENV === 'development') { console.log(line) }
// If the gRPC proxy has started we can start ours // If the gRPC proxy has started we can start ours
if (line.includes('gRPC proxy started')) { if (line.includes('gRPC proxy started')) {
let certInterval = setInterval(() => { let certInterval = setInterval(() => {
if (fs.existsSync(certPath)) { if (fs.existsSync(certPath)) {
clearInterval(certInterval) clearInterval(certInterval)
console.log('CERT EXISTS, STARTING GRPC') console.log('CERT EXISTS, STARTING GRPC')
startGrpc() startGrpc()
} }
@ -196,7 +200,7 @@ export const startLnd = () => {
} }
// Pass current clock height progress to front end for loading state UX // Pass current clock height progress to front end for loading state UX
if (line.includes('Caught up to height') || line.includes('Catching up block hashes to height')) { if (mainWindow && (line.includes('Caught up to height') || line.includes('Catching up block hashes to height'))) {
// const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim() // const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim()
const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim() const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim()
mainWindow.webContents.send('lndStdout', line) mainWindow.webContents.send('lndStdout', line)
@ -234,9 +238,11 @@ const sendLndSyncing = () => {
if (didFinishLoad) { if (didFinishLoad) {
clearInterval(sendLndSyncingInterval) clearInterval(sendLndSyncingInterval)
console.log('SENDING SYNCING') if (mainWindow) {
startedSync = true console.log('SENDING SYNCING')
mainWindow.webContents.send('lndSyncing') startedSync = true
mainWindow.webContents.send('lndSyncing')
}
} }
}, 1000) }, 1000)
} }
@ -247,8 +253,10 @@ const sendLndSynced = () => {
if (didFinishLoad && startedSync) { if (didFinishLoad && startedSync) {
clearInterval(sendLndSyncedInterval) clearInterval(sendLndSyncedInterval)
console.log('SENDING SYNCED') if (mainWindow) {
mainWindow.webContents.send('lndSynced') console.log('SENDING SYNCED')
mainWindow.webContents.send('lndSynced')
}
} }
}, 1000) }, 1000)
} }
@ -259,8 +267,10 @@ const sendGrpcDisconnected = () => {
if (didFinishLoad) { if (didFinishLoad) {
clearInterval(sendGrpcDisonnectedInterval) clearInterval(sendGrpcDisonnectedInterval)
sentGrpcDisconnect = true if (mainWindow) {
mainWindow.webContents.send('grpcDisconnected') sentGrpcDisconnect = true
mainWindow.webContents.send('grpcDisconnected')
}
} }
}, 1000) }, 1000)
} }
@ -271,7 +281,9 @@ const sendGrpcConnected = () => {
if (didFinishLoad && sentGrpcDisconnect) { if (didFinishLoad && sentGrpcDisconnect) {
clearInterval(sendGrpcConnectedInterval) clearInterval(sendGrpcConnectedInterval)
mainWindow.webContents.send('grpcConnected') if (mainWindow) {
mainWindow.webContents.send('grpcConnected')
}
} }
}, 1000) }, 1000)
} }

Loading…
Cancel
Save