mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
add whats new dialog
This commit is contained in:
@@ -5,6 +5,10 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { logWebRequest } from '../services/appConfig';
|
||||
import { branches } from '../shared/constants';
|
||||
import {
|
||||
getWhatsNewRelease,
|
||||
getWhatsNewReleaseKey
|
||||
} from '../shared/constants/whatsNewReleases';
|
||||
import { changeLogRemoveLinks } from '../shared/utils';
|
||||
|
||||
import configRepository from '../services/config';
|
||||
@@ -36,6 +40,12 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
buildName: '',
|
||||
changeLog: ''
|
||||
});
|
||||
const whatsNewDialog = ref({
|
||||
visible: false,
|
||||
version: '',
|
||||
releaseKey: '',
|
||||
items: []
|
||||
});
|
||||
const pendingVRCXUpdate = ref(false);
|
||||
const pendingVRCXInstall = ref('');
|
||||
const updateInProgress = ref(false);
|
||||
@@ -73,7 +83,7 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
await loadVrcxId();
|
||||
|
||||
if (await compareAppVersion()) {
|
||||
showChangeLogDialog();
|
||||
await showWhatsNewDialog();
|
||||
}
|
||||
if (autoUpdateVRCX.value !== 'Off') {
|
||||
await checkForVRCXUpdate();
|
||||
@@ -134,6 +144,56 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
function getCurrentWhatsNewReleaseKey() {
|
||||
return getWhatsNewReleaseKey(currentVersion.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async function showWhatsNewDialog() {
|
||||
const releaseKey = getCurrentWhatsNewReleaseKey();
|
||||
const release = getWhatsNewRelease(releaseKey);
|
||||
|
||||
if (!release) {
|
||||
whatsNewDialog.value = {
|
||||
visible: false,
|
||||
version: '',
|
||||
releaseKey: '',
|
||||
items: []
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
const displayVersion = currentVersion.value.replace(/^VRCX\s+/, '');
|
||||
|
||||
whatsNewDialog.value = {
|
||||
visible: true,
|
||||
version: release.releaseLabel || displayVersion,
|
||||
releaseKey,
|
||||
items: release.items.map((item) => ({ ...item }))
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function closeWhatsNewDialog() {
|
||||
whatsNewDialog.value.visible = false;
|
||||
}
|
||||
|
||||
async function openChangeLogDialogOnly() {
|
||||
changeLogDialog.value.visible = true;
|
||||
if (
|
||||
!changeLogDialog.value.buildName ||
|
||||
!changeLogDialog.value.changeLog
|
||||
) {
|
||||
await checkForVRCXUpdate();
|
||||
}
|
||||
}
|
||||
async function loadVrcxId() {
|
||||
if (!vrcxId.value) {
|
||||
vrcxId.value = crypto.randomUUID();
|
||||
@@ -416,6 +476,7 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
checkingForVRCXUpdate,
|
||||
VRCXUpdateDialog,
|
||||
changeLogDialog,
|
||||
whatsNewDialog,
|
||||
pendingVRCXUpdate,
|
||||
pendingVRCXInstall,
|
||||
updateInProgress,
|
||||
@@ -426,6 +487,9 @@ export const useVRCXUpdaterStore = defineStore('VRCXUpdater', () => {
|
||||
setBranch,
|
||||
|
||||
compareAppVersion,
|
||||
showWhatsNewDialog,
|
||||
closeWhatsNewDialog,
|
||||
openChangeLogDialogOnly,
|
||||
checkForVRCXUpdate,
|
||||
loadBranchVersions,
|
||||
installVRCXUpdate,
|
||||
|
||||
Reference in New Issue
Block a user