import 'package:get/get.dart'; enum Flavor { local, dev, pre, sky, sky_dev, sky_pre, xhj, xhj_bundle, xhj_dev, xhj_pre, } class StarLockAMapKey { //iOS平台的key final String iosKey; //Android平台的key final String androidKey; const StarLockAMapKey({required this.iosKey, required this.androidKey}); } class UmengKey { //iOS平台的key final String iosKey; //Android平台的key final String androidKey; //channle final String channel; const UmengKey( {required this.iosKey, required this.androidKey, required this.channel}); } typedef dynamic fCallFunction(); class WechatAppInfo { WechatAppInfo({required this.wechatAppId, required this.universalLink}); String wechatAppId; String universalLink; } class F { static Flavor? appFlavor; // 是否为精简模式(在一些应用商店场景下,需要精简掉一些功能) static bool isLite = false; static String get name => appFlavor?.name ?? ''; static bool get isXHJ => appFlavor == Flavor.xhj || appFlavor == Flavor.xhj_bundle || appFlavor == Flavor.xhj_dev || appFlavor == Flavor.xhj_pre; static bool get isSKY => appFlavor == Flavor.sky || appFlavor == Flavor.sky_dev || appFlavor == Flavor.sky_pre; //便捷判断并返回值 static dynamic sw( {required fCallFunction skyCall, required fCallFunction? xhjCall}) { if (xhjCall == null) { return skyCall(); } switch (appFlavor) { case Flavor.sky: case Flavor.sky_dev: case Flavor.sky_pre: return skyCall(); case Flavor.local: case Flavor.dev: case Flavor.pre: case Flavor.xhj: case Flavor.xhj_bundle: default: return xhjCall(); } } static String get title { switch (appFlavor) { case Flavor.local: return '${'星锁'.tr}-local'; case Flavor.dev: return '${'星锁'.tr}-dev'; case Flavor.pre: return '${'星锁'.tr}-pre'; case Flavor.sky: case Flavor.sky_dev: case Flavor.sky_pre: return '锁通通'.tr; case Flavor.xhj: case Flavor.xhj_bundle: case Flavor.xhj_dev: case Flavor.xhj_pre: return '星星锁'.tr; default: throw Exception('flavor[$name] title not found'); } } static String get navTitle { switch (appFlavor) { case Flavor.local: return '${"星锁".tr}-local'; case Flavor.dev: return '${"星锁".tr}-dev'; case Flavor.pre: return '星锁'.tr; case Flavor.sky: case Flavor.sky_dev: case Flavor.sky_pre: return '锁通通'.tr; case Flavor.xhj: case Flavor.xhj_bundle: case Flavor.xhj_dev: case Flavor.xhj_pre: return '星星锁'.tr; default: throw Exception('flavor[$name] title not found'); } } static String get apiPrefix { switch (appFlavor) { case Flavor.local: return 'http://lock.ge.star-lock.cn'; // 葛工 // return 'http://192.168.1.15:8022'; // 谢工 // return 'http://zhou.lock.star-lock.cn'; // 周工 case Flavor.dev: case Flavor.xhj_dev: case Flavor.sky_dev: return 'https://lock.dev.star-lock.cn'; case Flavor.pre: case Flavor.xhj_pre: case Flavor.sky_pre: return 'https://lock.pre.star-lock.cn'; case Flavor.sky: return 'https://lock.skychip.top'; case Flavor.xhj: case Flavor.xhj_bundle: 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: return const StarLockAMapKey( androidKey: '9388ca47f9674b447a17eff82bc0e2ea', iosKey: 'cdec0512564baa58be26b2e2ac5ef3b7'); case Flavor.dev: return const StarLockAMapKey( androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe', iosKey: 'bd4496e6598ef49796e3a80715035b4d'); case Flavor.pre: return const StarLockAMapKey( androidKey: '11d49b3f4fc09c04a02bbb7500925ba2', iosKey: '883a3355d2d77c2fdc2667030dc97ffe'); case Flavor.sky_dev: return const StarLockAMapKey( androidKey: '', iosKey: '', ); case Flavor.sky_pre: return const StarLockAMapKey( androidKey: '7d59c7416c455af3cf80bfb02478e733', iosKey: 'a5c6c62386aa2b8285b5f8c2cd0597df', ); case Flavor.sky: return const StarLockAMapKey( androidKey: 'fb0d2a3e4208b36452cf636aa025a24f', iosKey: '86ca725a12a629c280e116a317aaba19'); case Flavor.xhj_dev: return const StarLockAMapKey( androidKey: '', iosKey: '', ); case Flavor.xhj_pre: return const StarLockAMapKey( androidKey: '9d96095a53f46f5e323a5e9e7f3eaae2', iosKey: '57f81124738270472558c685199c9a6a', ); case Flavor.xhj: return const StarLockAMapKey( androidKey: '9dd8073a2e96870b206269bb562a887a', iosKey: 'c70047e60ce704d945ea89d6c2763b82'); case Flavor.xhj_bundle: return const StarLockAMapKey( androidKey: 'c47fa8e1d9e2a25321dbee75e1ff7790', iosKey: ''); default: return const StarLockAMapKey( androidKey: 'no valied key', iosKey: 'no valied key', ); } } // StarLockAMapKey static UmengKey get umengKey { switch (appFlavor) { case Flavor.local: return const UmengKey( androidKey: 'local-671244cf80464b33f6df9648', iosKey: 'local-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.dev: return const UmengKey( androidKey: 'dev-671244cf80464b33f6df9648', iosKey: 'dev-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.pre: return const UmengKey( androidKey: 'pre-671244cf80464b33f6df9648', iosKey: 'pre-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.sky_dev: return const UmengKey( androidKey: 'sky_dev-671244cf80464b33f6df9648', iosKey: 'sky_dev-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.sky_pre: return const UmengKey( androidKey: 'sky_pre-671244cf80464b33f6df9648', iosKey: 'sky_pre-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.sky: return const UmengKey( androidKey: '6784e6c99a16fe6dcd2b64b0', iosKey: '6784e6fd8f232a05f1f7d729', channel: 'Product'); case Flavor.xhj_dev: return const UmengKey( androidKey: 'xhj_dev-671244cf80464b33f6df9648', iosKey: 'xhj_dev-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.xhj_pre: return const UmengKey( androidKey: 'xhj_pre-671244cf80464b33f6df9648', iosKey: 'xhj_pre-671244ae80464b33f6df9646', channel: 'Product'); case Flavor.xhj: return const UmengKey( androidKey: '671244cf80464b33f6df9648', iosKey: '671244ae80464b33f6df9646', channel: 'Product'); default: return const UmengKey( androidKey: 'default-671244cf80464b33f6df9648', iosKey: 'default-671244ae80464b33f6df9646', channel: 'Product'); } } // StarLockAMapKey static String get jPushKey { switch (appFlavor) { case Flavor.local: case Flavor.dev: case Flavor.pre: return ''; case Flavor.sky_dev: case Flavor.sky_pre: case Flavor.sky: return '7ff37d174c1a568a89e98dad'; case Flavor.xhj_dev: case Flavor.xhj_pre: case Flavor.xhj: return '251fc8074820d122b6de58d2'; case Flavor.xhj_bundle: return '5ccdb9b8d3faaae66ba5d02e'; default: return ''; } } static WechatAppInfo get wechatAppInfo { switch (appFlavor) { case Flavor.local: return WechatAppInfo( wechatAppId: 'wxbe340095d2b8fd51', universalLink: 'https://apt.skychip.top/'); case Flavor.dev: return WechatAppInfo( wechatAppId: 'wxbe340095d2b8fd51', universalLink: 'https://apt.skychip.top/'); case Flavor.pre: case Flavor.sky_pre: case Flavor.xhj_pre: return WechatAppInfo( wechatAppId: 'wxbe340095d2b8fd51', universalLink: 'https://apt.skychip.top/'); case Flavor.sky: return WechatAppInfo( wechatAppId: 'wxbe340095d2b8fd51', universalLink: 'https://lock.skychip.top/'); case Flavor.xhj: case Flavor.xhj_bundle: return WechatAppInfo( wechatAppId: 'wx8e48112e22343817', universalLink: 'https://lock.xhjcn.ltd/'); default: return WechatAppInfo( wechatAppId: 'wxbe340095d2b8fd51', universalLink: ''); } } // 是否是生产环境 static bool get isProductionEnv { switch (appFlavor) { case Flavor.local: case Flavor.dev: case Flavor.pre: return false; case Flavor.sky: case Flavor.xhj: case Flavor.xhj_bundle: return true; default: return false; } } // 是否是生产环境 static String get loginBtnImagePrefix { switch (appFlavor) { case Flavor.local: case Flavor.dev: case Flavor.pre: case Flavor.sky_dev: case Flavor.sky_pre: case Flavor.sky: return 'sky'; case Flavor.xhj_dev: case Flavor.xhj_pre: case Flavor.xhj: case Flavor.xhj_bundle: return 'xhj'; default: return 'sky'; } } }