Fix install
This commit is contained in:
14
src/App.js
14
src/App.js
@@ -56,7 +56,10 @@ class App extends IPCContainer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_isMounted = false;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this._isMounted = true;
|
||||||
this.scheduledUpdateJob = Scheduler.scheduleJob('23 11 * * *', this.updateCheckScheduledJob);
|
this.scheduledUpdateJob = Scheduler.scheduleJob('23 11 * * *', this.updateCheckScheduledJob);
|
||||||
this.detectUpgrades();
|
this.detectUpgrades();
|
||||||
}
|
}
|
||||||
@@ -75,6 +78,7 @@ class App extends IPCContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
this._isMounted = false;
|
||||||
Scheduler.cancelJob(this.scheduledUpdateJob);
|
Scheduler.cancelJob(this.scheduledUpdateJob);
|
||||||
super.componentWillUnmount();
|
super.componentWillUnmount();
|
||||||
}
|
}
|
||||||
@@ -123,7 +127,7 @@ class App extends IPCContainer {
|
|||||||
if (result.Success) {
|
if (result.Success) {
|
||||||
const selectedVersion = this.getSelectedVersion();
|
const selectedVersion = this.getSelectedVersion();
|
||||||
this.props.installRelease(result.Destination, selectedVersion, () => {
|
this.props.installRelease(result.Destination, selectedVersion, () => {
|
||||||
if (this.isMounted()) {
|
if (this._isMounted) {
|
||||||
this.checkVersionInstalled();
|
this.checkVersionInstalled();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -140,7 +144,7 @@ class App extends IPCContainer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onDownloadFileComplete = (name, type, url, result) => {
|
onDownloadFileComplete = (name, type, url, result) => {
|
||||||
if (this.isMounted()) {
|
if (this._isMounted) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Constants.INSTALL_TYPES.Dependency:
|
case Constants.INSTALL_TYPES.Dependency:
|
||||||
this.installDependency(result);
|
this.installDependency(result);
|
||||||
@@ -159,7 +163,7 @@ class App extends IPCContainer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onInstallDependencyComplete = (source, url, result) => {
|
onInstallDependencyComplete = (source, url, result) => {
|
||||||
if (this.isMounted()) {
|
if (this._isMounted) {
|
||||||
if (result.Success && source.toLowerCase().endsWith('.dmg')) {
|
if (result.Success && source.toLowerCase().endsWith('.dmg')) {
|
||||||
this.waitForDependencyInstall(source, url);
|
this.waitForDependencyInstall(source, url);
|
||||||
} else {
|
} else {
|
||||||
@@ -172,9 +176,9 @@ class App extends IPCContainer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onInstallUpgradeComplete = (source, result) => {
|
onInstallUpgradeComplete = (source, result) => {
|
||||||
if (this.isMounted() && !result.Success) {
|
if (this._isMounted && !result.Success) {
|
||||||
this.props.notifyError(result.Error, false,() => {
|
this.props.notifyError(result.Error, false,() => {
|
||||||
if (this.isMounted()) {
|
if (this._isMounted) {
|
||||||
// TODO Prompt to verify
|
// TODO Prompt to verify
|
||||||
if (result.AllowSkipVerification) {
|
if (result.AllowSkipVerification) {
|
||||||
this.installUpgrade({
|
this.installUpgrade({
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export const installRelease = (source, version, completedCallback) => {
|
|||||||
|
|
||||||
const extractReleaseComplete = (event, arg) => {
|
const extractReleaseComplete = (event, arg) => {
|
||||||
ipcRenderer.removeListener(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
|
ipcRenderer.removeListener(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
|
||||||
ipcRenderer.sendSync(Constants.IPC_Delete_File, {
|
ipcRenderer.send(Constants.IPC_Delete_File, {
|
||||||
FilePath: source,
|
FilePath: source,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ export const installUpgrade = (source, sha256, signature, skipVerification, comp
|
|||||||
|
|
||||||
const installUpgradeComplete = (event, arg) => {
|
const installUpgradeComplete = (event, arg) => {
|
||||||
ipcRenderer.removeListener(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete);
|
ipcRenderer.removeListener(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete);
|
||||||
ipcRenderer.sendSync(Constants.IPC_Delete_File, {
|
ipcRenderer.send(Constants.IPC_Delete_File, {
|
||||||
FilePath: source,
|
FilePath: source,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user