From 92b7a14bac0acc7ffa79ea1fbcf7db95e28bb5a9 Mon Sep 17 00:00:00 2001 From: Robert Ende Date: Wed, 17 Oct 2018 21:25:19 +0200 Subject: [PATCH] feat: added showing changelog dialog when using newer version for the first time --- package.json | 1 + src/Map.vue | 12 ++++++++++++ yarn.lock | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/package.json b/package.json index 6360af2f..b346a542 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "raf": "^3.4.0", "raven-js": "^3.25.2", "replace": "^1.0.0", + "semver": "^5.6.0", "standard-version": "^4.4.0", "typeface-roboto": "^0.0.54", "vue": "^2.5.16", diff --git a/src/Map.vue b/src/Map.vue index 9b97cb14..6353d44b 100644 --- a/src/Map.vue +++ b/src/Map.vue @@ -635,6 +635,7 @@ import { VToolbar, } from "vuetify"; import Raven from "raven-js"; +import semver from "semver"; import githubIcon from "./assets/svg/github.svg"; @@ -716,6 +717,7 @@ export default { selectedMap: this.fromStorage("selectedMap", undefined), // selected map in top selector delayCalcUpdate: this.fromStorage("delayCalcUpdate", "true") === "true", hideLoadingBar: this.fromStorage("hideLoadingBar", "true") === "true", + storedVersion: this.fromStorage("version", "v0.0.0"), mouseKeypad: "LOL", // keypad shown in bottom left corner showKeypadTimeout: undefined, // value of timeout, set when mouse is moved, set undefined after 1 sec calcTimeout: undefined, // value of timeout for delayed calculations set, see calcMortar() @@ -857,6 +859,16 @@ export default { this.map.invalidateSize(); if (executions === 0) { clearInterval(interval); } }, 250); + + if (semver.gt(pkgVersion, this.storedVersion)) { + // if first view of new version + + // open changelog + this.changelogDialog = true; + + // put new version into localstorage + this.toStorage("version", pkgVersion); + } }, methods: { /** diff --git a/yarn.lock b/yarn.lock index 044a55e5..258f9fd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6505,6 +6505,10 @@ selfsigned@^1.9.1: version "5.5.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" +semver@^5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + send@0.16.2: version "0.16.2" resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1"