feat: 集成健康数据功能

- 在项目中引入 react-native-health 库以获取健康数据
- 在 Explore 页面中添加步数和能量消耗的显示
- 实现页面聚焦时自动拉取今日健康数据
- 更新 iOS 权限设置以支持健康数据访问
- 添加健康数据相关的工具函数以简化数据获取
This commit is contained in:
richarjiang
2025-08-12 09:29:34 +08:00
parent 9796c614ed
commit 67972fa92b
7 changed files with 278 additions and 6 deletions

View File

@@ -1855,6 +1855,8 @@ PODS:
- React-logger (= 0.79.5)
- React-perflogger (= 0.79.5)
- React-utils (= 0.79.5)
- RNAppleHealthKit (1.7.0):
- React
- RNGestureHandler (2.24.0):
- DoubleConversion
- glog
@@ -2158,6 +2160,7 @@ DEPENDENCIES:
- ReactAppDependencyProvider (from `build/generated/ios`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNAppleHealthKit (from `../node_modules/react-native-health`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
@@ -2350,6 +2353,8 @@ EXTERNAL SOURCES:
:path: build/generated/ios
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNAppleHealthKit:
:path: "../node_modules/react-native-health"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNReanimated:
@@ -2450,6 +2455,7 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: f3e842e6cb5a825b6918a74a38402ba1409411f8
ReactCodegen: 6cb6e0d0b52471abc883541c76589d1c367c64c7
ReactCommon: 1ab5451fc5da87c4cc4c3046e19a8054624ca763
RNAppleHealthKit: 86ef7ab70f762b802f5c5289372de360cca701f9
RNGestureHandler: 7d0931a61d7ba0259f32db0ba7d0963c3ed15d2b
RNReanimated: 2313402fe27fecb7237619e9c6fcee3177f08a65
RNScreens: 482e9707f9826230810c92e765751af53826d509

View File

@@ -49,6 +49,10 @@
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
</array>
<key>NSHealthShareUsageDescription</key>
<string>应用需要访问您的健康数据(步数与能量消耗)以展示运动统计。</string>
<key>NSHealthUpdateUsageDescription</key>
<string>应用需要写入健康数据以提供更准确的统计。</string>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
<dict>
<key>com.apple.developer.healthkit</key>
<true/>
</dict>
</plist>