Commit 369531aa authored by ioedeveloper's avatar ioedeveloper

sync remixd events

parent 2ab939cd
......@@ -76,7 +76,6 @@ module.exports = {
.addFile('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol'])
.clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0
.pause(10000)
.testContracts('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11'])
},
'Static Analysis run with remixd': function (browser) {
......
......@@ -15,9 +15,9 @@ module.exports = class RemixDProvider extends FileProvider {
_registerEvent () {
var remixdEvents = ['connecting', 'connected', 'errored', 'closed']
remixdEvents.forEach((value) => {
this._appManager.on('remixd', value, (event) => {
this.event.emit(value, event)
remixdEvents.forEach((event) => {
this._appManager.on('remixd', event, (value) => {
this.event.emit(event, value)
})
})
......@@ -44,6 +44,16 @@ module.exports = class RemixDProvider extends FileProvider {
this._appManager.on('remixd', 'rootFolderChanged', (path) => {
this.event.emit('rootFolderChanged', path)
})
this._appManager.on('remixd', 'removed', (path) => {
this.event.emit('fileRemoved', path)
})
this._appManager.on('remixd', 'changed', (path) => {
this.get(path, (_error, content) => {
this.event.emit('fileExternallyChanged', path, content)
})
})
}
isConnected () {
......
......@@ -39,7 +39,7 @@ export const listenOnPluginEvents = (filePanelPlugin) => {
})
}
export const listenOnProviderEvents = (provider) => async (reducerDispatch: React.Dispatch<any>) => {
export const listenOnProviderEvents = (provider) => (reducerDispatch: React.Dispatch<any>) => {
dispatch = reducerDispatch
provider.event.on('fileAdded', (filePath: string) => {
......@@ -70,7 +70,7 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac
}, 10)
})
provider.event.on('connected', async () => {
provider.event.on('connected', () => {
setTimeout(() => {
plugin.fileManager.setMode('localhost')
dispatch(setMode('localhost'))
......@@ -79,33 +79,33 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac
}, 10)
})
provider.event.on('loadingLocalhost', async () => {
provider.event.on('loadingLocalhost', () => {
setTimeout(async () => {
await switchToWorkspace(LOCALHOST)
dispatch(loadLocalhostRequest())
}, 10)
})
provider.event.on('fileExternallyChanged', async (path: string, file: { content: string }) => {
provider.event.on('fileExternallyChanged', (path: string, content: string) => {
setTimeout(() => {
const config = plugin.registry.get('config').api
const editor = plugin.registry.get('editor').api
if (config.get('currentFile') === path && editor.currentContent() !== file.content) {
if (provider.isReadOnly(path)) return editor.setText(file.content)
if (config.get('currentFile') === path && editor.currentContent() !== content) {
if (provider.isReadOnly(path)) return editor.setText(content)
dispatch(displayNotification(
path + ' changed',
'This file has been changed outside of Remix IDE.',
'Replace by the new content', 'Keep the content displayed in Remix',
() => {
editor.setText(file.content)
editor.setText(content)
}
))
}
}, 10)
})
provider.event.on('fileRenamedError', async () => {
provider.event.on('fileRenamedError', () => {
setTimeout(() => dispatch(displayNotification('File Renamed Failed', '', 'Ok', 'Cancel')), 10)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment