From dd63500202f1bac0d7db83ab2d8c761a144f4eeb Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 11 Mar 2026 01:08:11 +0800 Subject: [PATCH] reorder the button display order --- src/lib/cache.ts | 34 +++++++++---------- .../AppBrowserCacheSettingPageBase.ts | 4 +-- .../tabs/AppBrowserCacheSettingTab.vue | 22 ++++++------ .../settings/BrowserCacheSettingPage.vue | 16 ++++----- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/lib/cache.ts b/src/lib/cache.ts index 056fdca5..54f52321 100644 --- a/src/lib/cache.ts +++ b/src/lib/cache.ts @@ -212,23 +212,6 @@ export function updateMapCacheExpiration(expireSeconds: number): void { } } -export function clearMapDataCache(): Promise { - if (!window.caches) { - logger.error('caches API is not supported in this browser'); - return Promise.reject(); - } - - return window.caches.delete(SW_MAP_CACHE_NAME).then(success => { - if (success) { - logger.info(`cache "${SW_MAP_CACHE_NAME}" cleared successfully`); - } else { - logger.warn(`failed to clear cache "${SW_MAP_CACHE_NAME}"`); - } - }).catch(error => { - logger.error(`failed to clear cache "${SW_MAP_CACHE_NAME}"`, error); - }); -} - export function clearApplicationCodeCache(): Promise { if (!window.caches) { logger.error('caches API is not supported in this browser'); @@ -246,6 +229,23 @@ export function clearApplicationCodeCache(): Promise { }); } +export function clearMapDataCache(): Promise { + if (!window.caches) { + logger.error('caches API is not supported in this browser'); + return Promise.reject(); + } + + return window.caches.delete(SW_MAP_CACHE_NAME).then(success => { + if (success) { + logger.info(`cache "${SW_MAP_CACHE_NAME}" cleared successfully`); + } else { + logger.warn(`failed to clear cache "${SW_MAP_CACHE_NAME}"`); + } + }).catch(error => { + logger.error(`failed to clear cache "${SW_MAP_CACHE_NAME}"`, error); + }); +} + export function clearAllBrowserCaches(): Promise { if (!window.caches) { logger.error('caches API is not supported in this browser'); diff --git a/src/views/base/settings/AppBrowserCacheSettingPageBase.ts b/src/views/base/settings/AppBrowserCacheSettingPageBase.ts index 67ce4f2d..3eda38b5 100644 --- a/src/views/base/settings/AppBrowserCacheSettingPageBase.ts +++ b/src/views/base/settings/AppBrowserCacheSettingPageBase.ts @@ -11,8 +11,8 @@ import { type BrowserCacheStatistics } from '@/core/cache.ts'; import { loadBrowserCacheStatistics, updateMapCacheExpiration, - clearMapDataCache, clearApplicationCodeCache, + clearMapDataCache, clearAllBrowserCaches } from '@/lib/cache.ts'; @@ -115,8 +115,8 @@ export function useAppBrowserCacheSettingPageBase() { exchangeRatesDataCacheExpiration, // functions loadCacheStatistics, - clearMapDataCache, clearApplicationCodeCache, + clearMapDataCache, clearAllBrowserCaches, clearExchangeRatesDataCache }; diff --git a/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue b/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue index 142dc3c6..a7e4bdc9 100644 --- a/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue +++ b/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue @@ -68,14 +68,14 @@ - - {{ tt('Clear Map Data Cache') }} - {{ tt('Clear Application Code Cache') }} + + {{ tt('Clear Map Data Cache') }} + {{ tt('Clear All File Cache') }} @@ -183,25 +183,25 @@ const { mapCacheExpiration, exchangeRatesDataCacheExpiration, loadCacheStatistics, - clearMapDataCache, clearApplicationCodeCache, + clearMapDataCache, clearAllBrowserCaches, clearExchangeRatesDataCache } = useAppBrowserCacheSettingPageBase(); const confirmDialog = useTemplateRef('confirmDialog'); -function clearMapCache(): void { - confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => { - clearMapDataCache().then(() => { +function clearApplicationCodeFileCache(): void { + confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => { + clearApplicationCodeCache().then(() => { loadCacheStatistics(true); }); }); } -function clearApplicationCodeFileCache(): void { - confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => { - clearApplicationCodeCache().then(() => { +function clearMapCache(): void { + confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => { + clearMapDataCache().then(() => { loadCacheStatistics(true); }); }); diff --git a/src/views/mobile/settings/BrowserCacheSettingPage.vue b/src/views/mobile/settings/BrowserCacheSettingPage.vue index 22b742ef..c2d79fa2 100644 --- a/src/views/mobile/settings/BrowserCacheSettingPage.vue +++ b/src/views/mobile/settings/BrowserCacheSettingPage.vue @@ -99,10 +99,10 @@ - {{ tt('Clear Map Data Cache') }} {{ tt('Clear Application Code Cache') }} + {{ tt('Clear Map Data Cache') }} {{ tt('Clear All File Cache') }} @@ -160,17 +160,17 @@ function reloadCacheStatistics(done?: () => void): void { }); } -function clearMapCache(): void { - showConfirm('Are you sure you want to clear map data cache?', () => { - clearMapDataCache().then(() => { +function clearApplicationCodeFileCache(): void { + showConfirm('Are you sure you want to clear application code cache?', () => { + clearApplicationCodeCache().then(() => { loadCacheStatistics(true); }); }); } -function clearApplicationCodeFileCache(): void { - showConfirm('Are you sure you want to clear application code cache?', () => { - clearApplicationCodeCache().then(() => { +function clearMapCache(): void { + showConfirm('Are you sure you want to clear map data cache?', () => { + clearMapDataCache().then(() => { loadCacheStatistics(true); }); });