mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
support syncing the settings autoUpdateExchangeRatesData, showAddTransactionButtonInDesktopNavbar, mapCacheExpiration, and exchangeRatesDataCacheExpiration
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user