144 lines
3.5 KiB
Dart
Executable File
144 lines
3.5 KiB
Dart
Executable File
import 'package:get/get.dart';
|
|
|
|
enum Flavor {
|
|
local,
|
|
dev,
|
|
pre,
|
|
sky,
|
|
xhj,
|
|
}
|
|
|
|
class StarLockAMapKey {
|
|
//iOS平台的key
|
|
final String iosKey;
|
|
|
|
//Android平台的key
|
|
final String androidKey;
|
|
|
|
const StarLockAMapKey({required this.iosKey, required this.androidKey});
|
|
}
|
|
|
|
typedef dynamic fCallFunction();
|
|
|
|
class F {
|
|
static Flavor? appFlavor;
|
|
|
|
// 是否为精简模式(在一些应用商店场景下,需要精简掉一些功能)
|
|
static bool isLite = false;
|
|
|
|
static String get name => appFlavor?.name ?? '';
|
|
|
|
static bool get isXHJ => appFlavor == Flavor.xhj;
|
|
|
|
//便捷判断并返回值
|
|
static dynamic sw(
|
|
{required fCallFunction skyCall, required fCallFunction? xhjCall}) {
|
|
if (xhjCall == null) {
|
|
return skyCall();
|
|
}
|
|
switch (appFlavor) {
|
|
case Flavor.sky:
|
|
return skyCall();
|
|
case Flavor.local:
|
|
case Flavor.dev:
|
|
case Flavor.pre:
|
|
case Flavor.xhj:
|
|
default:
|
|
return xhjCall();
|
|
}
|
|
}
|
|
|
|
static String get title {
|
|
switch (appFlavor) {
|
|
case Flavor.local:
|
|
return '星锁-local';
|
|
case Flavor.dev:
|
|
return '星锁-dev';
|
|
case Flavor.pre:
|
|
return '星锁-pre';
|
|
case Flavor.sky:
|
|
return '锁通通';
|
|
case Flavor.xhj:
|
|
return '星星锁';
|
|
default:
|
|
throw Exception('flavor[$name] title not found');
|
|
}
|
|
}
|
|
|
|
static String get navTitle {
|
|
switch (appFlavor) {
|
|
case Flavor.local:
|
|
return '${"starLock".tr}-local';
|
|
case Flavor.dev:
|
|
return '${"starLock".tr}-dev';
|
|
case Flavor.pre:
|
|
return 'starLock'.tr;
|
|
case Flavor.sky:
|
|
return '锁通通';
|
|
case Flavor.xhj:
|
|
return '星星锁';
|
|
default:
|
|
throw Exception('flavor[$name] title not found');
|
|
}
|
|
}
|
|
|
|
static String get apiPrefix {
|
|
switch (appFlavor) {
|
|
case Flavor.local:
|
|
return 'https://ge.lock.star-lock.cn'; // 葛工
|
|
// return 'http://192.168.1.15:8022'; // 谢工
|
|
case Flavor.dev:
|
|
return 'https://dev.lock.star-lock.cn';
|
|
case Flavor.pre:
|
|
return 'https://pre.lock.star-lock.cn';
|
|
case Flavor.sky:
|
|
return 'https://lock.skychip.top';
|
|
case Flavor.xhj:
|
|
return 'https://lock.xhjcn.ltd';
|
|
// return 'https://pre.lock.star-lock.cn';
|
|
default:
|
|
throw Exception('flavor[$name] apiPrefix not found');
|
|
}
|
|
}
|
|
|
|
// StarLockAMapKey
|
|
static StarLockAMapKey get aMapKey {
|
|
switch (appFlavor) {
|
|
case Flavor.local:
|
|
case Flavor.dev:
|
|
return const StarLockAMapKey(
|
|
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe',
|
|
iosKey: 'bd4496e6598ef49796e3a80715035b4d');
|
|
case Flavor.pre:
|
|
return const StarLockAMapKey(
|
|
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2',
|
|
iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
|
|
case Flavor.sky:
|
|
return const StarLockAMapKey(
|
|
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f',
|
|
iosKey: '86ca725a12a629c280e116a317aaba19');
|
|
case Flavor.xhj:
|
|
return const StarLockAMapKey(
|
|
androidKey: '9dd8073a2e96870b206269bb562a887a',
|
|
iosKey: 'c70047e60ce704d945ea89d6c2763b82');
|
|
default:
|
|
throw Exception('flavor[$name] aMapKey not found');
|
|
}
|
|
}
|
|
|
|
// 是否是生产环境
|
|
static bool get isProductionEnv {
|
|
switch (appFlavor) {
|
|
case Flavor.local:
|
|
case Flavor.dev:
|
|
case Flavor.pre:
|
|
return false;
|
|
case Flavor.sky:
|
|
case Flavor.xhj:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|