- 将应用名称修改为“每日普拉提”,提升品牌识别度 - 新增隐私同意弹窗,确保用户在使用应用前同意隐私政策 - 更新 Redux 状态管理,添加隐私同意状态的处理 - 优化用户信息页面,确保体重和身高的格式化显示 - 更新今日训练页面标题为“快速训练”,提升用户体验 - 添加开发工具函数,便于测试隐私同意功能
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { STORAGE_KEYS } from '@/services/api';
|
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
|
|
/**
|
|
* 开发工具函数 - 清除隐私同意状态
|
|
* 用于测试隐私同意弹窗功能
|
|
*/
|
|
export const clearPrivacyAgreement = async (): Promise<void> => {
|
|
try {
|
|
await AsyncStorage.removeItem(STORAGE_KEYS.privacyAgreed);
|
|
console.log('隐私同意状态已清除');
|
|
} catch (error) {
|
|
console.error('清除隐私同意状态失败:', error);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 开发工具函数 - 检查隐私同意状态
|
|
*/
|
|
export const checkPrivacyAgreement = async (): Promise<boolean> => {
|
|
try {
|
|
const privacyAgreed = await AsyncStorage.getItem(STORAGE_KEYS.privacyAgreed);
|
|
const isAgreed = privacyAgreed === 'true';
|
|
console.log('隐私同意状态:', isAgreed);
|
|
return isAgreed;
|
|
} catch (error) {
|
|
console.error('检查隐私同意状态失败:', error);
|
|
return false;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 开发工具函数 - 清除所有用户数据
|
|
* 用于完全重置应用状态
|
|
*/
|
|
export const clearAllUserData = async (): Promise<void> => {
|
|
try {
|
|
await Promise.all([
|
|
AsyncStorage.removeItem(STORAGE_KEYS.authToken),
|
|
AsyncStorage.removeItem(STORAGE_KEYS.userProfile),
|
|
AsyncStorage.removeItem(STORAGE_KEYS.privacyAgreed),
|
|
]);
|
|
console.log('所有用户数据已清除');
|
|
} catch (error) {
|
|
console.error('清除用户数据失败:', error);
|
|
}
|
|
};
|