Commit 526cc8264a76d4f6a11095f477d44645c1ce4db2

Authored by 常守达
1 parent cfad1d5d

fix(app): 看板问题修复

import 'package:doublefeel_flutter/app/actions/dialog_action.dart';
import 'package:doublefeel_flutter/app/models/dialog_meta_data.dart';
import 'package:doublefeel_flutter/app/utils/dialog_utils.dart';
import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
import 'package:doublefeel_flutter/core/services/loading_service.dart';
import 'package:doublefeel_flutter/core/services/thinking_data_service.dart';
import 'package:doublefeel_flutter/core/services/user_state_service.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
... ... @@ -27,6 +34,7 @@ enum DeveloperOptionsAction {
shareUploadTaskRecord,
shareLocalNotificationDebugRecord,
clearHealthRawDataDatabaseAndUploadLog,
globalEnv,
}
class DeveloperOptionsController extends GetxController {
... ... @@ -81,6 +89,10 @@ class DeveloperOptionsController extends GetxController {
title: '清除本地数据库、上传日志',
action: DeveloperOptionsAction.clearHealthRawDataDatabaseAndUploadLog,
),
DeveloperOptionsItem(
title: 'Global Env',
action: DeveloperOptionsAction.globalEnv,
),
];
@override
... ... @@ -118,6 +130,38 @@ class DeveloperOptionsController extends GetxController {
case DeveloperOptionsAction.clearHealthRawDataDatabaseAndUploadLog:
await clearHealthRawDataDatabaseAndUploadLog();
break;
case DeveloperOptionsAction.globalEnv:
{
try {
final confirmResult = await DialogUtils.showCommonDialog(
DialogMetaData(
title: '选择服务器环境',
message: '',
cancelText: '国内版',
confirmText: '国际版',
iconAsset: null));
if (confirmResult.action == DialogAction.confirm ||
confirmResult.action == DialogAction.cancel) {
final environmentConfig = Get.find<AppEnvironmentConfig>();
final region = confirmResult.action == DialogAction.cancel
? AppRegion.china
: AppRegion.global;
if (environmentConfig.region.value == region) return;
await environmentConfig.setRegion(region);
ta.setSuperProperties({
'app_region': environmentConfig.region.value == AppRegion.china
? 'mainland'
: 'overseas'
});
await LoadingService.instance.run(() async {
await Get.find<UserStateService>().onLogout();
});
Get.offAllNamed(AppRoutes.login);
}
} catch (e) {}
}
break;
case null:
break;
}
... ... @@ -217,7 +261,7 @@ class DeveloperOptionsController extends GetxController {
Future<void> saveAccessToken() async {
final token = tokenController.text.trim();
await _userPreferencesStorage.updateAccessToken(token);
Get.offAllNamed(AppRoutes.home);
Get.offAllNamed(AppRoutes.splash);
}
@override
... ...
... ... @@ -20,9 +20,9 @@ import '../controllers/trend/trend_controller.dart';
class HomeBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<HomeController>(() => HomeController(), fenix: true);
Get.lazyPut<TodayController>(
() => TodayController(
Get.put<HomeController>(HomeController());
Get.put<TodayController>(
TodayController(
Get.find<PayApi>(),
Get.find<VipApi>(),
HealthDataSourceWrapper(
... ... @@ -33,17 +33,14 @@ class HomeBinding extends Bindings {
Get.find<FriendApi>(),
Get.find<UserStateService>(),
),
fenix: true,
);
Get.lazyPut<MyController>(
() => MyController(
Get.put<MyController>(
MyController(
Get.find<UserApi>(), Get.find<VipApi>(), Get.find<ThemeApi>()),
fenix: true,
);
Get.lazyPut<TrendController>(
() => TrendController(Get.find<FriendApi>()),
fenix: true,
Get.put<TrendController>(
TrendController(Get.find<FriendApi>()),
);
Get.lazyPut<FriendsController>(() => FriendsController(), fenix: true);
Get.put<FriendsController>(FriendsController());
}
}
... ...
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
... ... @@ -10,9 +12,6 @@ import '../../../../core/util/app_toast.dart';
class DebugEnvironmentView extends StatelessWidget {
const DebugEnvironmentView({super.key});
static const _brandColor = Color(0xFF845EEE);
static const _titleColor = Color(0xFF0F0F11);
@override
Widget build(BuildContext context) {
final environmentConfig = Get.find<AppEnvironmentConfig>();
... ... @@ -21,15 +20,16 @@ class DebugEnvironmentView extends StatelessWidget {
return Scaffold(
backgroundColor: const Color(0xFFF7F6FA),
appBar: AppBar(
title: const Text('Debug'),
title: const Text('Env'),
centerTitle: true,
backgroundColor: Colors.white,
foregroundColor: _titleColor,
foregroundColor: context.colors.textPrimary,
elevation: 0,
),
body: SafeArea(
child: Obx(() {
final current = environmentConfig.environment.value;
final region = environmentConfig.region.value;
return ListView(
padding: const EdgeInsets.all(16),
... ... @@ -45,11 +45,11 @@ class DebugEnvironmentView extends StatelessWidget {
RadioListTile<AppEnvironment>(
value: environment,
groupValue: current,
activeColor: _brandColor,
activeColor: context.colors.primary,
title: Text(
environment.debugName,
style: const TextStyle(
color: _titleColor,
style: TextStyle(
color: context.colors.textPrimary,
fontSize: 16,
fontWeight: FontWeight.w600,
),
... ... @@ -57,7 +57,9 @@ class DebugEnvironmentView extends StatelessWidget {
subtitle: Text(
environmentConfig.resolveServerUrlFor(
environment,
AppConst.serverBaseUrl,
region == AppRegion.china
? AppConst.serverBaseUrl
: AppConst.serverBaseUrlGlobal,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
... ... @@ -75,6 +77,15 @@ class DebugEnvironmentView extends StatelessWidget {
],
),
),
SizedBox(
height: 20,
),
ElevatedButton(
onPressed: () {
Get.toNamed(Routes.DEVELOPER_OPTIONS);
},
child: const Text('DEVELOPER OPTIONS'),
),
],
);
}),
... ...
... ... @@ -257,7 +257,7 @@ class LoginView extends GetView<LoginController> {
fontWeight: FontWeight.w600,
),
),
child: Builder(builder: (context) {
child: Obx(() {
final environmentConfig =
Get.find<AppEnvironmentConfig>();
return Text(
... ... @@ -285,9 +285,6 @@ class _ServiceRegionBottomSheet extends StatefulWidget {
}
class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> {
static const _brandColor = Color(0xFF845EEE);
static const _backgroundColor = Color(0xFFF5F2FF);
final _controller = Get.find<LoginController>();
late AppRegion _selectedRegion;
var _isSaving = false;
... ... @@ -314,8 +311,8 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> {
return SizedBox(
height: 446,
child: DecoratedBox(
decoration: const BoxDecoration(
color: _backgroundColor,
decoration: BoxDecoration(
color: context.colors.backgroundPage,
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
child: Padding(
... ... @@ -338,7 +335,7 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> {
'assets/images/common/ic_close.png',
width: 16,
height: 16,
color: _brandColor,
color: context.colors.primary,
),
),
),
... ... @@ -386,8 +383,9 @@ class _ServiceRegionBottomSheetState extends State<_ServiceRegionBottomSheet> {
child: ElevatedButton(
onPressed: _isSaving ? null : _save,
style: ElevatedButton.styleFrom(
backgroundColor: _brandColor,
disabledBackgroundColor: _brandColor.withValues(
backgroundColor: context.colors.primary,
disabledBackgroundColor:
context.colors.primary.withValues(
alpha: 0.4,
),
foregroundColor: Colors.white,
... ...
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
... ... @@ -12,11 +13,19 @@ class PremiumActivatedController extends GetxController {
super.onClose();
}
executeBackLogic(BuildContext context) {
Get.back();
void executeBackLogic(BuildContext context) {
_navigateNext();
}
executeContinueLogic(BuildContext context) {
Get.back();
void executeContinueLogic(BuildContext context) {
_navigateNext();
}
void _navigateNext() {
if (Get.key.currentState?.canPop() ?? false) {
Get.back();
} else {
Get.offAllNamed(AppRoutes.home);
}
}
}
... ...
... ... @@ -81,6 +81,9 @@ class SplashController extends GetxController {
// me: me,
// partner: partner,
// );
try {
await _userPrefs.updateMeUserInfo((userResult as AppSuccess).data);
} catch (_) {}
if (vipPrefs != null) {
await _userPrefs.updateVipInfo(vipPrefs);
}
... ...
... ... @@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
import 'package:doublefeel_flutter/core/constants/app_const.dart';
import 'package:doublefeel_flutter/core/network/api/theme_api.dart';
import 'package:doublefeel_flutter/core/result/app_result.dart';
... ... @@ -35,6 +36,7 @@ class CreateWatchThemeController extends GetxController {
bool _isClosed = false;
bool _creationCompleted = false;
late final TextEditingController themeNameController;
final environmentConfig = Get.find<AppEnvironmentConfig>();
@override
void onInit() {
... ... @@ -253,10 +255,10 @@ class CreateWatchThemeController extends GetxController {
}
void openSubmissionAgreement() {
Get.toNamed(
AppRoutes.webview,
parameters: {'url': AppConst.userSubmissionAgreement},
);
final url = environmentConfig.region.value == AppRegion.china
? AppConst.userSubmissionAgreement
: AppConst.userSubmissionAgreementGlobal;
Get.toNamed(AppRoutes.webview, parameters: {'url': url});
}
Future<void> saveCustomTheme() async {
... ...
... ... @@ -26,9 +26,11 @@ abstract final class AppConst {
static const String privacyPolicy =
'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html';
static const String userTermsGlobal =
'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AE.html';
'https://cdn-oversea.doublefeel.cn/doublefeel/protocol/DoubleFeel_Terms_of_Service.html';
static const String privacyPolicyGlobal =
'https://cdn.doublefeel.cn/doublefeel/protocol/DoubleFeel%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.html';
'https://cdn-oversea.doublefeel.cn/doublefeel/protocol/DoubleFeel_Privacy_Policy.html';
static const String userSubmissionAgreement =
'https://cdn.doublefeel.cn/doublefeel/protocol/creator.html';
static const String userSubmissionAgreementGlobal =
'https://cdn-oversea.doublefeel.cn/doublefeel/protocol/DoubleFeel_Creator_Agreement.html';
}
... ...
import 'package:doublefeel_flutter/app/actions/dialog_action.dart';
import 'package:doublefeel_flutter/app/models/dialog_meta_data.dart';
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/app/utils/dialog_utils.dart';
... ... @@ -41,7 +42,7 @@ class AppErrorHandler {
}
}
void _handleAccessTokenInvalid(String? accessToken) {
Future<void> _handleAccessTokenInvalid(String? accessToken) async {
if (accessToken == null || accessToken.isEmpty) {
return;
}
... ... @@ -54,14 +55,17 @@ class AppErrorHandler {
if (Get.isRegistered<UserStateService>()) {
Get.find<UserStateService>().onLogout();
}
Get.offAllNamed(AppRoutes.login);
DialogUtils.showCommonDialog(DialogMetaData(
final confirmResult = await DialogUtils.showCommonDialog(DialogMetaData(
title: l10n.logOut,
isCancelable: false,
message: l10n
.yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue,
confirmText: l10n.watchThemeOk,
iconAsset: 'assets/images/common/ic_warning.png',
));
if (confirmResult.action != DialogAction.confirm) return;
Get.offAllNamed(AppRoutes.login);
}
void _showMessage(String? message) {
... ...
... ... @@ -287,7 +287,7 @@
"invalidEmailFormat": "Invalid email format",
"deleteAccount": "Delete Account",
"mobilePhoneNumber": "Mobile phone number",
"logOut": "Sign Out",
"logOut": "Logged Out",
"confirmLogoutPrompt": "Are you sure you want to log out?",
"confirmLogout": "Yes, I’m sure",
"loggedOutSuccessfully": "Logged out successfully",
... ... @@ -1065,4 +1065,4 @@
}
},
"updatePassword": "Update password"
}
}
\ No newline at end of file
... ...
... ... @@ -1393,7 +1393,7 @@
"continueWithGoogle": "使用 Google",
"emailLoginEmailHint": "请输入邮箱",
"emailLoginYourPassword": "请输入密码",
"yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。",
"yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。",
"contactUs": "联系我们",
"pleaseDescribeTheProblemClearlyAndIncludeScreenRecordingsIfPossible": "请清楚地描述问题,并尽可能附上屏幕录像。",
"sendUsYourUserIdAsItWillHelpUsIdentifyTheProblemFaster": "请将您的用户 ID 发送给我们,这将有助于我们更快地查明问题所在。",
... ...
... ... @@ -783,7 +783,7 @@
"continueWithGoogle": "使用 Google",
"emailLoginEmailHint": "请输入邮箱",
"emailLoginYourPassword": "请输入密码",
"yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。",
"yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue": "由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。",
"contactUs": "联系我们",
"pleaseDescribeTheProblemClearlyAndIncludeScreenRecordingsIfPossible": "请清楚地描述问题,并尽可能附上屏幕录像。",
"sendUsYourUserIdAsItWillHelpUsIdentifyTheProblemFaster": "请将您的用户 ID 发送给我们,这将有助于我们更快地查明问题所在。",
... ...
... ... @@ -4829,7 +4829,7 @@ abstract class AppLocalizations {
/// No description provided for @yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue.
///
/// In zh, this message translates to:
/// **'由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。'**
/// **'由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。'**
String
get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue;
... ...
... ... @@ -953,7 +953,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get mobilePhoneNumber => 'Mobile phone number';
@override
String get logOut => 'Sign Out';
String get logOut => 'Logged Out';
@override
String get confirmLogoutPrompt => 'Are you sure you want to log out?';
... ...
... ... @@ -2594,7 +2594,7 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String
get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue =>
'由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。';
'由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。';
@override
String get contactUs => '联系我们';
... ... @@ -5374,7 +5374,7 @@ class AppLocalizationsZhHans extends AppLocalizationsZh {
@override
String
get yourAccountWasSignedOutDueToAnotherDeviceLoginOrTokenExpirationPleaseLogInAgainToContinue =>
'由于其他设备登录或令牌过期,您的账户已被注销。请重新登录以继续操作。';
'由于其他设备登录或令牌过期,您的账户已被退出登录。请重新登录以继续操作。';
@override
String get contactUs => '联系我们';
... ...