support syncing the settings autoUpdateExchangeRatesData, showAddTransactionButtonInDesktopNavbar, mapCacheExpiration, and exchangeRatesDataCacheExpiration

This commit is contained in:
MaysWind
2026-03-01 21:08:16 +08:00
parent c4c9503e31
commit a84f48ae8a
11 changed files with 118 additions and 84 deletions
+7
View File
@@ -169,6 +169,12 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
clearExchangeRatesFromLocalStorage();
}
function autoUpdateExchangeRatesData(): void {
if (settingsStore.appSettings.autoUpdateExchangeRatesData) {
getLatestExchangeRates({ silent: true, force: false });
}
}
function getLatestExchangeRates({ silent, force }: { silent: boolean, force: boolean }): Promise<LatestExchangeRateResponse> {
const currentExchangeRateData = latestExchangeRates.value;
const now = getCurrentUnixTime();
@@ -331,6 +337,7 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => {
getExchangeRatesCacheSize,
removeExpiredExchangeRates,
resetLatestExchangeRates,
autoUpdateExchangeRatesData,
getLatestExchangeRates,
updateUserCustomExchangeRate,
deleteUserCustomExchangeRate,
+6 -2
View File
@@ -152,6 +152,7 @@ export const useSettingsStore = defineStore('settings', () => {
function setAutoUpdateExchangeRatesData(value: boolean): void {
updateApplicationSettingsValue('autoUpdateExchangeRatesData', value);
appSettings.value.autoUpdateExchangeRatesData = value;
updateUserApplicationCloudSettingValue('autoUpdateExchangeRatesData', value);
}
function setShowAccountBalance(value: boolean): void {
@@ -185,6 +186,7 @@ export const useSettingsStore = defineStore('settings', () => {
function setShowAddTransactionButtonInDesktopNavbar(value: boolean): void {
updateApplicationSettingsValue('showAddTransactionButtonInDesktopNavbar', value);
appSettings.value.showAddTransactionButtonInDesktopNavbar = value;
updateUserApplicationCloudSettingValue('showAddTransactionButtonInDesktopNavbar', value);
}
// Overview Page
@@ -310,15 +312,17 @@ export const useSettingsStore = defineStore('settings', () => {
updateUserApplicationCloudSettingValue('currencySortByInExchangeRatesPage', value);
}
// Browser Cache Settings
// Browser Cache Management
function setMapCacheExpiration(value: number): void {
updateApplicationSettingsValue('mapCacheExpiration', value);
appSettings.value.mapCacheExpiration = value;
updateUserApplicationCloudSettingValue('mapCacheExpiration', value);
}
function setExchangeRatesDataCacheExpiration(value: number): void {
updateApplicationSettingsValue('exchangeRatesDataCacheExpiration', value);
appSettings.value.exchangeRatesDataCacheExpiration = value;
updateUserApplicationCloudSettingValue('exchangeRatesDataCacheExpiration', value);
}
// Statistics Settings
@@ -542,7 +546,7 @@ export const useSettingsStore = defineStore('settings', () => {
setHideCategoriesWithoutAccounts,
// -- Exchange Rates Data Page
setCurrencySortByInExchangeRatesPage,
// -- Browser Cache Settings
// -- Browser Cache Management
setMapCacheExpiration,
setExchangeRatesDataCacheExpiration,
// -- Statistics Settings