#26: Fix macOS dependency install
This commit is contained in:
32
src/App.js
32
src/App.js
@@ -162,16 +162,9 @@ class App extends IPCContainer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onInstallDependencyComplete = (source, url, result) => {
|
onInstallDependencyComplete = () => {
|
||||||
if (this._isMounted) {
|
if (this._isMounted) {
|
||||||
if (result.Success && source.toLowerCase().endsWith('.dmg')) {
|
this.checkVersionInstalled();
|
||||||
this.waitForDependencyInstall(source, url);
|
|
||||||
} else {
|
|
||||||
this.sendRequest(Constants.IPC_Delete_File, {
|
|
||||||
FilePath: source,
|
|
||||||
});
|
|
||||||
this.checkVersionInstalled();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -215,27 +208,6 @@ class App extends IPCContainer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
waitForDependencyInstall = (source, url) => {
|
|
||||||
const dep = this.props.MissingDependencies.find(d => {
|
|
||||||
return d.download === url;
|
|
||||||
});
|
|
||||||
|
|
||||||
const i = setInterval(()=> {
|
|
||||||
const ret = this.sendSyncRequest(Constants.IPC_Check_Dependency_Installed, {
|
|
||||||
File: dep.file,
|
|
||||||
});
|
|
||||||
if (ret.data.Exists) {
|
|
||||||
clearInterval(i);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.sendRequest(Constants.IPC_Delete_File, {
|
|
||||||
FilePath: source,
|
|
||||||
});
|
|
||||||
this.checkVersionInstalled();
|
|
||||||
}, 10000);
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const selectedVersion = this.getSelectedVersion();
|
const selectedVersion = this.getSelectedVersion();
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,35 @@ export const installDependency = (source, url, completedCallback) => {
|
|||||||
|
|
||||||
const installDependencyComplete = (event, arg) => {
|
const installDependencyComplete = (event, arg) => {
|
||||||
ipcRenderer.removeListener(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
|
ipcRenderer.removeListener(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
|
||||||
dispatch(setInstallComplete(arg.data));
|
|
||||||
completedCallback(source, url, arg.data);
|
const result = arg.data;
|
||||||
|
const handleCompleted = ()=> {
|
||||||
|
ipcRenderer.send(Constants.IPC_Delete_File, {
|
||||||
|
FilePath: source,
|
||||||
|
});
|
||||||
|
dispatch(setInstallComplete(result));
|
||||||
|
completedCallback(source, url, result);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (result.Success && source.toLowerCase().endsWith('.dmg')) {
|
||||||
|
const dep = getState().install.MissingDependencies.find(d => {
|
||||||
|
return d.download === url;
|
||||||
|
});
|
||||||
|
const i = setInterval(()=> {
|
||||||
|
const ret = ipcRenderer.sendSync(Constants.IPC_Check_Dependency_Installed + '_sync', {
|
||||||
|
File: dep.file,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret.data.Exists) {
|
||||||
|
clearInterval(i);
|
||||||
|
setTimeout(() => {
|
||||||
|
handleCompleted();
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
} else {
|
||||||
|
handleCompleted();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ipcRenderer.on(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
|
ipcRenderer.on(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
|
||||||
|
|||||||
Reference in New Issue
Block a user