Showing
15 changed files
with
121 additions
and
51 deletions
| 1 | +import 'package:doublefeel_flutter/app/actions/dialog_action.dart'; | ||
| 2 | +import 'package:doublefeel_flutter/app/models/dialog_meta_data.dart'; | ||
| 3 | +import 'package:doublefeel_flutter/app/utils/dialog_utils.dart'; | ||
| 4 | +import 'package:doublefeel_flutter/core/config/app_environment_config.dart'; | ||
| 5 | +import 'package:doublefeel_flutter/core/services/loading_service.dart'; | ||
| 6 | +import 'package:doublefeel_flutter/core/services/thinking_data_service.dart'; | ||
| 7 | +import 'package:doublefeel_flutter/core/services/user_state_service.dart'; | ||
| 1 | import 'package:flutter/material.dart'; | 8 | import 'package:flutter/material.dart'; |
| 2 | import 'package:get/get.dart'; | 9 | import 'package:get/get.dart'; |
| 3 | 10 | ||
| @@ -27,6 +34,7 @@ enum DeveloperOptionsAction { | @@ -27,6 +34,7 @@ enum DeveloperOptionsAction { | ||
| 27 | shareUploadTaskRecord, | 34 | shareUploadTaskRecord, |
| 28 | shareLocalNotificationDebugRecord, | 35 | shareLocalNotificationDebugRecord, |
| 29 | clearHealthRawDataDatabaseAndUploadLog, | 36 | clearHealthRawDataDatabaseAndUploadLog, |
| 37 | + globalEnv, | ||
| 30 | } | 38 | } |
| 31 | 39 | ||
| 32 | class DeveloperOptionsController extends GetxController { | 40 | class DeveloperOptionsController extends GetxController { |
| @@ -81,6 +89,10 @@ class DeveloperOptionsController extends GetxController { | @@ -81,6 +89,10 @@ class DeveloperOptionsController extends GetxController { | ||
| 81 | title: '清除本地数据库、上传日志', | 89 | title: '清除本地数据库、上传日志', |
| 82 | action: DeveloperOptionsAction.clearHealthRawDataDatabaseAndUploadLog, | 90 | action: DeveloperOptionsAction.clearHealthRawDataDatabaseAndUploadLog, |
| 83 | ), | 91 | ), |
| 92 | + DeveloperOptionsItem( | ||
| 93 | + title: 'Global Env', | ||
| 94 | + action: DeveloperOptionsAction.globalEnv, | ||
| 95 | + ), | ||
| 84 | ]; | 96 | ]; |
| 85 | 97 | ||
| 86 | @override | 98 | @override |
| @@ -118,6 +130,38 @@ class DeveloperOptionsController extends GetxController { | @@ -118,6 +130,38 @@ class DeveloperOptionsController extends GetxController { | ||
| 118 | case DeveloperOptionsAction.clearHealthRawDataDatabaseAndUploadLog: | 130 | case DeveloperOptionsAction.clearHealthRawDataDatabaseAndUploadLog: |
| 119 | await clearHealthRawDataDatabaseAndUploadLog(); | 131 | await clearHealthRawDataDatabaseAndUploadLog(); |
| 120 | break; | 132 | break; |
| 133 | + case DeveloperOptionsAction.globalEnv: | ||
| 134 | + { | ||
| 135 | + try { | ||
| 136 | + final confirmResult = await DialogUtils.showCommonDialog( | ||
| 137 | + DialogMetaData( | ||
| 138 | + title: '选择服务器环境', | ||
| 139 | + message: '', | ||
| 140 | + cancelText: '国内版', | ||
| 141 | + confirmText: '国际版', | ||
| 142 | + iconAsset: null)); | ||
| 143 | + if (confirmResult.action == DialogAction.confirm || | ||
| 144 | + confirmResult.action == DialogAction.cancel) { | ||
| 145 | + final environmentConfig = Get.find<AppEnvironmentConfig>(); | ||
| 146 | + final region = confirmResult.action == DialogAction.cancel | ||
| 147 | + ? AppRegion.china | ||
| 148 | + : AppRegion.global; | ||
| 149 | + if (environmentConfig.region.value == region) return; | ||
| 150 | + await environmentConfig.setRegion(region); | ||
| 151 | + ta.setSuperProperties({ | ||
| 152 | + 'app_region': environmentConfig.region.value == AppRegion.china | ||
| 153 | + ? 'mainland' | ||
| 154 | + : 'overseas' | ||
| 155 | + }); | ||
| 156 | + | ||
| 157 | + await LoadingService.instance.run(() async { | ||
| 158 | + await Get.find<UserStateService>().onLogout(); | ||
| 159 | + }); | ||
| 160 | + Get.offAllNamed(AppRoutes.login); | ||
| 161 | + } | ||
| 162 | + } catch (e) {} | ||
| 163 | + } | ||
| 164 | + break; | ||
| 121 | case null: | 165 | case null: |
| 122 | break; | 166 | break; |
| 123 | } | 167 | } |
| @@ -217,7 +261,7 @@ class DeveloperOptionsController extends GetxController { | @@ -217,7 +261,7 @@ class DeveloperOptionsController extends GetxController { | ||
| 217 | Future<void> saveAccessToken() async { | 261 | Future<void> saveAccessToken() async { |
| 218 | final token = tokenController.text.trim(); | 262 | final token = tokenController.text.trim(); |
| 219 | await _userPreferencesStorage.updateAccessToken(token); | 263 | await _userPreferencesStorage.updateAccessToken(token); |
| 220 | - Get.offAllNamed(AppRoutes.home); | 264 | + Get.offAllNamed(AppRoutes.splash); |
| 221 | } | 265 | } |
| 222 | 266 | ||
| 223 | @override | 267 | @override |
| @@ -20,9 +20,9 @@ import '../controllers/trend/trend_controller.dart'; | @@ -20,9 +20,9 @@ import '../controllers/trend/trend_controller.dart'; | ||
| 20 | class HomeBinding extends Bindings { | 20 | class HomeBinding extends Bindings { |
| 21 | @override | 21 | @override |
| 22 | void dependencies() { | 22 | void dependencies() { |
| 23 | - Get.lazyPut<HomeController>(() => HomeController(), fenix: true); | ||
| 24 | - Get.lazyPut<TodayController>( | ||
| 25 | - () => TodayController( | 23 | + Get.put<HomeController>(HomeController()); |
| 24 | + Get.put<TodayController>( | ||
| 25 | + TodayController( | ||
| 26 | Get.find<PayApi>(), | 26 | Get.find<PayApi>(), |
| 27 | Get.find<VipApi>(), | 27 | Get.find<VipApi>(), |
| 28 | HealthDataSourceWrapper( | 28 | HealthDataSourceWrapper( |
| @@ -33,17 +33,14 @@ class HomeBinding extends Bindings { | @@ -33,17 +33,14 @@ class HomeBinding extends Bindings { | ||
| 33 | Get.find<FriendApi>(), | 33 | Get.find<FriendApi>(), |
| 34 | Get.find<UserStateService>(), | 34 | Get.find<UserStateService>(), |
| 35 | ), | 35 | ), |
| 36 | - fenix: true, | ||
| 37 | ); | 36 | ); |
| 38 | - Get.lazyPut<MyController>( | ||
| 39 | - () => MyController( | 37 | + Get.put<MyController>( |
| 38 | + MyController( | ||
| 40 | Get.find<UserApi>(), Get.find<VipApi>(), Get.find<ThemeApi>()), | 39 | Get.find<UserApi>(), Get.find<VipApi>(), Get.find<ThemeApi>()), |
| 41 | - fenix: true, | ||
| 42 | ); | 40 | ); |
| 43 | - Get.lazyPut<TrendController>( | ||
| 44 | - () => TrendController(Get.find<FriendApi>()), | ||
| 45 | - fenix: true, | 41 | + Get.put<TrendController>( |
| 42 | + TrendController(Get.find<FriendApi>()), | ||
| 46 | ); | 43 | ); |
| 47 | - Get.lazyPut<FriendsController>(() => FriendsController(), fenix: true); | 44 | + Get.put<FriendsController>(FriendsController()); |
| 48 | } | 45 | } |
| 49 | } | 46 | } |
| 1 | +import 'package:doublefeel_flutter/app/routes/app_pages.dart'; | ||
| 2 | +import 'package:doublefeel_flutter/core/theme/app_theme.dart'; | ||
| 1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 2 | import 'package:get/get.dart'; | 4 | import 'package:get/get.dart'; |
| 3 | 5 | ||
| @@ -10,9 +12,6 @@ import '../../../../core/util/app_toast.dart'; | @@ -10,9 +12,6 @@ import '../../../../core/util/app_toast.dart'; | ||
| 10 | class DebugEnvironmentView extends StatelessWidget { | 12 | class DebugEnvironmentView extends StatelessWidget { |
| 11 | const DebugEnvironmentView({super.key}); | 13 | const DebugEnvironmentView({super.key}); |
| 12 | 14 | ||
| 13 | - static const _brandColor = Color(0xFF845EEE); | ||
| 14 | - static const _titleColor = Color(0xFF0F0F11); | ||
| 15 | - | ||
| 16 | @override | 15 | @override |
| 17 | Widget build(BuildContext context) { | 16 | Widget build(BuildContext context) { |
| 18 | final environmentConfig = Get.find<AppEnvironmentConfig>(); | 17 | final environmentConfig = Get.find<AppEnvironmentConfig>(); |
| @@ -21,15 +20,16 @@ class DebugEnvironmentView extends StatelessWidget { | @@ -21,15 +20,16 @@ class DebugEnvironmentView extends StatelessWidget { | ||
| 21 | return Scaffold( | 20 | return Scaffold( |
| 22 | backgroundColor: const Color(0xFFF7F6FA), | 21 | backgroundColor: const Color(0xFFF7F6FA), |
| 23 | appBar: AppBar( | 22 | appBar: AppBar( |
| 24 | - title: const Text('Debug'), | 23 | + title: const Text('Env'), |
| 25 | centerTitle: true, | 24 | centerTitle: true, |
| 26 | backgroundColor: Colors.white, | 25 | backgroundColor: Colors.white, |
| 27 | - foregroundColor: _titleColor, | 26 | + foregroundColor: context.colors.textPrimary, |
| 28 | elevation: 0, | 27 | elevation: 0, |
| 29 | ), | 28 | ), |
| 30 | body: SafeArea( | 29 | body: SafeArea( |
| 31 | child: Obx(() { | 30 | child: Obx(() { |
| 32 | final current = environmentConfig.environment.value; | 31 | final current = environmentConfig.environment.value; |
| 32 | + final region = environmentConfig.region.value; | ||
| 33 | 33 | ||
| 34 | return ListView( | 34 | return ListView( |
| 35 | padding: const EdgeInsets.all(16), | 35 | padding: const EdgeInsets.all(16), |
| @@ -45,11 +45,11 @@ class DebugEnvironmentView extends StatelessWidget { | @@ -45,11 +45,11 @@ class DebugEnvironmentView extends StatelessWidget { | ||
| 45 | RadioListTile<AppEnvironment>( | 45 | RadioListTile<AppEnvironment>( |
| 46 | value: environment, | 46 | value: environment, |
| 47 | groupValue: current, | 47 | groupValue: current, |
| 48 | - activeColor: _brandColor, | 48 | + activeColor: context.colors.primary, |
| 49 | title: Text( | 49 | title: Text( |
| 50 | environment.debugName, | 50 | environment.debugName, |
| 51 | - style: const TextStyle( | ||
| 52 | - color: _titleColor, | 51 | + style: TextStyle( |
| 52 | + color: context.colors.textPrimary, | ||
| 53 | fontSize: 16, | 53 | fontSize: 16, |
| 54 | fontWeight: FontWeight.w600, | 54 | fontWeight: FontWeight.w600, |
| 55 | ), | 55 | ), |
| @@ -57,7 +57,9 @@ class DebugEnvironmentView extends StatelessWidget { | @@ -57,7 +57,9 @@ class DebugEnvironmentView extends StatelessWidget { | ||
| 57 | subtitle: Text( | 57 | subtitle: Text( |
| 58 | environmentConfig.resolveServerUrlFor( | 58 | environmentConfig.resolveServerUrlFor( |
| 59 | environment, | 59 | environment, |
| 60 | - AppConst.serverBaseUrl, | 60 | + region == AppRegion.china |
| 61 | + ? AppConst.serverBaseUrl | ||
| 62 | + : AppConst.serverBaseUrlGlobal, | ||
| 61 | ), | 63 | ), |
| 62 | maxLines: 1, | 64 | maxLines: 1, |
| 63 | overflow: TextOverflow.ellipsis, | 65 | overflow: TextOverflow.ellipsis, |
| @@ -75,6 +77,15 @@ class DebugEnvironmentView extends StatelessWidget { | @@ -75,6 +77,15 @@ class DebugEnvironmentView extends StatelessWidget { | ||
| 75 | ], | 77 | ], |
| 76 | ), | 78 | ), |
| 77 | ), | 79 | ), |
| 80 | + SizedBox( | ||
| 81 | + height: 20, | ||
| 82 | + ), | ||
| 83 | + ElevatedButton( | ||
| 84 | + onPressed: () { | ||
| 85 | + Get.toNamed(Routes.DEVELOPER_OPTIONS); | ||
| 86 | + }, | ||
| 87 | + child: const Text('DEVELOPER OPTIONS'), | ||
| 88 | + ), | ||
| 78 | ], | 89 | ], |
| 79 | ); | 90 | ); |
| 80 | }), | 91 | }), |
| @@ -257,7 +257,7 @@ class LoginView extends GetView<LoginController> { | @@ -257,7 +257,7 @@ class LoginView extends GetView<LoginController> { | ||
| 257 | fontWeight: FontWeight.w600, | 257 | fontWeight: FontWeight.w600, |
| 258 | ), | 258 | ), |
| 259 | ), | 259 | ), |
| 260 | - child: Builder(builder: (context) { | 260 | + child: Obx(() { |
| 261 | final environmentConfig = | 261 | final environmentConfig = |
| 262 | Get.find<AppEnvironmentConfig>(); | 262 | Get.find<AppEnvironmentConfig>(); |
| 263 | return Text( | 263 | return Text( |
| @@ -285,9 +285,6 @@ class _ServiceRegionBottomSheet extends StatefulWidget { | @@ -285,9 +285,6 @@ class _ServiceRegionBottomSheet extends StatefulWidget { | ||
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | 287 | class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { |
| 288 | - static const _brandColor = Color(0xFF845EEE); | ||
| 289 | - static const _backgroundColor = Color(0xFFF5F2FF); | ||
| 290 | - | ||
| 291 | final _controller = Get.find<LoginController>(); | 288 | final _controller = Get.find<LoginController>(); |
| 292 | late AppRegion _selectedRegion; | 289 | late AppRegion _selectedRegion; |
| 293 | var _isSaving = false; | 290 | var _isSaving = false; |
| @@ -314,8 +311,8 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | @@ -314,8 +311,8 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | ||
| 314 | return SizedBox( | 311 | return SizedBox( |
| 315 | height: 446, | 312 | height: 446, |
| 316 | child: DecoratedBox( | 313 | child: DecoratedBox( |
| 317 | - decoration: const BoxDecoration( | ||
| 318 | - color: _backgroundColor, | 314 | + decoration: BoxDecoration( |
| 315 | + color: context.colors.backgroundPage, | ||
| 319 | borderRadius: BorderRadius.vertical(top: Radius.circular(16)), | 316 | borderRadius: BorderRadius.vertical(top: Radius.circular(16)), |
| 320 | ), | 317 | ), |
| 321 | child: Padding( | 318 | child: Padding( |
| @@ -338,7 +335,7 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | @@ -338,7 +335,7 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | ||
| 338 | 'assets/images/common/ic_close.png', | 335 | 'assets/images/common/ic_close.png', |
| 339 | width: 16, | 336 | width: 16, |
| 340 | height: 16, | 337 | height: 16, |
| 341 | - color: _brandColor, | 338 | + color: context.colors.primary, |
| 342 | ), | 339 | ), |
| 343 | ), | 340 | ), |
| 344 | ), | 341 | ), |
| @@ -386,8 +383,9 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | @@ -386,8 +383,9 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> { | ||
| 386 | child: ElevatedButton( | 383 | child: ElevatedButton( |
| 387 | onPressed: _isSaving ? null : _save, | 384 | onPressed: _isSaving ? null : _save, |
| 388 | style: ElevatedButton.styleFrom( | 385 | style: ElevatedButton.styleFrom( |
| 389 | - backgroundColor: _brandColor, | ||
| 390 | - disabledBackgroundColor: _brandColor.withValues( | 386 | + backgroundColor: context.colors.primary, |
| 387 | + disabledBackgroundColor: | ||
| 388 | + context.colors.primary.withValues( | ||
| 391 | alpha: 0.4, | 389 | alpha: 0.4, |
| 392 | ), | 390 | ), |
| 393 | foregroundColor: Colors.white, | 391 | foregroundColor: Colors.white, |
| 1 | +import 'package:doublefeel_flutter/app/routes/app_pages.dart'; | ||
| 1 | import 'package:flutter/widgets.dart'; | 2 | import 'package:flutter/widgets.dart'; |
| 2 | import 'package:get/get.dart'; | 3 | import 'package:get/get.dart'; |
| 3 | 4 | ||
| @@ -12,11 +13,19 @@ class PremiumActivatedController extends GetxController { | @@ -12,11 +13,19 @@ class PremiumActivatedController extends GetxController { | ||
| 12 | super.onClose(); | 13 | super.onClose(); |
| 13 | } | 14 | } |
| 14 | 15 | ||
| 15 | - executeBackLogic(BuildContext context) { | ||
| 16 | - Get.back(); | 16 | + void executeBackLogic(BuildContext context) { |
| 17 | + _navigateNext(); | ||
| 17 | } | 18 | } |
| 18 | 19 | ||
| 19 | - executeContinueLogic(BuildContext context) { | ||
| 20 | - Get.back(); | 20 | + void executeContinueLogic(BuildContext context) { |
| 21 | + _navigateNext(); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + void _navigateNext() { | ||
| 25 | + if (Get.key.currentState?.canPop() ?? false) { | ||
| 26 | + Get.back(); | ||
| 27 | + } else { | ||
| 28 | + Get.offAllNamed(AppRoutes.home); | ||
| 29 | + } | ||
| 21 | } | 30 | } |
| 22 | } | 31 | } |
| @@ -81,6 +81,9 @@ class SplashController extends GetxController { | @@ -81,6 +81,9 @@ class SplashController extends GetxController { | ||
| 81 | // me: me, | 81 | // me: me, |
| 82 | // partner: partner, | 82 | // partner: partner, |
| 83 | // ); | 83 | // ); |
| 84 | + try { | ||
| 85 | + await _userPrefs.updateMeUserInfo((userResult as AppSuccess).data); | ||
| 86 | + } catch (_) {} | ||
| 84 | if (vipPrefs != null) { | 87 | if (vipPrefs != null) { |
| 85 | await _userPrefs.updateVipInfo(vipPrefs); | 88 | await _userPrefs.updateVipInfo(vipPrefs); |
| 86 | } | 89 | } |
| @@ -2,6 +2,7 @@ import 'dart:async'; | @@ -2,6 +2,7 @@ import 'dart:async'; | ||
| 2 | import 'dart:io'; | 2 | import 'dart:io'; |
| 3 | 3 | ||
| 4 | import 'package:doublefeel_flutter/app/routes/app_pages.dart'; | 4 | import 'package:doublefeel_flutter/app/routes/app_pages.dart'; |
| 5 | +import 'package:doublefeel_flutter/core/config/app_environment_config.dart'; | ||
| 5 | import 'package:doublefeel_flutter/core/constants/app_const.dart'; | 6 | import 'package:doublefeel_flutter/core/constants/app_const.dart'; |
| 6 | import 'package:doublefeel_flutter/core/network/api/theme_api.dart'; | 7 | import 'package:doublefeel_flutter/core/network/api/theme_api.dart'; |
| 7 | import 'package:doublefeel_flutter/core/result/app_result.dart'; | 8 | import 'package:doublefeel_flutter/core/result/app_result.dart'; |
| @@ -35,6 +36,7 @@ class CreateWatchThemeController extends GetxController { | @@ -35,6 +36,7 @@ class CreateWatchThemeController extends GetxController { | ||
| 35 | bool _isClosed = false; | 36 | bool _isClosed = false; |
| 36 | bool _creationCompleted = false; | 37 | bool _creationCompleted = false; |
| 37 | late final TextEditingController themeNameController; | 38 | late final TextEditingController themeNameController; |
| 39 | + final environmentConfig = Get.find<AppEnvironmentConfig>(); | ||
| 38 | 40 | ||
| 39 | @override | 41 | @override |
| 40 | void onInit() { | 42 | void onInit() { |
| @@ -253,10 +255,10 @@ class CreateWatchThemeController extends GetxController { | @@ -253,10 +255,10 @@ class CreateWatchThemeController extends GetxController { | ||
| 253 | } | 255 | } |
| 254 | 256 | ||
| 255 | void openSubmissionAgreement() { | 257 | void openSubmissionAgreement() { |
| 256 | - Get.toNamed( | ||
| 257 | - AppRoutes.webview, | ||
| 258 | - parameters: {'url': AppConst.userSubmissionAgreement}, | ||
| 259 | - ); | 258 | + final url = environmentConfig.region.value == AppRegion.china |
| 259 | + ? AppConst.userSubmissionAgreement | ||
| 260 | + : AppConst.userSubmissionAgreementGlobal; | ||
| 261 | + Get.toNamed(AppRoutes.webview, parameters: {'url': url}); | ||
| 260 | } | 262 | } |
| 261 | 263 | ||
| 262 | Future<void> saveCustomTheme() async { | 264 | Future<void> saveCustomTheme() async { |
| @@ -26,9 +26,11 @@ abstract final class AppConst { | @@ -26,9 +26,11 @@ abstract final class AppConst { | ||
| 26 | static const String privacyPolicy = | 26 | static const String privacyPolicy = |
| 27 | 'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html'; | 27 | 'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html'; |
| 28 | static const String userTermsGlobal = | 28 | static const String userTermsGlobal = |
| 29 | - 'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AE.html'; | 29 | + 'https://cdn-oversea.doublefeel.cn/doublefeel/protocol/DoubleFeel_Terms_of_Service.html'; |
| 30 | static const String privacyPolicyGlobal = | 30 | static const String privacyPolicyGlobal = |
| 31 | - 'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html'; | 31 | + 'https://cdn-oversea.doublefeel.cn/doublefeel/protocol/DoubleFeel_Privacy_Policy.html'; |
| 32 | static const String userSubmissionAgreement = | 32 | static const String userSubmissionAgreement = |
| 33 | 'https://cdn.doublefeel.cn/doublefeel/protocol/creator.html'; | 33 | 'https://cdn.doublefeel.cn/doublefeel/protocol/creator.html'; |
| 34 | + static const String userSubmissionAgreementGlobal = | ||
| 35 | + 'https://cdn-oversea.doublefeel.cn/doublefeel/protocol/DoubleFeel_Creator_Agreement.html'; | ||
| 34 | } | 36 | } |
| 1 | +import 'package:doublefeel_flutter/app/actions/dialog_action.dart'; | ||
| 1 | import 'package:doublefeel_flutter/app/models/dialog_meta_data.dart'; | 2 | import 'package:doublefeel_flutter/app/models/dialog_meta_data.dart'; |
| 2 | import 'package:doublefeel_flutter/app/routes/app_pages.dart'; | 3 | import 'package:doublefeel_flutter/app/routes/app_pages.dart'; |
| 3 | import 'package:doublefeel_flutter/app/utils/dialog_utils.dart'; | 4 | import 'package:doublefeel_flutter/app/utils/dialog_utils.dart'; |
| @@ -41,7 +42,7 @@ class AppErrorHandler { | @@ -41,7 +42,7 @@ class AppErrorHandler { | ||
| 41 | } | 42 | } |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | - void _handleAccessTokenInvalid(String? accessToken) { | 45 | + Future<void> _handleAccessTokenInvalid(String? accessToken) async { |
| 45 | if (accessToken == null || accessToken.isEmpty) { | 46 | if (accessToken == null || accessToken.isEmpty) { |
| 46 | return; | 47 | return; |
| 47 | } | 48 | } |
| @@ -54,14 +55,17 @@ class AppErrorHandler { | @@ -54,14 +55,17 @@ class AppErrorHandler { | ||
| 54 | if (Get.isRegistered<UserStateService>()) { | 55 | if (Get.isRegistered<UserStateService>()) { |
| 55 | Get.find<UserStateService>().onLogout(); | 56 | Get.find<UserStateService>().onLogout(); |
| 56 | } | 57 | } |
| 57 | - Get.offAllNamed(AppRoutes.login); | ||
| 58 | - DialogUtils.showCommonDialog(DialogMetaData( | 58 | + final confirmResult = await DialogUtils.showCommonDialog(DialogMetaData( |
| 59 | title: l10n.logOut, | 59 | title: l10n.logOut, |
| 60 | + isCancelable: false, | ||
| 60 | message: l10n | 61 | message: l10n |
| 61 | .yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue, | 62 | .yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue, |
| 62 | confirmText: l10n.watchThemeOk, | 63 | confirmText: l10n.watchThemeOk, |
| 63 | iconAsset: 'assets/images/common/ic_warning.png', | 64 | iconAsset: 'assets/images/common/ic_warning.png', |
| 64 | )); | 65 | )); |
| 66 | + if (confirmResult.action != DialogAction.confirm) return; | ||
| 67 | + | ||
| 68 | + Get.offAllNamed(AppRoutes.login); | ||
| 65 | } | 69 | } |
| 66 | 70 | ||
| 67 | void _showMessage(String? message) { | 71 | void _showMessage(String? message) { |
| @@ -287,7 +287,7 @@ | @@ -287,7 +287,7 @@ | ||
| 287 | "invalidEmailFormat": "Invalid email format", | 287 | "invalidEmailFormat": "Invalid email format", |
| 288 | "deleteAccount": "Delete Account", | 288 | "deleteAccount": "Delete Account", |
| 289 | "mobilePhoneNumber": "Mobile phone number", | 289 | "mobilePhoneNumber": "Mobile phone number", |
| 290 | - "logOut": "Sign Out", | 290 | + "logOut": "Logged Out", |
| 291 | "confirmLogoutPrompt": "Are you sure you want to log out?", | 291 | "confirmLogoutPrompt": "Are you sure you want to log out?", |
| 292 | "confirmLogout": "Yes, I’m sure", | 292 | "confirmLogout": "Yes, I’m sure", |
| 293 | "loggedOutSuccessfully": "Logged out successfully", | 293 | "loggedOutSuccessfully": "Logged out successfully", |
| @@ -1065,4 +1065,4 @@ | @@ -1065,4 +1065,4 @@ | ||
| 1065 | } | 1065 | } |
| 1066 | }, | 1066 | }, |
| 1067 | "updatePassword": "Update password" | 1067 | "updatePassword": "Update password" |
| 1068 | -} | 1068 | +} |
| @@ -1393,7 +1393,7 @@ | @@ -1393,7 +1393,7 @@ | ||
| 1393 | "continueWithGoogle": "使用 Google", | 1393 | "continueWithGoogle": "使用 Google", |
| 1394 | "emailLoginEmailHint": "请输入邮箱", | 1394 | "emailLoginEmailHint": "请输入邮箱", |
| 1395 | "emailLoginYourPassword": "请输入密码", | 1395 | "emailLoginYourPassword": "请输入密码", |
| 1396 | - "yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。", | 1396 | + "yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。", |
| 1397 | "contactUs": "联系我们", | 1397 | "contactUs": "联系我们", |
| 1398 | "pleaseDescribeTheProblemClearlyAndIncludeScreenRecordingsIfPossible": "请清楚地描述问题,并尽可能附上屏幕录像。", | 1398 | "pleaseDescribeTheProblemClearlyAndIncludeScreenRecordingsIfPossible": "请清楚地描述问题,并尽可能附上屏幕录像。", |
| 1399 | "sendUsYourUserIdAsItWillHelpUsIdentifyTheProblemFaster": "请将您的用户 ID 发送给我们,这将有助于我们更快地查明问题所在。", | 1399 | "sendUsYourUserIdAsItWillHelpUsIdentifyTheProblemFaster": "请将您的用户 ID 发送给我们,这将有助于我们更快地查明问题所在。", |
| @@ -783,7 +783,7 @@ | @@ -783,7 +783,7 @@ | ||
| 783 | "continueWithGoogle": "使用 Google", | 783 | "continueWithGoogle": "使用 Google", |
| 784 | "emailLoginEmailHint": "请输入邮箱", | 784 | "emailLoginEmailHint": "请输入邮箱", |
| 785 | "emailLoginYourPassword": "请输入密码", | 785 | "emailLoginYourPassword": "请输入密码", |
| 786 | - "yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。", | 786 | + "yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。", |
| 787 | "contactUs": "联系我们", | 787 | "contactUs": "联系我们", |
| 788 | "pleaseDescribeTheProblemClearlyAndIncludeScreenRecordingsIfPossible": "请清楚地描述问题,并尽可能附上屏幕录像。", | 788 | "pleaseDescribeTheProblemClearlyAndIncludeScreenRecordingsIfPossible": "请清楚地描述问题,并尽可能附上屏幕录像。", |
| 789 | "sendUsYourUserIdAsItWillHelpUsIdentifyTheProblemFaster": "请将您的用户 ID 发送给我们,这将有助于我们更快地查明问题所在。", | 789 | "sendUsYourUserIdAsItWillHelpUsIdentifyTheProblemFaster": "请将您的用户 ID 发送给我们,这将有助于我们更快地查明问题所在。", |
| @@ -4829,7 +4829,7 @@ abstract class AppLocalizations { | @@ -4829,7 +4829,7 @@ abstract class AppLocalizations { | ||
| 4829 | /// No description provided for @yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue. | 4829 | /// No description provided for @yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue. |
| 4830 | /// | 4830 | /// |
| 4831 | /// In zh, this message translates to: | 4831 | /// In zh, this message translates to: |
| 4832 | - /// **'由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。'** | 4832 | + /// **'由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。'** |
| 4833 | String | 4833 | String |
| 4834 | get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue; | 4834 | get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue; |
| 4835 | 4835 |
| @@ -953,7 +953,7 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -953,7 +953,7 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 953 | String get mobilePhoneNumber => 'Mobile phone number'; | 953 | String get mobilePhoneNumber => 'Mobile phone number'; |
| 954 | 954 | ||
| 955 | @override | 955 | @override |
| 956 | - String get logOut => 'Sign Out'; | 956 | + String get logOut => 'Logged Out'; |
| 957 | 957 | ||
| 958 | @override | 958 | @override |
| 959 | String get confirmLogoutPrompt => 'Are you sure you want to log out?'; | 959 | String get confirmLogoutPrompt => 'Are you sure you want to log out?'; |
| @@ -2594,7 +2594,7 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -2594,7 +2594,7 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 2594 | @override | 2594 | @override |
| 2595 | String | 2595 | String |
| 2596 | get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue => | 2596 | get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue => |
| 2597 | - '由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。'; | 2597 | + '由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。'; |
| 2598 | 2598 | ||
| 2599 | @override | 2599 | @override |
| 2600 | String get contactUs => '联系我们'; | 2600 | String get contactUs => '联系我们'; |
| @@ -5374,7 +5374,7 @@ class AppLocalizationsZhHans extends AppLocalizationsZh { | @@ -5374,7 +5374,7 @@ class AppLocalizationsZhHans extends AppLocalizationsZh { | ||
| 5374 | @override | 5374 | @override |
| 5375 | String | 5375 | String |
| 5376 | get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue => | 5376 | get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue => |
| 5377 | - '由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。'; | 5377 | + '由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。'; |
| 5378 | 5378 | ||
| 5379 | @override | 5379 | @override |
| 5380 | String get contactUs => '联系我们'; | 5380 | String get contactUs => '联系我们'; |
-
Please register or login to post a comment