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
+4 -3
View File
@@ -8,6 +8,7 @@ import { useExchangeRatesStore } from '@/stores/exchangeRates.ts';
import type { AuthResponse } from '@/models/auth_response.ts';
import { updateMapCacheExpiration } from '@/lib/cache.ts';
import { getOAuth2Provider, getOIDCCustomDisplayNames, getLoginPageTips } from '@/lib/server_settings.ts';
import { getClientDisplayVersion } from '@/lib/version.ts';
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
@@ -54,9 +55,9 @@ export function useLoginPageBase(platform: 'mobile' | 'desktop') {
setExpenseAndIncomeAmountColor(authResponse.user.expenseAmountColor, authResponse.user.incomeAmountColor);
}
if (settingsStore.appSettings.autoUpdateExchangeRatesData) {
exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
}
updateMapCacheExpiration(settingsStore.appSettings.mapCacheExpiration);
exchangeRatesStore.removeExpiredExchangeRates(true);
exchangeRatesStore.autoUpdateExchangeRatesData();
if (authResponse.notificationContent) {
rootStore.setNotificationContent(authResponse.notificationContent);
+5 -3
View File
@@ -10,6 +10,8 @@ import { useExchangeRatesStore } from '@/stores/exchangeRates.ts';
import { CategoryType } from '@/core/category.ts';
import type { RegisterResponse } from '@/models/auth_response.ts';
import type { User } from '@/models/user.ts';
import { updateMapCacheExpiration } from '@/lib/cache.ts';
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
export function useSignupPageBase() {
@@ -114,9 +116,9 @@ export function useSignupPageBase() {
setExpenseAndIncomeAmountColor(response.user.expenseAmountColor, response.user.incomeAmountColor);
}
if (settingsStore.appSettings.autoUpdateExchangeRatesData) {
exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
}
updateMapCacheExpiration(settingsStore.appSettings.mapCacheExpiration);
exchangeRatesStore.removeExpiredExchangeRates(true);
exchangeRatesStore.autoUpdateExchangeRatesData();
if (response.notificationContent) {
rootStore.setNotificationContent(response.notificationContent);
+5 -4
View File
@@ -11,6 +11,7 @@ import { useExchangeRatesStore } from '@/stores/exchangeRates.ts';
import { isWebAuthnSupported } from '@/lib/webauthn.ts';
import { hasWebAuthnConfig } from '@/lib/userstate.ts';
import { updateMapCacheExpiration } from '@/lib/cache.ts';
import { getClientDisplayVersion } from '@/lib/version.ts';
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
@@ -48,14 +49,14 @@ export function useUnlockPageBase() {
setExpenseAndIncomeAmountColor(response.user.expenseAmountColor, response.user.incomeAmountColor);
}
updateMapCacheExpiration(settingsStore.appSettings.mapCacheExpiration);
exchangeRatesStore.removeExpiredExchangeRates(true);
exchangeRatesStore.autoUpdateExchangeRatesData();
if (response.notificationContent) {
rootStore.setNotificationContent(response.notificationContent);
}
});
if (settingsStore.appSettings.autoUpdateExchangeRatesData) {
exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
}
}
function doRelogin(): void {
@@ -23,7 +23,14 @@ export const ALL_APPLICATION_CLOUD_SETTINGS: CategorizedApplicationCloudSettingI
{
categoryName: 'Basic Settings',
items: [
{ settingKey: 'showAccountBalance', settingName: 'Show Account Balance', mobile: true, desktop: true }
{ settingKey: 'showAccountBalance', settingName: 'Show Account Balance', mobile: true, desktop: true },
{ settingKey: 'autoUpdateExchangeRatesData', settingName: 'Auto-update Exchange Rates Data', mobile: true, desktop: true }
]
},
{
categoryName: 'Navigation Bar',
items: [
{ settingKey: 'showAddTransactionButtonInDesktopNavbar', settingName: 'Show Add Transaction Button', mobile: false, desktop: true }
]
},
{
@@ -78,6 +85,13 @@ export const ALL_APPLICATION_CLOUD_SETTINGS: CategorizedApplicationCloudSettingI
{ settingKey: 'currencySortByInExchangeRatesPage', settingName: 'Sort by', mobile: true, desktop: true }
]
},
{
categoryName: 'Browser Cache Management',
items: [
{ settingKey: 'mapCacheExpiration', settingName: 'Cache Expiration for Map Data', mobile: true, desktop: true },
{ settingKey: 'exchangeRatesDataCacheExpiration', settingName: 'Cache Expiration for Exchange Rates Data', mobile: true, desktop: true }
]
},
{
categoryName: 'Statistics Settings',
categorySubName: 'Common Settings',