Refactor: Remove background task management and related hooks

- Deleted `useBackgroundTasks.ts` hook and its associated logic for managing background tasks.
- Removed `backgroundTaskManager.ts` service and all related task definitions and registrations.
- Cleaned up `Podfile.lock` and `package.json` to remove unused dependencies related to background tasks.
- Updated iOS project files to eliminate references to removed background task components.
- Added new background fetch identifier in `Info.plist` for future use.
This commit is contained in:
richarjiang
2025-09-05 09:47:49 +08:00
parent cb89ee7bc2
commit acb3907344
60 changed files with 77 additions and 2230 deletions

View File

@@ -33,7 +33,7 @@ export function FloatingFoodOverlay({ visible, onClose, mealType = 'dinner' }: F
const menuItems = [
{
id: 'scan',
title: 'AI拍照识别',
title: 'AI识别',
icon: '📷',
backgroundColor: '#4FC3F7',
onPress: handlePhotoRecognition,
@@ -56,7 +56,7 @@ export function FloatingFoodOverlay({ visible, onClose, mealType = 'dinner' }: F
onRequestClose={onClose}
>
<View style={styles.overlay}>
<BlurView intensity={20} tint="dark" style={styles.overlay}>
<TouchableOpacity
style={styles.backdrop}
activeOpacity={1}
@@ -96,7 +96,7 @@ export function FloatingFoodOverlay({ visible, onClose, mealType = 'dinner' }: F
</View>
</TouchableOpacity>
</View>
</View>
</BlurView>
</Modal>
);
}
@@ -104,8 +104,7 @@ export function FloatingFoodOverlay({ visible, onClose, mealType = 'dinner' }: F
const styles = StyleSheet.create({
overlay: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.4)',
justifyContent: 'center',
justifyContent: 'flex-end',
alignItems: 'center',
},
backdrop: {
@@ -117,6 +116,7 @@ const styles = StyleSheet.create({
},
container: {
alignItems: 'center',
marginBottom: 40,
},
blurContainer: {
borderRadius: 20,
@@ -132,9 +132,9 @@ const styles = StyleSheet.create({
alignItems: 'center',
},
title: {
fontSize: 16,
fontSize: 12,
fontWeight: '600',
color: '#333',
color: '#636161ff',
},
menuGrid: {
flexDirection: 'row',
@@ -146,9 +146,9 @@ const styles = StyleSheet.create({
flex: 1,
},
iconContainer: {
width: 48,
height: 48,
borderRadius: 24,
width: 40,
height: 40,
borderRadius: 20,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 8,
@@ -162,7 +162,7 @@ const styles = StyleSheet.create({
elevation: 4,
},
iconText: {
fontSize: 22,
fontSize: 16,
},
menuText: {
fontSize: 13,

View File

@@ -3,10 +3,12 @@ import { useThemeColor } from '@/hooks/useThemeColor';
import { DietRecord } from '@/services/dietRecords';
import { Ionicons } from '@expo/vector-icons';
import dayjs from 'dayjs';
import { Image } from 'expo-image';
import React, { useMemo, useRef, useState } from 'react';
import { Alert, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { Alert, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { RectButton, Swipeable } from 'react-native-gesture-handler';
export type NutritionRecordCardProps = {
record: DietRecord;
onPress?: () => void;
@@ -162,7 +164,11 @@ export function NutritionRecordCard({
{/* 左侧:食物图片 */}
<View style={[styles.foodImageContainer, !record.imageUrl && styles.foodImagePlaceholder]}>
{record.imageUrl ? (
<Image source={{ uri: record.imageUrl }} style={styles.foodImage} />
<Image
source={{ uri: record.imageUrl }}
style={styles.foodImage}
cachePolicy={'memory-disk'}
/>
) : (
<Ionicons name="restaurant" size={28} color={textSecondaryColor} />
)}