From 1e938adc5d8eb5ad16ab16342375eecd88f68d20 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Sun, 11 Apr 2021 12:35:16 +0200 Subject: [PATCH] feat: in-app last release changelog --- package.json | 1 + src/renderer/App.vue | 4 +- src/renderer/components/ModalSettings.vue | 90 +++++++++++-------- .../components/ModalSettingsChangelog.vue | 78 ++++++++++++++++ src/renderer/i18n/en-US.js | 3 +- .../store/modules/application.store.js | 15 ++++ 6 files changed, 153 insertions(+), 38 deletions(-) create mode 100644 src/renderer/components/ModalSettingsChangelog.vue diff --git a/package.json b/package.json index 4f8d2711..90e036f9 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "electron-updater": "^4.3.5", "faker": "^5.3.1", "keytar": "^7.3.0", + "marked": "^2.0.2", "moment": "^2.29.1", "mssql": "^6.2.3", "mysql2": "^2.2.5", diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 783699d4..56adbb74 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -58,6 +58,7 @@ export default { }, mounted () { ipcRenderer.send('check-for-updates'); + this.checkVersionUpdate(); const Menu = remote.Menu; @@ -100,7 +101,8 @@ export default { }, methods: { ...mapActions({ - showNewConnModal: 'application/showNewConnModal' + showNewConnModal: 'application/showNewConnModal', + checkVersionUpdate: 'application/checkVersionUpdate' }) } }; diff --git a/src/renderer/components/ModalSettings.vue b/src/renderer/components/ModalSettings.vue index 16cb7503..eacdb281 100644 --- a/src/renderer/components/ModalSettings.vue +++ b/src/renderer/components/ModalSettings.vue @@ -37,6 +37,14 @@ > {{ $t('word.update') }} +
  • + {{ $t('word.changelog') }} +
  • +
    + +
    @@ -233,6 +244,7 @@ import { mapActions, mapGetters } from 'vuex'; import localesNames from '@/i18n/supported-locales'; import ModalSettingsUpdate from '@/components/ModalSettingsUpdate'; +import ModalSettingsChangelog from '@/components/ModalSettingsChangelog'; import BaseTextEditor from '@/components/BaseTextEditor'; const { shell } = require('electron'); @@ -240,6 +252,7 @@ export default { name: 'ModalSettings', components: { ModalSettingsUpdate, + ModalSettingsChangelog, BaseTextEditor }, data () { @@ -394,53 +407,58 @@ ORDER BY diff --git a/src/renderer/i18n/en-US.js b/src/renderer/i18n/en-US.js index 542779ad..f17b2063 100644 --- a/src/renderer/i18n/en-US.js +++ b/src/renderer/i18n/en-US.js @@ -103,7 +103,8 @@ module.exports = { processes: 'Processes', database: 'Database', scratchpad: 'Scratchpad', - array: 'Array' + array: 'Array', + changelog: 'Changelog' }, message: { appWelcome: 'Welcome to Antares SQL Client!', diff --git a/src/renderer/store/modules/application.store.js b/src/renderer/store/modules/application.store.js index f210fda1..ec70b78f 100644 --- a/src/renderer/store/modules/application.store.js +++ b/src/renderer/store/modules/application.store.js @@ -1,10 +1,14 @@ 'use strict'; +import Store from 'electron-store'; +const persistentStore = new Store({ name: 'settings' }); + export default { namespaced: true, strict: true, state: { app_name: 'Antares - SQL Client', app_version: process.env.PACKAGE_VERSION || 0, + cached_version: persistentStore.get('cached_version', 0), is_loading: false, is_new_modal: false, is_setting_modal: false, @@ -19,6 +23,7 @@ export default { isLoading: state => state.is_loading, appName: state => state.app_name, appVersion: state => state.app_version, + cachedVersion: state => state.cached_version, getBaseCompleter: state => state.base_completer, getSelectedConnection: state => state.selected_conection, isNewModal: state => state.is_new_modal, @@ -54,6 +59,10 @@ export default { HIDE_SCRATCHPAD (state) { state.is_scratchpad = false; }, + CHANGE_CACHED_VERSION (state) { + state.cached_version = state.app_version; + persistentStore.set('cached_version', state.cached_version); + }, CHANGE_UPDATE_STATUS (state, status) { state.update_status = status; }, @@ -62,6 +71,12 @@ export default { } }, actions: { + checkVersionUpdate ({ getters, commit, dispatch }) { + if (getters.appVersion !== getters.cachedVersion) { + dispatch('showSettingModal', 'changelog'); + commit('CHANGE_CACHED_VERSION'); + } + }, setLoadingStatus ({ commit }, payload) { commit('SET_LOADING_STATUS', payload); },