Files
digital-pilates/utils/guideHelpers.ts
richarjiang 16c2351160 feat: 移除目标管理功能模块
删除了完整的目标管理功能,包括目标创建、编辑、任务管理等相关页面和组件。同时移除了相关的API服务、Redux状态管理、类型定义和通知功能。应用版本从1.0.20升级到1.0.21。
2025-10-31 08:49:22 +08:00

58 lines
1.5 KiB
TypeScript

import AsyncStorage from '@/utils/kvStore';
// 引导状态存储键
const GUIDE_KEYS = {} as const;
/**
* 检查用户是否已经完成特定引导
* @param guideKey 引导键名
* @returns Promise<boolean> 是否已完成
*/
export const checkGuideCompleted = async (guideKey: string): Promise<boolean> => {
try {
const completed = await AsyncStorage.getItem(guideKey);
return completed === 'true';
} catch (error) {
console.error('检查引导状态失败:', error);
return false;
}
};
/**
* 标记引导为已完成
* @param guideKey 引导键名
*/
export const markGuideCompleted = async (guideKey: string): Promise<void> => {
try {
await AsyncStorage.setItem(guideKey, 'true');
} catch (error) {
console.error('保存引导状态失败:', error);
}
};
/**
* 重置所有引导状态(用于测试或重置用户引导)
*/
export const resetAllGuides = async (): Promise<void> => {
try {
// 由于没有引导键,这个函数现在什么都不做
console.log('所有引导状态已重置(无引导键)');
} catch (error) {
console.error('重置引导状态失败:', error);
}
};
/**
* 获取所有引导状态
* @returns Promise<Record<string, boolean>> 所有引导的完成状态
*/
export const getAllGuideStatus = async (): Promise<Record<string, boolean>> => {
try {
// 由于没有引导键,返回空对象
return {};
} catch (error) {
console.error('获取引导状态失败:', error);
return {};
}
};