Skip to content

Commit

Permalink
feat: add setting to enable new version notification
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 10, 2023
1 parent fca870b commit bb8726f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export type GatewayConfig = {
server?: string
}
disableChangelog?: boolean
notifyNewVersions?: boolean
}

interface ValueIdTopic {
Expand Down
8 changes: 6 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,6 @@ export default {
},
async checkChangelog() {
const settings = useBaseStore().gateway
if (settings?.disableChangelog) return
const versions = settings?.versions
// get changelog from github latest release
Expand All @@ -1105,14 +1104,19 @@ export default {
const currentVersion = import.meta.env.VITE_VERSION
const latestVersion = latest.tag_name.replace('v', '')
if (latestVersion !== currentVersion) {
if (
latestVersion !== currentVersion &&
settings.notifyNewVersions
) {
this.showSnackbar(
`New version available: ${latest.tag_name}`,
'info',
15000
)
}
if (settings?.disableChangelog) return
if (versions?.app !== this.appInfo.appVersion) {
const current = await this.getRelease(
'zwave-js-ui',
Expand Down
1 change: 1 addition & 0 deletions src/stores/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const useBaseStore = defineStore('base', {
values: [],
jobs: [],
disableChangelog: false,
notifyNewVersions: false,
},
appInfo: {
homeid: '',
Expand Down
10 changes: 10 additions & 0 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@
"
></v-checkbox>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-checkbox
persistent-hint
label="Notify new versions"
hint="Check this to show a notification when a new version is available"
v-model="
newGateway.notifyNewVersions
"
></v-checkbox>
</v-col>
</v-row>
<v-subheader class="font-weight-bold">
Devices values configuration
Expand Down

0 comments on commit bb8726f

Please sign in to comment.