From 6bfc6996e12ba201f52de586c67f3db4a97bc722 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 4 Jan 2023 19:12:53 +0100 Subject: feat: Show newest version number (#124) * refactor: Move getting new FC version to own func * refactor: Deserialize into object * refactor: Return whole object instead of 2 strings More readable * refactor: Rename variable * refactor: Use fields of object directly instead of assigning to variables first * feat: Expose backend func to get newest FC version and then call it to get newest version number if current is outdated. This way we can display to the user how far behind their currently installed version is. --- src-vue/src/plugins/store.ts | 4 +++- src-vue/src/utils/FlightCoreVersion.d.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src-vue/src/utils/FlightCoreVersion.d.ts (limited to 'src-vue/src') diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index c22479e0..3db85e64 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -5,6 +5,7 @@ import { InstallType } from "../utils/InstallType"; import { invoke } from "@tauri-apps/api"; import { GameInstall } from "../utils/GameInstall"; import { ReleaseCanal } from "../utils/ReleaseCanal"; +import { FlightCoreVersion } from "../utils/FlightCoreVersion"; import { ElNotification, NotificationHandle } from 'element-plus'; import { NorthstarState } from '../utils/NorthstarState'; import { appDir } from '@tauri-apps/api/path'; @@ -377,9 +378,10 @@ async function _checkForFlightCoreUpdates(state: FlightCoreStore) { let flightcore_is_outdated = await invoke("check_is_flightcore_outdated_caller") as boolean; if (flightcore_is_outdated) { + let newest_flightcore_version = await invoke("get_newest_flightcore_version") as FlightCoreVersion; ElNotification({ title: 'FlightCore outdated!', - message: `Please update FlightCore. Running outdated version ${state.flightcore_version}`, + message: `Please update FlightCore.\nRunning outdated version ${state.flightcore_version}.\nNewest is ${newest_flightcore_version.tag_name}!`, type: 'warning', position: 'bottom-right', duration: 0 // Duration `0` means the notification will not auto-vanish diff --git a/src-vue/src/utils/FlightCoreVersion.d.ts b/src-vue/src/utils/FlightCoreVersion.d.ts new file mode 100644 index 00000000..2516bf25 --- /dev/null +++ b/src-vue/src/utils/FlightCoreVersion.d.ts @@ -0,0 +1,5 @@ +// derived from release_notes.rs +export interface FlightCoreVersion { + tag_name: string, + published_at: string, +} -- cgit v1.2.3