feat(review): 集成iOS应用内评分功能
- 新增iOS原生模块AppStoreReviewManager,封装StoreKit评分请求 - 实现appStoreReviewService服务层,管理评分请求时间间隔(14天) - 在关键用户操作后触发评分请求:完成挑战、记录服药、记录体重、记录饮水 - 优化通知设置页面UI,改进设置项布局和视觉层次 - 调整用药卡片样式,优化状态显示和文字大小 - 新增配置检查脚本check-app-review-setup.sh - 修改喝水提醒默认状态为关闭 评分请求策略: - 仅iOS 14.0+支持 - 自动控制请求频率,避免过度打扰用户 - 延迟1秒执行,不阻塞主业务流程 - 所有评分请求均做错误处理,确保不影响核心功能
This commit is contained in:
@@ -6,6 +6,7 @@ import { getTabBarBottomPadding } from '@/constants/TabBar';
|
||||
import { useAppDispatch, useAppSelector } from '@/hooks/redux';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
import { useSafeAreaTop } from '@/hooks/useSafeAreaWithPadding';
|
||||
import { appStoreReviewService } from '@/services/appStoreReview';
|
||||
import { deleteWeightRecord, fetchWeightHistory, updateUserProfile, updateWeightRecord, WeightHistoryItem } from '@/store/userSlice';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -107,6 +108,13 @@ export default function WeightRecordsPage() {
|
||||
if (pickerType === 'current') {
|
||||
// Update current weight in profile and add weight record
|
||||
await dispatch(updateUserProfile({ weight: weight }) as any);
|
||||
|
||||
// 记录体重后尝试请求应用评分(延迟1秒,避免阻塞主流程)
|
||||
setTimeout(() => {
|
||||
appStoreReviewService.requestReview().catch((error) => {
|
||||
console.error('应用评分请求失败:', error);
|
||||
});
|
||||
}, 1000);
|
||||
} else if (pickerType === 'initial') {
|
||||
// Update initial weight in profile
|
||||
console.log('更新初始体重');
|
||||
|
||||
Reference in New Issue
Block a user