Showing
9 changed files
with
50 additions
and
31 deletions
| @@ -3,6 +3,7 @@ import 'dart:math' as math; | @@ -3,6 +3,7 @@ import 'dart:math' as math; | ||
| 3 | 3 | ||
| 4 | import 'package:fl_chart/fl_chart.dart'; | 4 | import 'package:fl_chart/fl_chart.dart'; |
| 5 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| 6 | +import 'package:doublefeel_flutter/app/utils/platform_compact.dart'; | ||
| 6 | import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; | 7 | import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; |
| 7 | 8 | ||
| 8 | import '../../../../r.dart'; | 9 | import '../../../../r.dart'; |
| @@ -42,6 +43,7 @@ class ActivityBurnMonthReportView extends StatelessWidget { | @@ -42,6 +43,7 @@ class ActivityBurnMonthReportView extends StatelessWidget { | ||
| 42 | static const _h3 = Color(0xFFB0B0B6); | 43 | static const _h3 = Color(0xFFB0B0B6); |
| 43 | static const _active = Color(0xFFFF5279); | 44 | static const _active = Color(0xFFFF5279); |
| 44 | static const _exercise = Color(0xFF3BD49D); | 45 | static const _exercise = Color(0xFF3BD49D); |
| 46 | + static const _ohosExercise = Color(0xFFFF9A6E); | ||
| 45 | static const _stand = Color(0xFF7B9BFB); | 47 | static const _stand = Color(0xFF7B9BFB); |
| 46 | 48 | ||
| 47 | @override | 49 | @override |
| @@ -135,7 +137,9 @@ class _MonthlySummary extends StatelessWidget { | @@ -135,7 +137,9 @@ class _MonthlySummary extends StatelessWidget { | ||
| 135 | context, context.l10n.activityWeeklyExerciseTitle), | 137 | context, context.l10n.activityWeeklyExerciseTitle), |
| 136 | value: exercise.value, | 138 | value: exercise.value, |
| 137 | unit: exercise.unit, | 139 | unit: exercise.unit, |
| 138 | - color: ActivityBurnMonthReportView._exercise, | 140 | + color: isOhos() |
| 141 | + ? ActivityBurnMonthReportView._ohosExercise | ||
| 142 | + : ActivityBurnMonthReportView._exercise, | ||
| 139 | ), | 143 | ), |
| 140 | const SizedBox(width: 34), | 144 | const SizedBox(width: 34), |
| 141 | _SummaryMetric( | 145 | _SummaryMetric( |
| @@ -66,18 +66,18 @@ class _OhosActivityBurnRing extends StatelessWidget { | @@ -66,18 +66,18 @@ class _OhosActivityBurnRing extends StatelessWidget { | ||
| 66 | items: [ | 66 | items: [ |
| 67 | ArcProgressItem( | 67 | ArcProgressItem( |
| 68 | ratio: hasData ? report?.activeEnergy?.rawProgress : null, | 68 | ratio: hasData ? report?.activeEnergy?.rawProgress : null, |
| 69 | - color: const Color(0xFFF84C38), | ||
| 70 | - backgroundColor: const Color(0xFFFEE6E4), | 69 | + color: const Color(0xFFF35033), |
| 70 | + backgroundColor: const Color(0x33F35033), | ||
| 71 | ), | 71 | ), |
| 72 | ArcProgressItem( | 72 | ArcProgressItem( |
| 73 | ratio: hasData ? report?.exerciseMinutes?.rawProgress : null, | 73 | ratio: hasData ? report?.exerciseMinutes?.rawProgress : null, |
| 74 | - color: const Color(0xFFF6A523), | ||
| 75 | - backgroundColor: const Color(0xFFFDF2E2), | 74 | + color: const Color(0xFFF9B12B), |
| 75 | + backgroundColor: const Color(0x33F9B12B), | ||
| 76 | ), | 76 | ), |
| 77 | ArcProgressItem( | 77 | ArcProgressItem( |
| 78 | ratio: hasData ? report?.standHours?.rawProgress : null, | 78 | ratio: hasData ? report?.standHours?.rawProgress : null, |
| 79 | - color: const Color(0xFF3A9BFB), | ||
| 80 | - backgroundColor: const Color(0xFFE3F1FD), | 79 | + color: const Color(0xFF4B9FF0), |
| 80 | + backgroundColor: const Color(0x334B9FF0), | ||
| 81 | ), | 81 | ), |
| 82 | ], | 82 | ], |
| 83 | ); | 83 | ); |
| 1 | +import 'package:doublefeel_flutter/app/utils/platform_compact.dart'; | ||
| 1 | import 'package:doublefeel_flutter/core/util/size_extensions.dart'; | 2 | import 'package:doublefeel_flutter/core/util/size_extensions.dart'; |
| 2 | import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; | 3 | import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; |
| 3 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| @@ -15,6 +16,7 @@ class ActivityBurnSummaryCard extends StatelessWidget { | @@ -15,6 +16,7 @@ class ActivityBurnSummaryCard extends StatelessWidget { | ||
| 15 | 16 | ||
| 16 | static const _active = Color(0xFFFF5279); | 17 | static const _active = Color(0xFFFF5279); |
| 17 | static const _exercise = Color(0xFF3BD49D); | 18 | static const _exercise = Color(0xFF3BD49D); |
| 19 | + static const _ohosExercise = Color(0xFFFF9A6E); | ||
| 18 | static const _stand = Color(0xFF7B9BFB); | 20 | static const _stand = Color(0xFF7B9BFB); |
| 19 | 21 | ||
| 20 | @override | 22 | @override |
| @@ -50,7 +52,7 @@ class ActivityBurnSummaryCard extends StatelessWidget { | @@ -50,7 +52,7 @@ class ActivityBurnSummaryCard extends StatelessWidget { | ||
| 50 | flex: 1, | 52 | flex: 1, |
| 51 | child: _MetricColumn( | 53 | child: _MetricColumn( |
| 52 | title: context.l10n.activityExercise, | 54 | title: context.l10n.activityExercise, |
| 53 | - color: _exercise, | 55 | + color: isOhos() ? _ohosExercise : _exercise, |
| 54 | value: exercise.value, | 56 | value: exercise.value, |
| 55 | unit: exercise.unit, | 57 | unit: exercise.unit, |
| 56 | ), | 58 | ), |
| @@ -3,6 +3,7 @@ import 'dart:math' as math; | @@ -3,6 +3,7 @@ import 'dart:math' as math; | ||
| 3 | 3 | ||
| 4 | import 'package:fl_chart/fl_chart.dart'; | 4 | import 'package:fl_chart/fl_chart.dart'; |
| 5 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| 6 | +import 'package:doublefeel_flutter/app/utils/platform_compact.dart'; | ||
| 6 | import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; | 7 | import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; |
| 7 | 8 | ||
| 8 | import '../../../../r.dart'; | 9 | import '../../../../r.dart'; |
| @@ -41,6 +42,7 @@ class ActivityBurnWeekReportView extends StatelessWidget { | @@ -41,6 +42,7 @@ class ActivityBurnWeekReportView extends StatelessWidget { | ||
| 41 | static const _h3 = Color(0xFFB0B0B6); | 42 | static const _h3 = Color(0xFFB0B0B6); |
| 42 | static const _active = Color(0xFFFF5279); | 43 | static const _active = Color(0xFFFF5279); |
| 43 | static const _exercise = Color(0xFF3BD49D); | 44 | static const _exercise = Color(0xFF3BD49D); |
| 45 | + static const _ohosExercise = Color(0xFFFF9A6E); | ||
| 44 | static const _stand = Color(0xFF7B9BFB); | 46 | static const _stand = Color(0xFF7B9BFB); |
| 45 | 47 | ||
| 46 | @override | 48 | @override |
| @@ -136,7 +138,9 @@ class _WeeklySummary extends StatelessWidget { | @@ -136,7 +138,9 @@ class _WeeklySummary extends StatelessWidget { | ||
| 136 | context, context.l10n.activityWeeklyExerciseTitle), | 138 | context, context.l10n.activityWeeklyExerciseTitle), |
| 137 | value: exercise.value, | 139 | value: exercise.value, |
| 138 | unit: exercise.unit, | 140 | unit: exercise.unit, |
| 139 | - color: ActivityBurnWeekReportView._exercise, | 141 | + color: isOhos() |
| 142 | + ? ActivityBurnWeekReportView._ohosExercise | ||
| 143 | + : ActivityBurnWeekReportView._exercise, | ||
| 140 | ), | 144 | ), |
| 141 | const SizedBox(width: 34), | 145 | const SizedBox(width: 34), |
| 142 | _SummaryMetric( | 146 | _SummaryMetric( |
| @@ -140,7 +140,10 @@ class FriendHealthCard extends StatelessWidget { | @@ -140,7 +140,10 @@ class FriendHealthCard extends StatelessWidget { | ||
| 140 | ], | 140 | ], |
| 141 | ), | 141 | ), |
| 142 | ), | 142 | ), |
| 143 | - if (isOnWatchFace) | 143 | + // OHOS does not support showing a friend on the watch face. The |
| 144 | + // backend may still return a legacy `isShowInDial` value, so avoid | ||
| 145 | + // exposing the corresponding status badge on that platform. | ||
| 146 | + if (isOnWatchFace && !isOhos()) | ||
| 144 | const Positioned( | 147 | const Positioned( |
| 145 | right: 0, | 148 | right: 0, |
| 146 | top: 0, | 149 | top: 0, |
| @@ -53,7 +53,7 @@ class _OhosSleepQualityRing extends StatelessWidget { | @@ -53,7 +53,7 @@ class _OhosSleepQualityRing extends StatelessWidget { | ||
| 53 | ratio: durationRatio, | 53 | ratio: durationRatio, |
| 54 | color: const Color(0xFF7B59EE), | 54 | color: const Color(0xFF7B59EE), |
| 55 | backgroundColor: const Color(0xFFECE7FB), | 55 | backgroundColor: const Color(0xFFECE7FB), |
| 56 | - noDataBackgroundColor: const Color(0xFFF0F1F5), | 56 | + noDataBackgroundColor: Colors.white, |
| 57 | ), | 57 | ), |
| 58 | ArcProgressItem( | 58 | ArcProgressItem( |
| 59 | ratio: qualityScore == null | 59 | ratio: qualityScore == null |
| @@ -61,7 +61,7 @@ class _OhosSleepQualityRing extends StatelessWidget { | @@ -61,7 +61,7 @@ class _OhosSleepQualityRing extends StatelessWidget { | ||
| 61 | : (qualityScore.clamp(0, 100) / 100).toDouble(), | 61 | : (qualityScore.clamp(0, 100) / 100).toDouble(), |
| 62 | color: const Color(0xFF638BFB), | 62 | color: const Color(0xFF638BFB), |
| 63 | backgroundColor: const Color(0xFFE8EFFD), | 63 | backgroundColor: const Color(0xFFE8EFFD), |
| 64 | - noDataBackgroundColor: const Color(0xFFF0F1F5), | 64 | + noDataBackgroundColor: Colors.white, |
| 65 | ), | 65 | ), |
| 66 | ], | 66 | ], |
| 67 | ); | 67 | ); |
| @@ -117,10 +117,7 @@ class AppPlatformHostApi extends _AppPigeonApiFacade { | @@ -117,10 +117,7 @@ class AppPlatformHostApi extends _AppPigeonApiFacade { | ||
| 117 | }); | 117 | }); |
| 118 | 118 | ||
| 119 | Future<bool> requestAppReview() => dispatch( | 119 | Future<bool> requestAppReview() => dispatch( |
| 120 | - ios: () => _api.requestAppReview(), | ||
| 121 | - ohos: () async { | ||
| 122 | - return false; | ||
| 123 | - }); | 120 | + ios: () => _api.requestAppReview(), ohos: () => _api.requestAppReview()); |
| 124 | 121 | ||
| 125 | Future<bool> jumpAppSetting() => dispatch( | 122 | Future<bool> jumpAppSetting() => dispatch( |
| 126 | ios: () => _api.jumpAppSetting(), | 123 | ios: () => _api.jumpAppSetting(), |
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | 2 | ||
| 3 | +import 'package:flutter/foundation.dart'; | ||
| 3 | import 'package:doublefeel_flutter/core/config/app_environment_config.dart'; | 4 | import 'package:doublefeel_flutter/core/config/app_environment_config.dart'; |
| 4 | import 'package:doublefeel_flutter/core/services/raw_data_service/health_raw_data_core_service.dart'; | 5 | import 'package:doublefeel_flutter/core/services/raw_data_service/health_raw_data_core_service.dart'; |
| 5 | import 'package:doublefeel_flutter/core/services/raw_data_service/platform_ohos/huawei_health_data_type.dart'; | 6 | import 'package:doublefeel_flutter/core/services/raw_data_service/platform_ohos/huawei_health_data_type.dart'; |
| @@ -52,7 +53,9 @@ class UserStateService { | @@ -52,7 +53,9 @@ class UserStateService { | ||
| 52 | await initializeSdks(); | 53 | await initializeSdks(); |
| 53 | _trackLogin(); | 54 | _trackLogin(); |
| 54 | _setUserProfile(); | 55 | _setUserProfile(); |
| 55 | - _healthRawDataCoreService.openDatabase(); | 56 | + // The WebSocket handler can immediately start a calculation. Ensure its |
| 57 | + // local result store is ready before subscribing and connecting. | ||
| 58 | + await _healthRawDataCoreService.openDatabase(); | ||
| 56 | // Push Kit may wait for its service/network. The token is still reported | 59 | // Push Kit may wait for its service/network. The token is still reported |
| 57 | // after login, but must not delay the rest of the authenticated session. | 60 | // after login, but must not delay the rest of the authenticated session. |
| 58 | unawaited(_pushService.registerPushToken()); | 61 | unawaited(_pushService.registerPushToken()); |
| @@ -96,11 +99,17 @@ class UserStateService { | @@ -96,11 +99,17 @@ class UserStateService { | ||
| 96 | return; | 99 | return; |
| 97 | } | 100 | } |
| 98 | 101 | ||
| 99 | - final processing = _healthRawDataCoreService.onHealthDataUpdated( | ||
| 100 | - dataTypes: <int>[dataType.dataType], | ||
| 101 | - ); | 102 | + final processing = defaultTargetPlatform == TargetPlatform.iOS |
| 103 | + ? _healthRawDataCoreService.onHealthDataUpdated( | ||
| 104 | + dataTypes: <int>[dataType.dataType], | ||
| 105 | + ) | ||
| 106 | + : _healthRawDataCoreService.startCoreCaculate(); | ||
| 102 | unawaited(processing.catchError((Object error, StackTrace stackTrace) { | 107 | unawaited(processing.catchError((Object error, StackTrace stackTrace) { |
| 103 | - AppLogger.w('Failed to process health_data_update', error, stackTrace); | 108 | + AppLogger.w( |
| 109 | + 'Failed to calculate health data after health_data_update', | ||
| 110 | + error, | ||
| 111 | + stackTrace, | ||
| 112 | + ); | ||
| 104 | })); | 113 | })); |
| 105 | } | 114 | } |
| 106 | 115 |
| @@ -5,12 +5,12 @@ | @@ -5,12 +5,12 @@ | ||
| 5 | "name": "auto", | 5 | "name": "auto", |
| 6 | "type": "HarmonyOS", | 6 | "type": "HarmonyOS", |
| 7 | "material": { | 7 | "material": { |
| 8 | - "certpath": "/Users/quanhai/Developer/doublefeel_flutter/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.cer", | 8 | + "certpath": "/Users/liuhongzhe/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.cer", |
| 9 | "keyAlias": "debugKey", | 9 | "keyAlias": "debugKey", |
| 10 | "keyPassword": "00000019084446C3F235D890CFE9AC6015D14270D13D370ACF44FEDD89097E1ABBBDE3810C8FEBFFFD", | 10 | "keyPassword": "00000019084446C3F235D890CFE9AC6015D14270D13D370ACF44FEDD89097E1ABBBDE3810C8FEBFFFD", |
| 11 | - "profile": "/Users/quanhai/Developer/doublefeel_flutter/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p7b", | 11 | + "profile": "/Users/liuhongzhe/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p7b", |
| 12 | "signAlg": "SHA256withECDSA", | 12 | "signAlg": "SHA256withECDSA", |
| 13 | - "storeFile": "/Users/quanhai/Developer/doublefeel_flutter/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p12", | 13 | + "storeFile": "/Users/liuhongzhe/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p12", |
| 14 | "storePassword": "00000019D85309732E0C3572D434400BA13D429AE5A182B54C1EA6F2C9D7DB5AE81BD9A64F12ACC681" | 14 | "storePassword": "00000019D85309732E0C3572D434400BA13D429AE5A182B54C1EA6F2C9D7DB5AE81BD9A64F12ACC681" |
| 15 | } | 15 | } |
| 16 | }, | 16 | }, |
| @@ -18,33 +18,33 @@ | @@ -18,33 +18,33 @@ | ||
| 18 | "name": "release", | 18 | "name": "release", |
| 19 | "type": "HarmonyOS", | 19 | "type": "HarmonyOS", |
| 20 | "material": { | 20 | "material": { |
| 21 | - "storeFile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/doublefeel.p12", | 21 | + "storeFile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/doublefeel.p12", |
| 22 | "storePassword": "0000001E8F02C32C2D5431F31FC368F020D891F18E6DC45A5913C60CACC1074B11282B3527F3E7D420F00B21B13A", | 22 | "storePassword": "0000001E8F02C32C2D5431F31FC368F020D891F18E6DC45A5913C60CACC1074B11282B3527F3E7D420F00B21B13A", |
| 23 | "keyAlias": "DoubleFeel", | 23 | "keyAlias": "DoubleFeel", |
| 24 | "keyPassword": "0000001ECC963DD8029FC0957D403D334E6A864BA98BD1ABF0F96E41AEB1002C3CBAFE12680A33902C1D5C61E7C9", | 24 | "keyPassword": "0000001ECC963DD8029FC0957D403D334E6A864BA98BD1ABF0F96E41AEB1002C3CBAFE12680A33902C1D5C61E7C9", |
| 25 | "signAlg": "SHA256withECDSA", | 25 | "signAlg": "SHA256withECDSA", |
| 26 | - "profile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/release/DoubleFeel_hm_releaseRelease.p7b", | ||
| 27 | - "certpath": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/release/DoubleFeelWatch_Release.cer" | 26 | + "profile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/release/DoubleFeel_hm_releaseRelease.p7b", |
| 27 | + "certpath": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/release/DoubleFeelWatch_Release.cer" | ||
| 28 | } | 28 | } |
| 29 | }, | 29 | }, |
| 30 | { | 30 | { |
| 31 | "name": "debug", | 31 | "name": "debug", |
| 32 | "type": "HarmonyOS", | 32 | "type": "HarmonyOS", |
| 33 | "material": { | 33 | "material": { |
| 34 | - "storeFile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/doublefeel.p12", | 34 | + "storeFile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/doublefeel.p12", |
| 35 | "storePassword": "0000001E1BE8542E4E9F7969905217A5421D89506648518A33A93BE1045A511094FF10805EC4686172CC000ED9FA", | 35 | "storePassword": "0000001E1BE8542E4E9F7969905217A5421D89506648518A33A93BE1045A511094FF10805EC4686172CC000ED9FA", |
| 36 | "keyAlias": "DoubleFeel", | 36 | "keyAlias": "DoubleFeel", |
| 37 | "keyPassword": "0000001EFBAD9B2C408962C5BF2044ED8A57E4E192D171CAC3EBFF8D648684E52A690DFD6B8BDD7DC28AF8D6174C", | 37 | "keyPassword": "0000001EFBAD9B2C408962C5BF2044ED8A57E4E192D171CAC3EBFF8D648684E52A690DFD6B8BDD7DC28AF8D6174C", |
| 38 | "signAlg": "SHA256withECDSA", | 38 | "signAlg": "SHA256withECDSA", |
| 39 | - "profile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debugDebug.p7b", | ||
| 40 | - "certpath": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debug.cer" | 39 | + "profile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debugDebug.p7b", |
| 40 | + "certpath": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debug.cer" | ||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | ], | 43 | ], |
| 44 | "products": [ | 44 | "products": [ |
| 45 | { | 45 | { |
| 46 | "name": "default", | 46 | "name": "default", |
| 47 | - "signingConfig": "debug", | 47 | + "signingConfig": "auto", |
| 48 | "targetSdkVersion": "6.0.0(20)", | 48 | "targetSdkVersion": "6.0.0(20)", |
| 49 | "compatibleSdkVersion": "6.0.0(20)", | 49 | "compatibleSdkVersion": "6.0.0(20)", |
| 50 | "runtimeOS": "HarmonyOS", | 50 | "runtimeOS": "HarmonyOS", |
-
Please register or login to post a comment