Merge pull request #2354 from ethereum/remixd_electron

ux friendly use of remixd inside electron
pull/1/head
yann300 5 years ago committed by GitHub
commit 5418de85c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/app.js
  2. 31
      src/app/files/remixd-handle.js
  3. 5
      src/remixAppManager.js

@ -346,4 +346,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
})
}
if (isElectron()) {
appManager.activate(['remixd'])
}
}

@ -1,3 +1,4 @@
import isElectron from 'is-electron'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'
var yo = require('yo-yo')
@ -55,28 +56,30 @@ export class RemixdHandle extends Plugin {
* @param {String} txHash - hash of the transaction
*/
connectToLocalhost () {
let connection = (error) => {
if (error) {
console.log(error)
modalDialogCustom.alert(
'Cannot connect to the remixd daemon.' +
'Please make sure you have the remixd running in the background.'
)
this.canceled()
} else {
this.fileSystemExplorer.ensureRoot()
}
}
if (this.locahostProvider.isConnected()) {
this.locahostProvider.close((error) => {
if (error) console.log(error)
})
} else {
} else if (!isElectron()) {
// warn the user only if he/she is in the browser context
modalDialog(
'Connect to localhost',
remixdDialog(),
{ label: 'Connect',
fn: () => {
this.locahostProvider.init((error) => {
if (error) {
console.log(error)
modalDialogCustom.alert(
'Cannot connect to the remixd daemon.' +
'Please make sure you have the remixd running in the background.'
)
this.canceled()
} else {
this.fileSystemExplorer.ensureRoot()
}
})
this.locahostProvider.init((error) => connection(error))
}
},
{ label: 'Cancel',
@ -85,6 +88,8 @@ export class RemixdHandle extends Plugin {
}
}
)
} else {
this.locahostProvider.init((error) => connection(error))
}
}
}

@ -19,11 +19,14 @@ export class RemixAppManager extends PluginEngine {
constructor (plugins) {
super(plugins, settings)
this.event = new EventEmitter()
this.donotAutoReload = ['remixd'] // that would be a bad practice to force loading some plugins at page load.
this.registered = {}
}
onActivated (plugin) {
localStorage.setItem('workspace', JSON.stringify(this.actives))
if (!this.donotAutoReload.includes(plugin.name)) {
localStorage.setItem('workspace', JSON.stringify(this.actives))
}
this.event.emit('activate', plugin.name)
}

Loading…
Cancel
Save