You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB

/*
* ====================================================
* package : constants
* author : Created by nansi.
* time : 2019/5/16 10:02 AM
* remark :
* ====================================================
*/
import 'dart:io';
import 'package:recook/constants/api.dart';
import 'package:recook/manager/user_manager.dart';
import 'package:recook/utils/user_level_tool.dart';
class AppConfig {
static String versionNumber;
static bool debug;
static bool needEncrypt;
static bool showCommission;
static bool showExtraCommission = false;
static const String WX_APP_ID = "wx21724a42aebe20cc";
static const String WX_APP_SECRET = "83f8932eb742257316e3168ba9e920dc";
static const String WX_APP_MINIPRO_USERNAME = "gh_295d15c0ef68";
static initial({
bool dev = true,
bool useEncrypt = true,
bool canShowCommission = true,
}) {
debug = dev;
needEncrypt = useEncrypt;
showCommission = canShowCommission;
Api.toggleEnvironment(debug);
}
static setDebug(bool isDebug) {
if (debug == isDebug) {
return;
}
debug = isDebug;
Api.toggleEnvironment(debug);
}
static setEncrypt(bool isEncrypt) {
if (needEncrypt == isEncrypt) {
return;
}
needEncrypt = isEncrypt;
}
static setShowCommission(bool canShowCommission) {
if (showCommission == canShowCommission) {
return;
}
showCommission = canShowCommission;
}
static bool getShowCommission() {
// return false;
if (showExtraCommission) {
return true;
} else if ((!UserManager.instance.haveLogin ||
UserLevelTool.currentRoleLevelEnum() == UserRoleLevel.Vip ||
UserLevelTool.currentRoleLevelEnum() == UserRoleLevel.None) &&
!Platform.isAndroid) {
return false;
}
return showCommission;
}
}