Showing
2 changed files
with
14 additions
and
2 deletions
| @@ -48,19 +48,20 @@ void registerCoreDeps({ | @@ -48,19 +48,20 @@ void registerCoreDeps({ | ||
| 48 | void registerUserSessionDeps() { | 48 | void registerUserSessionDeps() { |
| 49 | final dioClient = Get.find<DioClient>(); | 49 | final dioClient = Get.find<DioClient>(); |
| 50 | final userPrefs = Get.find<UserPreferencesStorage>(); | 50 | final userPrefs = Get.find<UserPreferencesStorage>(); |
| 51 | + final environmentConfig = Get.find<AppEnvironmentConfig>(); | ||
| 51 | 52 | ||
| 52 | Get.put(UserApi(dioClient), permanent: true); | 53 | Get.put(UserApi(dioClient), permanent: true); |
| 53 | Get.put(VipApi(dioClient), permanent: true); | 54 | Get.put(VipApi(dioClient), permanent: true); |
| 54 | Get.put(FriendApi(dioClient), permanent: true); | 55 | Get.put(FriendApi(dioClient), permanent: true); |
| 55 | Get.put<ImService>(ImServiceStub(), permanent: true); | 56 | Get.put<ImService>(ImServiceStub(), permanent: true); |
| 56 | Get.put( | 57 | Get.put( |
| 57 | - ThinkingDataService(Get.find<AppEnvironmentConfig>()), | 58 | + ThinkingDataService(environmentConfig), |
| 58 | permanent: true, | 59 | permanent: true, |
| 59 | ); | 60 | ); |
| 60 | Get.put(PushService(Get.find<UserApi>()), permanent: true); | 61 | Get.put(PushService(Get.find<UserApi>()), permanent: true); |
| 61 | Get.put( | 62 | Get.put( |
| 62 | HealthRawDataCoreService( | 63 | HealthRawDataCoreService( |
| 63 | - environmentConfig: Get.find<AppEnvironmentConfig>(), | 64 | + environmentConfig: environmentConfig, |
| 64 | userIdProvider: () => userPrefs.preferences.value.meUserInfo?.id ?? 0, | 65 | userIdProvider: () => userPrefs.preferences.value.meUserInfo?.id ?? 0, |
| 65 | serverHealthApi: HealthApi(dioClient), | 66 | serverHealthApi: HealthApi(dioClient), |
| 66 | ), | 67 | ), |
| @@ -68,6 +69,7 @@ void registerUserSessionDeps() { | @@ -68,6 +69,7 @@ void registerUserSessionDeps() { | ||
| 68 | ); | 69 | ); |
| 69 | Get.put( | 70 | Get.put( |
| 70 | UserStateService( | 71 | UserStateService( |
| 72 | + environmentConfig, | ||
| 71 | userPrefs, | 73 | userPrefs, |
| 72 | Get.find<UserApi>(), | 74 | Get.find<UserApi>(), |
| 73 | Get.find<ImService>(), | 75 | Get.find<ImService>(), |
| 1 | +import 'package:doublefeel_flutter/core/config/app_environment_config.dart'; | ||
| 1 | import 'package:doublefeel_flutter/core/services/raw_data_service/health_raw_data_core_service.dart'; | 2 | import 'package:doublefeel_flutter/core/services/raw_data_service/health_raw_data_core_service.dart'; |
| 2 | import 'package:doublefeel_flutter/pigeon/platform_api.g.dart'; | 3 | import 'package:doublefeel_flutter/pigeon/platform_api.g.dart'; |
| 3 | 4 | ||
| @@ -11,6 +12,7 @@ import 'thinking_data_service.dart'; | @@ -11,6 +12,7 @@ import 'thinking_data_service.dart'; | ||
| 11 | /// Login lifecycle and SDK initialization. | 12 | /// Login lifecycle and SDK initialization. |
| 12 | class UserStateService { | 13 | class UserStateService { |
| 13 | UserStateService( | 14 | UserStateService( |
| 15 | + this._environmentConfig, | ||
| 14 | this._userPrefs, | 16 | this._userPrefs, |
| 15 | this._userApi, | 17 | this._userApi, |
| 16 | this._imService, | 18 | this._imService, |
| @@ -19,6 +21,7 @@ class UserStateService { | @@ -19,6 +21,7 @@ class UserStateService { | ||
| 19 | this._healthRawDataCoreService, | 21 | this._healthRawDataCoreService, |
| 20 | ); | 22 | ); |
| 21 | 23 | ||
| 24 | + final AppEnvironmentConfig _environmentConfig; | ||
| 22 | final UserPreferencesStorage _userPrefs; | 25 | final UserPreferencesStorage _userPrefs; |
| 23 | final UserApi _userApi; | 26 | final UserApi _userApi; |
| 24 | final ImService _imService; | 27 | final ImService _imService; |
| @@ -88,6 +91,13 @@ class UserStateService { | @@ -88,6 +91,13 @@ class UserStateService { | ||
| 88 | props['account_create_time'] = me!.createTime; | 91 | props['account_create_time'] = me!.createTime; |
| 89 | } | 92 | } |
| 90 | props['vip_status'] = isVip ? '会员' : '非会员'; | 93 | props['vip_status'] = isVip ? '会员' : '非会员'; |
| 94 | + | ||
| 95 | + // 设置账号地区归属 | ||
| 96 | + props['app_region'] = _environmentConfig.region.value == AppRegion.china | ||
| 97 | + ? 'mainland' | ||
| 98 | + : 'overseas'; | ||
| 99 | + | ||
| 100 | + | ||
| 91 | if (props.isNotEmpty) { | 101 | if (props.isNotEmpty) { |
| 92 | _thinkingDataService.setSuperProperties(props); | 102 | _thinkingDataService.setSuperProperties(props); |
| 93 | } | 103 | } |
-
Please register or login to post a comment