feat(profile): add chat settings and language options to profile settings
All checks were successful
Frontend CI / ota-android (push) Successful in 13m7s
Frontend CI / build-and-push-web (push) Successful in 16m58s
Frontend CI / build-android-apk (push) Successful in 1h4m18s

- Introduced hrefProfileChatSettings() for navigation to chat settings.
- Updated SettingsScreen to include new settings items for chat settings, language selection, data storage, terms, and privacy policy.
- Enhanced user experience by providing alerts for language and data storage options.

This update improves the profile settings interface by adding more customization options for users.
This commit is contained in:
lafay
2026-04-01 02:17:36 +08:00
parent 20e9d69540
commit 5614b4078a
25 changed files with 2622 additions and 801 deletions

42
src/stores/utils/cache.ts Normal file
View File

@@ -0,0 +1,42 @@
/**
* 缓存工具函数
* 提取自 baseManager.ts用于 Zustand store 的 TTL 缓存管理
*/
/** 缓存条目结构 */
export interface CacheEntry<T> {
data: T;
timestamp: number;
ttl: number;
}
/** 创建缓存条目 */
export function createCacheEntry<T>(data: T, ttl: number): CacheEntry<T> {
return { data, timestamp: Date.now(), ttl };
}
/** 检查缓存是否过期 */
export function isCacheExpired(entry: CacheEntry<any>): boolean {
return Date.now() - entry.timestamp > entry.ttl;
}
/** 检查缓存是否有效(存在且未过期) */
export function isCacheValid<T>(entry: CacheEntry<T> | undefined | null): boolean {
if (!entry) return false;
return !isCacheExpired(entry);
}
/** 获取缓存的剩余有效时间(毫秒) */
export function getCacheRemainingTTL(entry: CacheEntry<any>): number {
const elapsed = Date.now() - entry.timestamp;
return Math.max(0, entry.ttl - elapsed);
}
/** 默认 TTL 常量 */
export const DEFAULT_TTL = {
USER: 5 * 60 * 1000, // 5 分钟
POST_LIST: 30 * 1000, // 30 秒
POST_DETAIL: 60 * 1000, // 1 分钟
GROUP: 60 * 1000, // 1 分钟
GROUP_MEMBERS: 120 * 1000, // 2 分钟
};