Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
feat: improve update visibility + integrate auto-update for windows u…
Browse files Browse the repository at this point in the history
…sers (#11)

* feat: integrate app update checker and automatic updates

* fix: call remote update checker

* feat: integrate auto-updater into ui

* fix: correct update-checker-interval

* refactor: remove unused interval
  • Loading branch information
herteleo committed Nov 14, 2020
1 parent 99221a0 commit 6ca22eb
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 53 deletions.
101 changes: 87 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -29,6 +29,7 @@
"date-fns": "^2.15.0",
"deepmerge": "^4.2.2",
"electron-dl": "^1.14.0",
"electron-updater": "^4.3.5",
"electron-window-state": "^5.0.3",
"is-url-relative-without-domain": "^2.0.0",
"lodash-id": "^0.14.0",
Expand Down
3 changes: 3 additions & 0 deletions src/background.js
Expand Up @@ -2,6 +2,7 @@ import electronDl from 'electron-dl';
import windowStateKeeper from 'electron-window-state';
import * as path from 'path';
import { format as formatUrl } from 'url';
import checkForUpdates from '@/utils/updater';

import {
app, Menu, protocol, BrowserWindow, shell,
Expand Down Expand Up @@ -76,6 +77,8 @@ function createMainWindow() {
protocol: 'file',
slashes: true,
}));

checkForUpdates();
}

window.on('ready-to-show', () => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/AppButton.vue
Expand Up @@ -40,6 +40,10 @@ export default {
border rounded;
}
.button[disabled] {
@apply opacity-75;
}
.primary {
@apply text-white bg-gray-600 border-gray-500 shadow;
}
Expand Down
21 changes: 21 additions & 0 deletions src/components/AppIcon.vue
Expand Up @@ -5,6 +5,7 @@
[$style.icon]: true,
[$style.inline]: inline,
[$style[`size-${size}`]]: true,
[$style.spin]: spin,
}"
viewBox="0 0 24 24"
>
Expand All @@ -29,6 +30,10 @@ export default {
type: Number,
default: 4,
},
spin: {
type: Boolean,
default: false,
},
},
computed: {
content() {
Expand Down Expand Up @@ -62,4 +67,20 @@ export default {
.size-8 {
@apply w-8 h-8;
}
.spin {
animation-name: spin;
animation-duration: 1000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
</style>
14 changes: 13 additions & 1 deletion src/components/SideBarButton.vue
Expand Up @@ -12,6 +12,10 @@
:face="icon"
:size="6"
/>
<span
v-if="showBadge"
:class="$style.badge"
/>
</div>
<div
v-if="$slots.default && showLabel"
Expand All @@ -29,6 +33,10 @@ export default {
type: String,
required: true,
},
showBadge: {
type: Boolean,
default: false,
},
showLabel: {
type: Boolean,
required: true,
Expand All @@ -51,10 +59,14 @@ export default {
}
.icon {
@apply flex-shrink-0 px-2;
@apply relative flex-shrink-0 px-2;
}
.label {
@apply flex-grow pl-2 whitespace-no-wrap;
}
.badge {
@apply absolute top-0 left-0 w-2 h-2 ml-1 bg-teal-500 rounded-full;
}
</style>
19 changes: 19 additions & 0 deletions src/components/TheSideBar.vue
Expand Up @@ -12,9 +12,11 @@
</side-bar-button>
<side-bar-button
:to="{ name: 'home' }"
:show-badge="showMenuBadge"
:show-label="displaysTabLabels"
icon="Menu"
title="Show menu"
@click.native="showMenuBadge = false"
@contextmenu.native.prevent="showMenu"
>
Menu
Expand All @@ -33,12 +35,25 @@ export default {
SideBarButton,
TabsNav,
},
data() {
return {
showMenuBadge: false,
};
},
computed: {
displaysTabLabels() {
const key = 'navigation.displayTabLabels';
return this.$store.getters['Settings/byKey'](key);
},
},
created() {
remote.app.on('app-update-available', (info) => {
if (this.$route.name !== 'home') {
this.showMenuBadge = true;
}
this.$store.commit('SET_UPDATE_INFO', info);
});
},
methods: {
showMenu() {
const settingsMenu = remote.Menu.buildFromTemplate([
Expand Down Expand Up @@ -72,6 +87,10 @@ export default {
click: () => this.$router.push({ name: 'settings' }),
},
{ type: 'separator' },
{
label: 'Check for updates…',
click: () => remote.app.emit('app-update-check'),
},
{ role: 'toggledevtools' },
]);
Expand Down

0 comments on commit 6ca22eb

Please sign in to comment.