Skip to content

Commit 19f4e9f

Browse files
committed
Fix download modal bug
1 parent 5ed9f66 commit 19f4e9f

File tree

10 files changed

+23
-72
lines changed

10 files changed

+23
-72
lines changed

app/lib/Events.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export enum Events {
33
UPDATE_CHECK = 'update:check',
44
UPDATE_DOWNLOADING = 'update:downloading',
55
UPDATE_DOWNLOADED = 'update:downloaded',
6+
UPDATE_QUIT_AND_INSTALL = 'update;:quit-and-install',
67
CHECKSUM = 'checksum',
78
CHECKSUM_RESULT = 'checksum:result',
89
DATABASE_CHECKS_RELOAD = 'database:checks-reload',

app/main/src/AppUpdater.ts

+4
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ export default class AppUpdater {
8888
autoUpdater.downloadUpdate();
8989
};
9090

91+
public quitAndInstall = () => {
92+
autoUpdater.quitAndInstall();
93+
}
94+
9195
public checkForUpdate = () => {
9296
this.ipcHandler.sendToRenderer('update:check', {});
9397
autoUpdater.checkForUpdates();

app/main/src/IPCHandler.ts

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ export default class IPCHandler {
8686
.on(Events.UPDATE_CHECK, async (event: any, arg: any) => {
8787
this.updater.checkForUpdate();
8888
})
89+
.on(Events.UPDATE_QUIT_AND_INSTALL, async (event: any, arg: any) => {
90+
this.updater.quitAndInstall();
91+
})
8992
.on(Events.DATABASE_CHECKS_RELOAD, async (event: any, arg: any) => {
9093
this.database.refreshDB();
9194
})

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "checksum-validator",
3-
"version": "1.1.0",
3+
"version": "1.0.1",
44
"description": "Small Electron application to validate checksums.",
55
"main": "build/main.js",
66
"author": "Alexander Weiss",

app/renderer/src/Notifications.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const showUpdateAvailableNotification = msg => {
3333
size="small"
3434
onClick={() => {
3535
store.dispatch(updateApp());
36+
notification.destroy();
3637
}}
3738
>
3839
{i18n.translate('update application')}

app/renderer/src/actions/ipc.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export const ipc = createIpc({
6262
error: data.error,
6363
updateAvailable: data.updateAvailable,
6464
msg: data.msg,
65-
downloading: false,
65+
downloading: data.downloading,
66+
updating: data.updating,
67+
downloadPercentage: data.downloadPercentage,
6668
},
6769
};
6870
},

app/renderer/src/actions/update/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ export const checkForUpdate = () => {
1313
export const updateApp = () => {
1414
return send(Events.UPDATE);
1515
};
16+
17+
export const quitAndInstall = () => {
18+
return send(Events.UPDATE_QUIT_AND_INSTALL);
19+
}

app/renderer/src/components/DownloadModal.component.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { remote } from 'electron';
12
import * as React from 'react';
23
import { connect } from 'react-redux';
34

45
import { Button, Modal, Progress } from 'antd';
56

6-
import { updateApp } from '../actions/update';
7+
import { quitAndInstall } from '../actions/update';
78

89
import I18n from '../../../lib/i18n/I18n';
910
const i18n: I18n = new I18n();
@@ -14,14 +15,14 @@ const mapStateToProps = state => ({
1415

1516
const mapDispatchToProps = dispatch => {
1617
return {
17-
updateApp: () => dispatch(updateApp()),
18+
quitAndInstall: () => dispatch(quitAndInstall()),
1819
};
1920
};
2021

2122
@connect(mapStateToProps, mapDispatchToProps)
2223
class DownloadModal extends React.Component<any, any> {
2324
handleExit = () => {
24-
this.props.updateApp();
25+
this.props.quitAndInstall();
2526
};
2627

2728
render() {
@@ -34,8 +35,7 @@ class DownloadModal extends React.Component<any, any> {
3435
footer={[
3536
<Button
3637
disabled={
37-
this.props.update.downloading ||
38-
this.props.update.downloadPercentage !== 100
38+
this.props.update.downloading || this.props.update.downloadPercentage != 100
3939
}
4040
key="enter"
4141
onClick={this.handleExit}

app/renderer/src/reducers/update.tsx

-64
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "checksum-validator",
3-
"version": "1.1.0",
3+
"version": "1.0.1",
44
"description": "Small Electron application to validate checksums.",
55
"scripts": {
66
"babel:watch": "babel ./app/main/src/ -w -d ./app/main/build",

0 commit comments

Comments
 (0)