support setting exchange rate cache expiration time
This commit is contained in:
@@ -114,6 +114,7 @@ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', fun
|
||||
|
||||
let localeDefaultSettings = initLocale(userStore.currentUserLanguage, settingsStore.appSettings.timeZone);
|
||||
settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||
exchangeRatesStore.removeExpiredExchangeRates(true);
|
||||
|
||||
setExpenseAndIncomeAmountColor(userStore.currentUserExpenseAmountColor, userStore.currentUserIncomeAmountColor);
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ watch(currentNotificationContent, (newValue) => {
|
||||
|
||||
let localeDefaultSettings = initLocale(userStore.currentUserLanguage, settingsStore.appSettings.timeZone);
|
||||
settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||
exchangeRatesStore.removeExpiredExchangeRates(true);
|
||||
|
||||
setExpenseAndIncomeAmountColor(userStore.currentUserExpenseAmountColor, userStore.currentUserIncomeAmountColor);
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ export interface ApplicationSettings extends BaseApplicationSetting {
|
||||
currencySortByInExchangeRatesPage: number;
|
||||
// Browser Cache Settings
|
||||
mapCacheExpiration: number,
|
||||
exchangeRatesDataCacheExpiration: number,
|
||||
// Statistics Settings
|
||||
statistics: {
|
||||
defaultChartDataType: number;
|
||||
@@ -191,6 +192,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = {
|
||||
currencySortByInExchangeRatesPage: CurrencySortingType.Default.type,
|
||||
// Browser Cache Settings
|
||||
mapCacheExpiration: -1,
|
||||
exchangeRatesDataCacheExpiration: 0,
|
||||
// Statistics Settings
|
||||
statistics: {
|
||||
defaultChartDataType: ChartDataType.Default.type,
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Sind Sie sicher, dass Sie sich erneut anmelden möchten?",
|
||||
"Exchange Rates Data": "Wechselkursdaten",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Are you sure you want to re-login?",
|
||||
"Exchange Rates Data": "Exchange Rates Data",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "¿Seguro que deseas volver a iniciar sesión?",
|
||||
"Exchange Rates Data": "Tipos de Cambio",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Êtes-vous sûr de vouloir vous reconnecter ?",
|
||||
"Exchange Rates Data": "Données de taux de change",
|
||||
"User Custom": "Personnalisé utilisateur",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Sei sicuro di voler accedere di nuovo?",
|
||||
"Exchange Rates Data": "Dati tassi di cambio",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "再ログインしますか?",
|
||||
"Exchange Rates Data": "為替レートデータ",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "ಮತ್ತೆ ಲಾಗಿನ್ ಮಾಡಲು ನೀವು ಖಚಿತವೇ?",
|
||||
"Exchange Rates Data": "ವಿನಿಮಯ ದರ ಡೇಟಾ",
|
||||
"User Custom": "ಬಳಕೆದಾರ ಕಸ್ಟಮ್",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "다시 로그인하시겠습니까?",
|
||||
"Exchange Rates Data": "환율 데이터",
|
||||
"User Custom": "사용자 정의",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Weet je zeker dat je opnieuw wilt inloggen?",
|
||||
"Exchange Rates Data": "Wisselkoersgegevens",
|
||||
"User Custom": "Gebruiker aangepast",
|
||||
|
||||
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Tem certeza de que deseja fazer login novamente?",
|
||||
"Exchange Rates Data": "Dados de Taxas de Câmbio",
|
||||
"User Custom": "Personalização do Usuário",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Вы уверены, что хотите войти снова?",
|
||||
"Exchange Rates Data": "Данные о курсах валют",
|
||||
"User Custom": "Пользовательские настройки",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Ali ste prepričani, da se želite ponovno prijaviti?",
|
||||
"Exchange Rates Data": "Podatki o menjalnih tečajih",
|
||||
"User Custom": "Uporabniške nastavitve po meri",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "மீண்டும் உள்நுழை செய்ய நீங்கள் உறுதியா?",
|
||||
"Exchange Rates Data": "மாற்று விகிதம் தரவு",
|
||||
"User Custom": "தனிப்பயன்",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "คุณแน่ใจหรือว่าต้องการเข้าสู่ระบบอีกครั้ง?",
|
||||
"Exchange Rates Data": "ข้อมูลอัตราแลกเปลี่ยน",
|
||||
"User Custom": "กำหนดเองโดยผู้ใช้",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Tekrar giriş yapmak istediğinize emin misiniz?",
|
||||
"Exchange Rates Data": "Döviz Kuru Verileri",
|
||||
"User Custom": "Kullanıcı Özel",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Ви впевнені, що хочете увійти знову?",
|
||||
"Exchange Rates Data": "Дані про курси валют",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
+4
-1
@@ -2514,11 +2514,14 @@
|
||||
"Others": "Others",
|
||||
"Cache Expiration Time": "Cache Expiration Time",
|
||||
"Cache Expiration for Map Data": "Cache Expiration for Map Data",
|
||||
"Disable Map Cache": "Disable Map Cache",
|
||||
"Cache Expiration for Exchange Rates Data": "Cache Expiration for Exchange Rates Data",
|
||||
"Disable Cache": "Disable Cache",
|
||||
"Clear All File Cache": "Clear All File Cache",
|
||||
"Are you sure you want to clear all file cache?": "Are you sure you want to clear all file cache?",
|
||||
"Clear Map Data Cache": "Clear Map Data Cache",
|
||||
"Are you sure you want to clear map data cache?": "Are you sure you want to clear map data cache?",
|
||||
"Clear Exchange Rates Data Cache": "Clear Exchange Rates Data Cache",
|
||||
"Are you sure you want to clear exchange rates data cache?": "Are you sure you want to clear exchange rates data cache?",
|
||||
"Are you sure you want to re-login?": "Bạn có chắc chắn muốn đăng nhập lại không?",
|
||||
"Exchange Rates Data": "Dữ liệu tỷ giá hối đoái",
|
||||
"User Custom": "User Custom",
|
||||
|
||||
@@ -2514,11 +2514,14 @@
|
||||
"Others": "其他",
|
||||
"Cache Expiration Time": "缓存过期时间",
|
||||
"Cache Expiration for Map Data": "地图数据缓存过期时间",
|
||||
"Disable Map Cache": "禁用地图缓存",
|
||||
"Cache Expiration for Exchange Rates Data": "汇率数据缓存过期时间",
|
||||
"Disable Cache": "禁用缓存",
|
||||
"Clear All File Cache": "清除所有文件缓存",
|
||||
"Are you sure you want to clear all file cache?": "您确定要清除所有文件缓存?",
|
||||
"Clear Map Data Cache": "清除地图数据缓存",
|
||||
"Are you sure you want to clear map data cache?": "您确定要清除地图数据缓存?",
|
||||
"Clear Exchange Rates Data Cache": "清除汇率数据缓存",
|
||||
"Are you sure you want to clear exchange rates data cache?": "您确定要清除汇率数据缓存?",
|
||||
"Are you sure you want to re-login?": "您确定要重新登录?",
|
||||
"Exchange Rates Data": "汇率数据",
|
||||
"User Custom": "用户自定义",
|
||||
|
||||
@@ -2514,11 +2514,14 @@
|
||||
"Others": "其他",
|
||||
"Cache Expiration Time": "快取過期時間",
|
||||
"Cache Expiration for Map Data": "地圖資料快取過期時間",
|
||||
"Disable Map Cache": "停用地圖快取",
|
||||
"Cache Expiration for Exchange Rates Data": "匯率資料快取過期時間",
|
||||
"Disable Cache": "停用快取",
|
||||
"Clear All File Cache": "清除所有檔案快取",
|
||||
"Are you sure you want to clear all file cache?": "您確定要清除所有檔案快取?",
|
||||
"Clear Map Data Cache": "清除地圖資料快取",
|
||||
"Are you sure you want to clear map data cache?": "您確定要清除地圖資料快取?",
|
||||
"Clear Exchange Rates Data Cache": "清除匯率資料快取",
|
||||
"Are you sure you want to clear exchange rates data cache?": "您確定要清除匯率資料快取?",
|
||||
"Are you sure you want to re-login?": "您確定要重新登入?",
|
||||
"Exchange Rates Data": "匯率資料",
|
||||
"User Custom": "使用者自訂",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { useSettingsStore } from './setting.ts';
|
||||
|
||||
import { type BeforeResolveFunction, itemAndIndex } from '@/core/base.ts';
|
||||
|
||||
import type {
|
||||
@@ -47,8 +49,12 @@ function clearExchangeRatesFromLocalStorage(): void {
|
||||
}
|
||||
|
||||
export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||
const settingsStore = useSettingsStore();
|
||||
|
||||
const latestExchangeRates = ref<LatestExchangeRates>(getExchangeRatesFromLocalStorage());
|
||||
|
||||
const exchangeRatesDataCacheEnabled = computed<boolean>(() => settingsStore.appSettings.exchangeRatesDataCacheExpiration >= 0);
|
||||
|
||||
const isUserCustomExchangeRates = computed((): boolean => {
|
||||
if (!latestExchangeRates.value || !latestExchangeRates.value.data) {
|
||||
return false;
|
||||
@@ -99,7 +105,7 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||
|
||||
latestExchangeRates.value.data.updateTime = updateTime;
|
||||
|
||||
if (changed) {
|
||||
if (exchangeRatesDataCacheEnabled.value && changed) {
|
||||
setExchangeRatesToLocalStorage(latestExchangeRates.value);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +126,7 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
if (exchangeRatesDataCacheEnabled.value && changed) {
|
||||
setExchangeRatesToLocalStorage(latestExchangeRates.value);
|
||||
}
|
||||
}
|
||||
@@ -135,6 +141,29 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||
return new Blob([storageData]).size;
|
||||
}
|
||||
|
||||
function removeExpiredExchangeRates(removeDataInStore?: boolean): void {
|
||||
if (settingsStore.appSettings.exchangeRatesDataCacheExpiration > 0) {
|
||||
const currentExchangeRateData = latestExchangeRates.value;
|
||||
const now = getCurrentUnixTime();
|
||||
|
||||
if (currentExchangeRateData && currentExchangeRateData.time) {
|
||||
if (now - currentExchangeRateData.time >= settingsStore.appSettings.exchangeRatesDataCacheExpiration) {
|
||||
if (removeDataInStore) {
|
||||
resetLatestExchangeRates();
|
||||
} else {
|
||||
clearExchangeRatesFromLocalStorage();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (settingsStore.appSettings.exchangeRatesDataCacheExpiration < 0) { // Disable Cache
|
||||
if (removeDataInStore) {
|
||||
resetLatestExchangeRates();
|
||||
} else {
|
||||
clearExchangeRatesFromLocalStorage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetLatestExchangeRates(): void {
|
||||
latestExchangeRates.value = {};
|
||||
clearExchangeRatesFromLocalStorage();
|
||||
@@ -172,11 +201,13 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
latestExchangeRates.value = {
|
||||
time: now,
|
||||
data: data.result
|
||||
};
|
||||
setExchangeRatesToLocalStorage(latestExchangeRates.value);
|
||||
if (exchangeRatesDataCacheEnabled.value) {
|
||||
latestExchangeRates.value = {
|
||||
time: now,
|
||||
data: data.result
|
||||
};
|
||||
setExchangeRatesToLocalStorage(latestExchangeRates.value);
|
||||
}
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
@@ -298,6 +329,7 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||
latestExchangeRateMap,
|
||||
// functions
|
||||
getExchangeRatesCacheSize,
|
||||
removeExpiredExchangeRates,
|
||||
resetLatestExchangeRates,
|
||||
getLatestExchangeRates,
|
||||
updateUserCustomExchangeRate,
|
||||
|
||||
@@ -316,6 +316,11 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
appSettings.value.mapCacheExpiration = value;
|
||||
}
|
||||
|
||||
function setExchangeRatesDataCacheExpiration(value: number): void {
|
||||
updateApplicationSettingsValue('exchangeRatesDataCacheExpiration', value);
|
||||
appSettings.value.exchangeRatesDataCacheExpiration = value;
|
||||
}
|
||||
|
||||
// Statistics Settings
|
||||
function setStatisticsDefaultChartDataType(value: number): void {
|
||||
updateApplicationSettingsSubValue('statistics', 'defaultChartDataType', value);
|
||||
@@ -539,6 +544,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
setCurrencySortByInExchangeRatesPage,
|
||||
// -- Browser Cache Settings
|
||||
setMapCacheExpiration,
|
||||
setExchangeRatesDataCacheExpiration,
|
||||
// -- Statistics Settings
|
||||
setStatisticsDefaultChartDataType,
|
||||
setStatisticsDefaultTimezoneType,
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
import { useI18n } from '@/locales/helpers.ts';
|
||||
|
||||
import { useSettingsStore } from '@/stores/setting.ts';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.ts';
|
||||
|
||||
import { type NameNumeralValue } from '@/core/base.ts';
|
||||
import { type BrowserCacheStatistics } from '@/core/cache.ts';
|
||||
|
||||
import {
|
||||
loadBrowserCacheStatistics,
|
||||
updateMapCacheExpiration,
|
||||
clearMapDataCache,
|
||||
clearAllBrowserCaches
|
||||
} from '@/lib/cache.ts';
|
||||
|
||||
export function useAppBrowserCacheSettingPageBase() {
|
||||
const { tt, formatNumberToLocalizedNumerals } = useI18n();
|
||||
|
||||
const isSupportedFileCache: boolean = 'serviceWorker' in navigator && !!navigator.serviceWorker.controller;
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
const exchangeRatesStore = useExchangeRatesStore();
|
||||
|
||||
const loading = ref<boolean>(true);
|
||||
const fileCacheStatistics = ref<BrowserCacheStatistics | undefined>(undefined);
|
||||
const exchangeRatesCacheSize = ref<number | undefined>(undefined);
|
||||
|
||||
const allMapCacheExpirationOptions = computed<NameNumeralValue[]>(() => {
|
||||
return [
|
||||
{ name: tt('Disable Cache'), value: -1 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(1) }), value: 86400 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(7) }), value: 604800 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(30) }), value: 2592000 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(90) }), value: 7776000 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(180) }), value: 15552000 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(365) }), value: 31536000 },
|
||||
{ name: tt('No Expiration'), value: 0 }
|
||||
];
|
||||
});
|
||||
|
||||
const allExchangeRatesDataCacheExpirationOptions = computed<NameNumeralValue[]>(() => {
|
||||
return [
|
||||
{ name: tt('Disable Cache'), value: -1 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(1) }), value: 86400 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(7) }), value: 604800 },
|
||||
{ name: tt('format.misc.nDays', { n: formatNumberToLocalizedNumerals(30) }), value: 2592000 },
|
||||
{ name: tt('No Expiration'), value: 0 }
|
||||
];
|
||||
});
|
||||
|
||||
const mapCacheExpiration = computed<number>({
|
||||
get: () => isSupportedFileCache ? settingsStore.appSettings.mapCacheExpiration : -1,
|
||||
set: (value) => {
|
||||
settingsStore.setMapCacheExpiration(value);
|
||||
|
||||
if (isSupportedFileCache) {
|
||||
updateMapCacheExpiration(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const exchangeRatesDataCacheExpiration = computed<number>({
|
||||
get: () => settingsStore.appSettings.exchangeRatesDataCacheExpiration,
|
||||
set: (value) => {
|
||||
settingsStore.setExchangeRatesDataCacheExpiration(value);
|
||||
exchangeRatesStore.removeExpiredExchangeRates(true);
|
||||
exchangeRatesCacheSize.value = exchangeRatesStore.getExchangeRatesCacheSize();
|
||||
}
|
||||
});
|
||||
|
||||
function loadCacheStatistics(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
loading.value = true;
|
||||
|
||||
loadBrowserCacheStatistics().then(statistics => {
|
||||
fileCacheStatistics.value = statistics;
|
||||
exchangeRatesCacheSize.value = exchangeRatesStore.getExchangeRatesCacheSize();
|
||||
loading.value = false;
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
loading.value = false;
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function clearExchangeRatesDataCache(): void {
|
||||
exchangeRatesStore.resetLatestExchangeRates();
|
||||
exchangeRatesCacheSize.value = exchangeRatesStore.getExchangeRatesCacheSize();
|
||||
}
|
||||
|
||||
return {
|
||||
// constants
|
||||
isSupportedFileCache,
|
||||
// states
|
||||
loading,
|
||||
fileCacheStatistics,
|
||||
exchangeRatesCacheSize,
|
||||
// computed states
|
||||
allMapCacheExpirationOptions,
|
||||
allExchangeRatesDataCacheExpirationOptions,
|
||||
mapCacheExpiration,
|
||||
exchangeRatesDataCacheExpiration,
|
||||
// functions
|
||||
loadCacheStatistics,
|
||||
clearMapDataCache,
|
||||
clearAllBrowserCaches,
|
||||
clearExchangeRatesDataCache
|
||||
};
|
||||
}
|
||||
@@ -92,6 +92,13 @@
|
||||
<span class="text-body-1">{{ tt('Used storage') }}</span>
|
||||
<span class="text-xl ms-1">{{ formatVolumeToLocalizedNumerals(exchangeRatesCacheSize ?? 0, 2) }}</span>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-text class="mt-2">
|
||||
<v-btn color="secondary" variant="tonal"
|
||||
:disabled="loading || !exchangeRatesCacheSize" @click="clearExchangeRatesCache()">
|
||||
{{ tt('Clear Exchange Rates Data Cache') }}
|
||||
</v-btn>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
@@ -112,6 +119,18 @@
|
||||
v-model="mapCacheExpiration"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6">
|
||||
<v-select
|
||||
item-title="name"
|
||||
item-value="value"
|
||||
persistent-placeholder
|
||||
:disabled="loading"
|
||||
:label="tt('Cache Expiration for Exchange Rates Data')"
|
||||
:placeholder="tt('Cache Expiration for Exchange Rates Data')"
|
||||
:items="allExchangeRatesDataCacheExpirationOptions"
|
||||
v-model="exchangeRatesDataCacheExpiration"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-form>
|
||||
@@ -155,10 +174,13 @@ const {
|
||||
fileCacheStatistics,
|
||||
exchangeRatesCacheSize,
|
||||
allMapCacheExpirationOptions,
|
||||
allExchangeRatesDataCacheExpirationOptions,
|
||||
mapCacheExpiration,
|
||||
exchangeRatesDataCacheExpiration,
|
||||
loadCacheStatistics,
|
||||
clearMapDataCache,
|
||||
clearAllBrowserCaches
|
||||
clearAllBrowserCaches,
|
||||
clearExchangeRatesDataCache
|
||||
} = useAppBrowserCacheSettingPageBase();
|
||||
|
||||
const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
|
||||
@@ -179,5 +201,11 @@ function clearAllFileCache(): void {
|
||||
});
|
||||
}
|
||||
|
||||
function clearExchangeRatesCache(): void {
|
||||
confirmDialog.value?.open('Are you sure you want to clear exchange rates data cache?').then(() => {
|
||||
clearExchangeRatesDataCache();
|
||||
});
|
||||
}
|
||||
|
||||
loadCacheStatistics();
|
||||
</script>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<f7-nav-left :class="{ 'disabled': loading }" :back-link="tt('Back')"></f7-nav-left>
|
||||
<f7-nav-title :title="tt('Browser Cache Management')"></f7-nav-title>
|
||||
<f7-nav-right :class="{ 'disabled': loading }">
|
||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }" @click="showMoreActionSheet = true"></f7-link>
|
||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': loading || ((!isSupportedFileCache || !fileCacheStatistics) && !exchangeRatesCacheSize) }" @click="showMoreActionSheet = true"></f7-link>
|
||||
</f7-nav-right>
|
||||
</f7-navbar>
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
<f7-list-item group-title :sortable="false">
|
||||
<small>{{ tt('Cache Expiration Time') }}</small>
|
||||
</f7-list-item>
|
||||
<f7-list-item title="Map Data" after="Disable Map Cache" v-if="getMapProvider()"></f7-list-item>
|
||||
<f7-list-item title="Map Data" after="Disable Cache" v-if="getMapProvider()"></f7-list-item>
|
||||
<f7-list-item title="Exchange Rates Data" after="Disable Cache"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical" v-if="!loading && isSupportedFileCache">
|
||||
@@ -75,6 +76,25 @@
|
||||
v-model="mapCacheExpiration">
|
||||
</list-item-selection-popup>
|
||||
</f7-list-item>
|
||||
<f7-list-item
|
||||
link="#"
|
||||
:class="{ 'disabled': loading }"
|
||||
:title="tt('Exchange Rates Data')"
|
||||
:after="findNameByValue(allExchangeRatesDataCacheExpirationOptions, exchangeRatesDataCacheExpiration)"
|
||||
@click="showExchangeRatesDataCacheExpirationPopup = true"
|
||||
>
|
||||
<list-item-selection-popup value-type="item"
|
||||
key-field="value" value-field="value"
|
||||
title-field="name"
|
||||
:title="tt('Cache Expiration for Exchange Rates Data')"
|
||||
:enable-filter="true"
|
||||
:filter-placeholder="tt('Expiration Time')"
|
||||
:filter-no-items-text="tt('No results')"
|
||||
:items="allExchangeRatesDataCacheExpirationOptions"
|
||||
v-model:show="showExchangeRatesDataCacheExpirationPopup"
|
||||
v-model="exchangeRatesDataCacheExpiration">
|
||||
</list-item-selection-popup>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
|
||||
@@ -84,6 +104,10 @@
|
||||
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
|
||||
@click="clearAllFileCache">{{ tt('Clear All File Cache') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-button :class="{ 'disabled': loading || !exchangeRatesCacheSize }"
|
||||
@click="clearExchangeRatesCache">{{ tt('Clear Exchange Rates Data Cache') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
@@ -112,13 +136,17 @@ const {
|
||||
fileCacheStatistics,
|
||||
exchangeRatesCacheSize,
|
||||
allMapCacheExpirationOptions,
|
||||
allExchangeRatesDataCacheExpirationOptions,
|
||||
mapCacheExpiration,
|
||||
exchangeRatesDataCacheExpiration,
|
||||
loadCacheStatistics,
|
||||
clearMapDataCache,
|
||||
clearAllBrowserCaches
|
||||
clearAllBrowserCaches,
|
||||
clearExchangeRatesDataCache
|
||||
} = useAppBrowserCacheSettingPageBase();
|
||||
|
||||
const showMapDataCacheExpirationPopup = ref<boolean>(false);
|
||||
const showExchangeRatesDataCacheExpirationPopup = ref<boolean>(false);
|
||||
const showMoreActionSheet = ref<boolean>(false);
|
||||
|
||||
function reloadCacheStatistics(done?: () => void): void {
|
||||
@@ -149,5 +177,11 @@ function clearAllFileCache(): void {
|
||||
});
|
||||
}
|
||||
|
||||
function clearExchangeRatesCache(): void {
|
||||
showConfirm('Are you sure you want to clear exchange rates data cache?', () => {
|
||||
clearExchangeRatesDataCache();
|
||||
});
|
||||
}
|
||||
|
||||
loadCacheStatistics();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user