From 231cf5abe4e99f851653a1b183fc2fd75493145b Mon Sep 17 00:00:00 2001 From: Natsumi Date: Tue, 4 Oct 2022 21:45:30 +1300 Subject: [PATCH] Version file 2 --- html/src/app.js | 52 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/html/src/app.js b/html/src/app.js index 53f2feb2..244444ff 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4336,6 +4336,7 @@ speechSynthesis.getVoices(); mounted() { AppApi.GetVersion().then((version) => { this.appVersion = version; + this.comapreAppVersion(); }); API.$on('SHOW_WORLD_DIALOG', (tag) => this.showWorldDialog(tag)); API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag)); @@ -4393,6 +4394,38 @@ speechSynthesis.getVoices(); }); }; + $app.methods.comapreAppVersion = function () { + if (!this.appVersion) { + return; + } + var lastVersion = configRepository.getString('VRCX_lastVRCXVersion'); + if (!lastVersion) { + configRepository.setString('VRCX_lastVRCXVersion', this.appVersion); + return; + } + if (lastVersion < this.appVersion) { + configRepository.setString('VRCX_lastVRCXVersion', this.appVersion); + if (configRepository.getString('VRCX_branch') === 'Stable') { + this.openChangeLog(); + } + } + }; + + $app.methods.openChangeLog = function () { + this.$confirm('Open Change Log?', 'VRCX has updated', { + confirmButtonText: 'Open', + cancelButtonText: 'Close', + type: 'info', + callback: (action) => { + if (action === 'confirm') { + AppApi.OpenLink( + 'https://github.com/pypy-vrc/VRCX/releases/latest' + ); + } + } + }); + }; + $app.methods.languageClass = function (language) { var style = {}; var mapping = languageMappings[language]; @@ -12421,22 +12454,6 @@ speechSynthesis.getVoices(); $app.data.branch = 'Stable'; configRepository.setString('VRCX_branch', $app.data.branch); } - if (configRepository.getString('VRCX_lastVRCXVersion')) { - if ( - configRepository.getString('VRCX_lastVRCXVersion') < - $app.data.appVersion - ) { - configRepository.setString( - 'VRCX_lastVRCXVersion', - $app.data.appVersion - ); - } - } else { - configRepository.setString( - 'VRCX_lastVRCXVersion', - $app.data.appVersion - ); - } if (!configRepository.getInt('VRCX_maxTableSize')) { $app.data.maxTableSize = 1000; configRepository.getInt('VRCX_maxTableSize', $app.data.maxTableSize); @@ -19704,9 +19721,8 @@ speechSynthesis.getVoices(); if ( !this.appVersion || this.appVersion === 'VRCX Nightly Build' || - this.appVersion === 'VRCX Stable' + this.appVersion === 'VRCX Build' ) { - console.log('Skipping VRCX update check, version is null'); return; } if (this.branch === 'Beta') {