Skip to content

Commit

Permalink
update check optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
qishibo committed Feb 17, 2020
1 parent 1493f64 commit 3b3d9b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default {
duration: 1500,
});

this.$bus.$emit('update-check');
this.$bus.$emit('update-check', true);
},
bindGetAllFonts() {
ipcRenderer.on('send-all-fonts', (event, arg) => {
Expand Down
13 changes: 11 additions & 2 deletions src/components/UpdateCheck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import { ipcRenderer } from 'electron';
export default {
data() {
return {
manual: false,
updateChecking: false,
downloadProcessShow: false,
};
},
created() {
this.$bus.$on('update-check', () => {
this.$bus.$on('update-check', (manual = false) => {
this.manual = manual;

// update checking running...
if (this.updateChecking) {
return;
Expand Down Expand Up @@ -46,6 +49,12 @@ export default {
ipcRenderer.on('update-not-available', (event, arg) => {
this.$notify.closeAll();
this.resetDownloadProcess();

// latest version
this.manual && this.$notify.success({
title: this.$t('message.update_not_available'),
duration: 2000
});
});

ipcRenderer.on('update-error', (event, arg) => {
Expand All @@ -60,7 +69,7 @@ export default {
this.$t('message.mac_not_support_auto_update') :
(this.$t('message.update_error') + ': ' + arg.code);

const a = this.$notify.error({
this.$notify.error({
title: message,
duration: 0
});
Expand Down

0 comments on commit 3b3d9b6

Please sign in to comment.