174 lines
6.0 KiB
Dart
174 lines
6.0 KiB
Dart
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: 'http://10.0.2.2:1100/',
|
||
); // 默认走模拟器宿主机地址,真机可通过 --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 => '20035299';
|
||
|
||
@override
|
||
String get agoraRtcAppid => 'ceb9e2620d454bca9725f7a7f11d4019';
|
||
|
||
@override
|
||
num get gameAppid => 9999999999; // 需要注册新的游戏服务账户并获取独立App ID
|
||
|
||
@override
|
||
String get gameAppChannel => 'yumi';
|
||
|
||
@override
|
||
String get bigBroadcastGroup => '@TGS#2XDMSPK5CR';
|
||
|
||
@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('应用配置验证通过');
|
||
}
|
||
}
|
||
}
|