57 lines
2.1 KiB
Dart
57 lines
2.1 KiB
Dart
import 'package:flutter/foundation.dart';
|
||
|
||
/// petsHeroAI API 配置
|
||
abstract final class ApiConfig {
|
||
/// 运行时日志级别,由编译时注入,例如:
|
||
/// `flutter run --release --dart-define=APP_LOG_LEVEL=trace`
|
||
/// 为 `trace` / `debug` / `verbose` 时,release 包也会输出全量调试日志([AppLogger]、代理请求日志等)。
|
||
static const String appLogLevel =
|
||
String.fromEnvironment('APP_LOG_LEVEL', defaultValue: '');
|
||
|
||
/// 与 debug 模式相同:全量应用日志。release 下仅当 [appLogLevel] 为 trace/debug/verbose 时为 true。
|
||
static bool get debugLogs {
|
||
if (kDebugMode) return true;
|
||
final l = appLogLevel.toLowerCase();
|
||
return l == 'trace' || l == 'debug' || l == 'verbose';
|
||
}
|
||
|
||
/// AES 密钥
|
||
static const String aesKey = 'liyP4LkMfP68XvCt';
|
||
|
||
/// 应用标识 (sentinel)
|
||
static const String appId = 'HAndroid';
|
||
|
||
/// 应用包名
|
||
static const String packageName = 'com.petsheroai.app';
|
||
|
||
/// 预发环境域名
|
||
static const String preBaseUrl = 'https://ai.petsheroai.xyz';
|
||
//'https://ai.petsheroai.xyz'; //'https://pre-ai.petsheroai.xyz';
|
||
|
||
/// 生产环境域名
|
||
static const String prodBaseUrl = 'https://ai.petsheroai.xyz';
|
||
|
||
/// 代理入口路径
|
||
static const String proxyPath = '/quester/defender/summoner';
|
||
|
||
/// 调试时本地代理地址(手机无法直连域名时,用电脑做转发)
|
||
/// 例如: 'http://192.168.1.100:8010'(电脑 IP)
|
||
/// 设为 null 则直连预发域名
|
||
static const String? debugBaseUrlOverride = null;
|
||
|
||
/// 当前使用的 baseUrl(调试用预发,打包用生产)
|
||
static String get baseUrl {
|
||
if (!kDebugMode) return prodBaseUrl;
|
||
return debugBaseUrlOverride ?? preBaseUrl;
|
||
}
|
||
|
||
/// 代理入口完整 URL
|
||
static String get proxyUrl => '$baseUrl$proxyPath';
|
||
|
||
/// 单次 HTTP 请求超时(避免弱网/服务端无响应时永久卡住启动流程)
|
||
static const Duration httpRequestTimeout = Duration(seconds: 20);
|
||
|
||
/// Wall-clock cap for cold-start login (device id, attribution, fast_login, etc.); then dismiss overlay and show in-app retry.
|
||
static const Duration startupWallTimeout = Duration(seconds: 72);
|
||
}
|