chatapp3-flutter/lib/app/config/configs/sc_variant1_config.dart
2026-04-11 13:52:49 +08:00

174 lines
6.0 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/foundation.dart';
import 'package:yumi/app/config/app_config.dart';
import 'package:yumi/app/config/business_logic_strategy.dart';
import 'package:yumi/app/config/strategies/variant1_business_logic_strategy.dart';
/// 马甲包配置
class SCVariant1Config implements AppConfig {
BusinessLogicStrategy? _businessLogicStrategy;
@override
String get appName => 'yumi'; // 马甲包应用名称
@override
String get packageName => 'com.org.yumi';
@override
String get apiHost => const String.fromEnvironment(
'API_HOST',
defaultValue: 'https://jvapi.haiyihy.com/',
); // 默认连线上环境,本地调试可通过 --dart-define=API_HOST 覆盖
@override
String get imgHost => 'https://img.atuchat.com/'; // 测试图片服务器,上架前需替换为正式域名
@override
String get privacyAgreementUrl => 'https://www.atuchat.com/privacy.html'; // 测试隐私政策页面,上架前需替换
@override
String get userAgreementUrl => 'https://www.atuchat.com/service.html'; // 测试用户协议页面,上架前需替换
@override
String get appDownloadUrlGoogle => 'https://play.google.com/store/apps/details?id=$packageName';
@override
String get appDownloadUrlApple => 'https://apps.apple.com/us/app/atuchat/id1234567890'; // 需要更新为真实App Store ID
@override
String get anchorAgentUrl => 'https://h5.atuchat.com/#/apply'; // 测试H5页面上架前需替换为正式域名
@override
String get hostCenterUrl => 'https://h5.atuchat.com/#/host-center'; // 测试H5页面上架前需替换为正式域名
@override
String get bdCenterUrl => 'https://h5.atuchat.com/#/bd-center'; // 测试H5页面上架前需替换为正式域名
@override
String get bdLeaderUrl => 'http://h5.atuchat.com/#/bd-leader-center'; // 测试H5页面上架前需替换为正式域名
@override
String get coinSellerUrl => 'https://h5.atuchat.com/#/coin-seller'; // 测试H5页面上架前需替换为正式域名
@override
String get adminUrl => 'https://h5.atuchat.com/#/admin-center'; // 测试H5页面上架前需替换为正式域名
@override
String get agencyCenterUrl => 'https://h5.atuchat.com/#/agency-center'; // 测试H5页面上架前需替换为正式域名
@override
String get gamesKingUrl => 'https://h5.atuchat.com/#/games-king'; // 测试H5页面上架前需替换为正式域名
@override
String get wealthRankUrl => 'https://h5.atuchat.com/#/ranking?first=Wealth'; // 测试H5页面上架前需替换为正式域名
@override
String get charmRankUrl => 'https://h5.atuchat.com/#/ranking?first=Charm'; // 测试H5页面上架前需替换为正式域名
@override
String get roomRankUrl => 'https://h5.atuchat.com/#/ranking?first=Room'; // 测试H5页面上架前需替换为正式域名
@override
String get inviteNewUserUrl => 'https://h5.atuchat.com/#/invitation/invite-new-user'; // 测试H5页面上架前需替换为正式域名
@override
int get primaryColor => 0xffFF5722; // 不同主色(橙色)
@override
String get tencentImAppid => '20036101';
@override
String get agoraRtcAppid => 'ceb9e2620d454bca9725f7a7f11d4019';
@override
num get gameAppid => 9999999999; // 需要注册新的游戏服务账户并获取独立App ID
@override
String get gameAppChannel => 'yumi';
@override
String get bigBroadcastGroup => '@TGS#2RUK4PK5C2';
@override
String get imAdmin => 'c2c_yumiadmin';
@override
bool get isReview => true;
@override
bool get isGiftSpecialEffects => true;
@override
bool get isEntryVehicleAnimation => true;
@override
bool get isFloatingAnimationInGlobal => true;
@override
bool get isLuckGiftSpecialEffects => true;
@override
Map<String, bool> get featureFlags => {
'giftSpecialEffects': isGiftSpecialEffects,
'entryVehicleAnimation': isEntryVehicleAnimation,
'floatingAnimationInGlobal': isFloatingAnimationInGlobal,
'luckGiftSpecialEffects': isLuckGiftSpecialEffects,
};
@override
BusinessLogicStrategy get businessLogicStrategy {
return _businessLogicStrategy ??= Variant1BusinessLogicStrategy();
}
@override
Map<String, dynamic> toMap() {
return {
'appName': appName,
'packageName': packageName,
'apiHost': apiHost,
'imgHost': imgHost,
'privacyAgreementUrl': privacyAgreementUrl,
'userAgreementUrl': userAgreementUrl,
'primaryColor': primaryColor,
'tencentImAppid': tencentImAppid,
'agoraRtcAppid': agoraRtcAppid,
'gameAppid': gameAppid,
'gameAppChannel': gameAppChannel,
'bigBroadcastGroup': bigBroadcastGroup,
'imAdmin': imAdmin,
'isReview': isReview,
'isGiftSpecialEffects': isGiftSpecialEffects,
'isEntryVehicleAnimation': isEntryVehicleAnimation,
'isFloatingAnimationInGlobal': isFloatingAnimationInGlobal,
'isLuckGiftSpecialEffects': isLuckGiftSpecialEffects,
'featureFlags': featureFlags,
'businessLogicStrategy': 'Variant1BusinessLogicStrategy',
};
}
@override
void validate() {
final errors = <String>[];
// 检查API主机地址
if (apiHost.isEmpty || !apiHost.startsWith('http')) {
errors.add('API主机地址无效或未设置');
}
// 如果有错误,根据模式处理
if (errors.isNotEmpty) {
final errorMessage = '应用配置验证失败:\n${errors.join('\n')}';
if (kDebugMode) {
// 调试模式下只输出警告,不阻止应用启动(方便开发)
debugPrint('⚠️ 警告: $errorMessage');
debugPrint('⚠️ 在调试模式下,应用将继续启动,但某些功能可能无法正常工作');
} else {
// 发布模式下抛出异常,阻止应用启动
throw StateError(errorMessage);
}
} else {
debugPrint('应用配置验证通过');
}
}
}