|
...
|
...
|
@@ -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,
|
|
|
|
),
|
...
|
...
|
|