chatapp3-flutter/lib/app/config/configs/sc_variant1_config.dart
2026-04-09 21:32:23 +08:00

171 lines
6.1 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 => 'http://10.0.2.2:1100/'; // Android 模拟器访问宿主机本地网关
@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 => '00000000'; // 需要注册新的腾讯云IM账户并获取独立App ID
@override
String get agoraRtcAppid => '00000000'; // 需要创建新的Agora项目并获取独立App ID
@override
num get gameAppid => 9999999999; // 需要注册新的游戏服务账户并获取独立App ID
@override
String get gameAppChannel => 'yumi';
@override
String get bigBroadcastGroup => '@TGS#YUMI_BROADCAST_GROUP_ID'; // 需要创建独立的腾讯IM广播群组
@override
String get imAdmin => 'c2c_atyou-admin'; // 独立的管理账号,需要在实际部署中配置
@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('应用配置验证通过');
}
}
}