Commit f027d9eab119eafaa346091ea7b1671732d56ba4

Authored by 权海
1 parent 3e164451

feat(ui):华为目标值的获取和上传

xx

feat(ui):修复ohos目标写法

xx

(cherry picked from commit 3e164451)

# Conflicts:
#	lib/core/services/raw_data_service/platform_ohos/ohos_harmony_health_raw_data_sync_service_factory.dart

xx

feat(ui):首页提供的数据也从本地数据库取

(cherry picked from commit e64a4559)

# Conflicts:
#	lib/core/services/raw_data_service/platform_ohos/ohos_harmony_health_raw_data_sync_service_factory.dart
... ... @@ -159,10 +159,6 @@ class HarmonyApiOhosRawDataClient implements OhosHarmonyRawDataClient {
'[OHOS_ACTIVITY_GOAL] '
'source=native value=${_goalLogValue(nativeGoal)}',
);
AppLogger.i(
'[OHOS_ACTIVITY_GOAL] '
'upload_scheduled value=${_goalLogValue(nativeGoal)}',
);
// Deliberately do not await: a failed request must not prevent the
// user from entering the app or the health-data sync from continuing.
unawaited(_uploadNativeActivityGoal(nativeGoal));
... ...
... ... @@ -245,6 +245,18 @@ class LocalHealthDataSource implements HealthDataSource {
Future<AppResult<V2ActivityTarget>> getV2ActivityTarget(
int? queryUserId, int intDate) async {
try {
if (_isOhosPlatform) {
// The OHOS sync pipeline persists the native activity ring goal in
// the local activity_goal table. Prefer that exact value here instead
// of reconstructing it from a day's activity summary.
final storedGoal = await coreService.queryOhosActivityGoal(
refresh: false,
);
if (storedGoal != null) {
return AppSuccess(storedGoal);
}
}
final day = LocalHealthDataConvert.dateFromKey(intDate);
final queryStart = LocalHealthDataConvert.unixSeconds(day);
final queryEnd = LocalHealthDataConvert.unixSeconds(
... ... @@ -256,13 +268,10 @@ class LocalHealthDataSource implements HealthDataSource {
);
final resolvedActivity = _resolveActivityTarget(activity);
if (_isOhosPlatform) {
final activityGoal = await coreService.queryOhosActivityGoal(
refresh: false,
);
return AppSuccess(
_ohosActivityTarget(
userId: queryUserId ?? 0,
remoteOrCachedTarget: activityGoal,
remoteOrCachedTarget: null,
activity: resolvedActivity,
fallbackUpdateTime: queryEnd,
),
... ...