Commit 3e1297590550c9ef7fe993bce619e6ac5bc6826c

Authored by 常守达
1 parent 09de606c

fix(today):HRV趋势为空时其他不展示

@@ -485,30 +485,44 @@ class TodayController extends GetMaterialController { @@ -485,30 +485,44 @@ class TodayController extends GetMaterialController {
485 v2HealthData.value = null; 485 v2HealthData.value = null;
486 } 486 }
487 487
488 - switch (await _healthApi.getV2StressScore(friendUserId, intDate)) { 488 + switch (await _healthApi.getV2HrvTrend(friendUserId, intDate)) {
489 case AppSuccess(:final data): 489 case AppSuccess(:final data):
490 - v2StressScore.value = data; 490 + hrvChartData.assignAll(data.list ?? []);
491 case AppFailure(): 491 case AppFailure():
492 - v2StressScore.value = null; 492 + hrvChartData.clear();
493 } 493 }
494 494
495 switch (await _healthApi.getV2LatestHrv(friendUserId, intDate)) { 495 switch (await _healthApi.getV2LatestHrv(friendUserId, intDate)) {
496 case AppSuccess(:final data): 496 case AppSuccess(:final data):
497 - v2LatestHrv.value = data; 497 + if (hrvChartData.isNotEmpty) {
  498 + v2LatestHrv.value = data;
  499 + } else {
  500 + v2LatestHrv.value = null;
  501 + }
498 case AppFailure(): 502 case AppFailure():
499 v2LatestHrv.value = null; 503 v2LatestHrv.value = null;
500 } 504 }
501 505
502 - switch (await _healthApi.getV2HrvTrend(friendUserId, intDate)) { 506 + switch (await _healthApi.getV2StressScore(friendUserId, intDate)) {
503 case AppSuccess(:final data): 507 case AppSuccess(:final data):
504 - hrvChartData.assignAll(data.list ?? []); 508 + {
  509 + if (hrvChartData.isNotEmpty) {
  510 + v2StressScore.value = data;
  511 + } else {
  512 + v2StressScore.value = V2StressScore(state: 0);
  513 + }
  514 + }
505 case AppFailure(): 515 case AppFailure():
506 - hrvChartData.clear(); 516 + v2StressScore.value = null;
507 } 517 }
508 518
509 switch (await _healthApi.getV2RealtimeStress(friendUserId, intDate)) { 519 switch (await _healthApi.getV2RealtimeStress(friendUserId, intDate)) {
510 case AppSuccess(:final data): 520 case AppSuccess(:final data):
511 - stressChartData.assignAll(data.list ?? []); 521 + if (hrvChartData.isNotEmpty) {
  522 + stressChartData.assignAll(data.list ?? []);
  523 + } else {
  524 + stressChartData.clear();
  525 + }
512 case AppFailure(): 526 case AppFailure():
513 stressChartData.clear(); 527 stressChartData.clear();
514 } 528 }
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 "phoneLoginCodeSentSuccess": "Code sent", 105 "phoneLoginCodeSentSuccess": "Code sent",
106 "phoneLoginInvalidCode": "Invalid verification code", 106 "phoneLoginInvalidCode": "Invalid verification code",
107 "todayHealthDataAuthTitle": "Syncing Health Data", 107 "todayHealthDataAuthTitle": "Syncing Health Data",
108 - "todayHealthDataAuthDescription": "DoubleFeel needs access to your Apple Health data to provide stress insights, real-time stress tracking, and health recommendations.\nIf you haven’t granted access, please allow permissions below. If you have already granted access, syncing your health data may take a few minutes. Please try again later.", 108 + "todayHealthDataAuthDescription": "DoubleFeel needs access to your Apple Health data to provide stress analysis, sleep insights, and health reminders. Please complete health data authorization. If already authorized, the first sync may take a few minutes.\nIf your Apple Watch hasn't been worn long enough, there may not be sufficient data yet. Please continue wearing your watch to complete data collection.",
109 "todayHealthDataAuthAction": "Allow Health Access", 109 "todayHealthDataAuthAction": "Allow Health Access",
110 "measureYourHrvNow": "How to take a measurement", 110 "measureYourHrvNow": "How to take a measurement",
111 "todayBottomSheetGotIt": "Got it", 111 "todayBottomSheetGotIt": "Got it",
@@ -182,7 +182,7 @@ @@ -182,7 +182,7 @@
182 "@todayHealthDataAuthTitle": { 182 "@todayHealthDataAuthTitle": {
183 "description": "今日页健康数据授权卡片标题" 183 "description": "今日页健康数据授权卡片标题"
184 }, 184 },
185 - "todayHealthDataAuthDescription": "DoubleFeel 需要访问你的 Apple 健康数据,以提供压力提醒、实时压力统计和健康建议。\n如果尚未授权,请点击下方完成授权;如果已经授权,首次同步大量健康数据可能需要等待几分钟,请稍后再试。", 185 + "todayHealthDataAuthDescription": "DoubleFeel需要访问你的Apple健康数据,以提供压力、睡眠分析和健康提醒。请完成健康数据授权。若已授权,首次同步可能需要几分钟。\n如果Apple Watch佩戴时间不足,可能暂无足够数据,请继续佩戴手表以完成数据采集。",
186 "@todayHealthDataAuthDescription": { 186 "@todayHealthDataAuthDescription": {
187 "description": "今日页健康数据授权卡片说明" 187 "description": "今日页健康数据授权卡片说明"
188 }, 188 },
@@ -732,7 +732,7 @@ abstract class AppLocalizations { @@ -732,7 +732,7 @@ abstract class AppLocalizations {
732 /// 今日页健康数据授权卡片说明 732 /// 今日页健康数据授权卡片说明
733 /// 733 ///
734 /// In zh, this message translates to: 734 /// In zh, this message translates to:
735 - /// **'DoubleFeel 需要访问你的 Apple 健康数据,以提供压力提醒、实时压力统计和健康建议。\n如果尚未授权,请点击下方完成授权;如果已经授权,首次同步大量健康数据可能需要等待几分钟,请稍后再试。'** 735 + /// **'DoubleFeel需要访问你的Apple健康数据,以提供压力、睡眠分析和健康提醒。请完成健康数据授权。若已授权,首次同步可能需要几分钟。\n如果Apple Watch佩戴时间不足,可能暂无足够数据,请继续佩戴手表以完成数据采集。'**
736 String get todayHealthDataAuthDescription; 736 String get todayHealthDataAuthDescription;
737 737
738 /// 今日页健康数据授权卡片按钮文案 738 /// 今日页健康数据授权卡片按钮文案
@@ -343,7 +343,7 @@ class AppLocalizationsEn extends AppLocalizations { @@ -343,7 +343,7 @@ class AppLocalizationsEn extends AppLocalizations {
343 343
344 @override 344 @override
345 String get todayHealthDataAuthDescription => 345 String get todayHealthDataAuthDescription =>
346 - 'DoubleFeel needs access to your Apple Health data to provide stress insights, real-time stress tracking, and health recommendations.\nIf you haven’t granted access, please allow permissions below. If you have already granted access, syncing your health data may take a few minutes. Please try again later.'; 346 + 'DoubleFeel needs access to your Apple Health data to provide stress analysis, sleep insights, and health reminders. Please complete health data authorization. If already authorized, the first sync may take a few minutes.\nIf your Apple Watch hasn\'t been worn long enough, there may not be sufficient data yet. Please continue wearing your watch to complete data collection.';
347 347
348 @override 348 @override
349 String get todayHealthDataAuthAction => 'Allow Health Access'; 349 String get todayHealthDataAuthAction => 'Allow Health Access';
@@ -334,7 +334,7 @@ class AppLocalizationsZh extends AppLocalizations { @@ -334,7 +334,7 @@ class AppLocalizationsZh extends AppLocalizations {
334 334
335 @override 335 @override
336 String get todayHealthDataAuthDescription => 336 String get todayHealthDataAuthDescription =>
337 - 'DoubleFeel 需要访问你的 Apple 健康数据,以提供压力提醒、实时压力统计和健康建议。\n如果尚未授权,请点击下方完成授权;如果已经授权,首次同步大量健康数据可能需要等待几分钟,请稍后再试。'; 337 + 'DoubleFeel需要访问你的Apple健康数据,以提供压力、睡眠分析和健康提醒。请完成健康数据授权。若已授权,首次同步可能需要几分钟。\n如果Apple Watch佩戴时间不足,可能暂无足够数据,请继续佩戴手表以完成数据采集。';
338 338
339 @override 339 @override
340 String get todayHealthDataAuthAction => '授权访问健康数据'; 340 String get todayHealthDataAuthAction => '授权访问健康数据';